The International Simutrans Forum

 

Author Topic: Pause button issues in tutorial  (Read 176 times)

0 Members and 1 Guest are viewing this topic.

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1516
    • Simutrans-BLOG
  • Languages: ES
Pause button issues in tutorial
« on: October 17, 2020, 05:56:46 PM »

Pausing the game is causing a malfunction when building objects.

I can solve this with a boolian function that lets me know if the game is paused.

example:
is_pause ()

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4756
  • Languages: EN, DE, AT
Re: Pause button issues in tutorial
« Reply #1 on: October 18, 2020, 09:26:32 AM »
If the game is paused the script is paused also. What exactly is the malfunction?

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1516
    • Simutrans-BLOG
  • Languages: ES
Re: Pause button issues in tutorial
« Reply #2 on: October 18, 2020, 09:48:11 AM »
If the game is paused the script is paused also. What exactly is the malfunction?
The "is_work_allowed_here" function keeps working even if the game is paused.
What I want to do is show a warning message that says "Advance is not allowed with the game paused." Every time the player tries to use a tool with the game paused, is it possible to do this?.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4756
  • Languages: EN, DE, AT
Re: Pause button issues in tutorial
« Reply #3 on: October 18, 2020, 10:06:10 AM »
in r 9303

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1516
    • Simutrans-BLOG
  • Languages: ES
Re: Pause button issues in tutorial
« Reply #4 on: October 18, 2020, 11:30:41 PM »
Great, it works as expected, thank you very much!.  8)

There is a problem that I could not notice at first, using "debug.is_paused ()" causes simutrans to pause, this should not happen. :-[ 

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4756
  • Languages: EN, DE, AT
Re: Pause button issues in tutorial
« Reply #5 on: October 19, 2020, 06:54:27 AM »
will fix tonight.
In  script/api/api_control.cc line 90 replace pause_game by is_game_paused

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1516
    • Simutrans-BLOG
  • Languages: ES
Re: Pause button issues in tutorial
« Reply #6 on: October 19, 2020, 08:11:20 AM »
will fix tonight.
In  script/api/api_control.cc line 90 replace pause_game by is_game_paused
Excellent, now it works perfect. :)


I want to do an experiment, is it possible to do the same with the underground view tool ?, so I can try to fix a small problem in the underground constructions.
Code: [Select]
bool is_game_paused()
{
tool_pause_t t;
return t.is_selected();
}