Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game unpause if press highscore table. #5428

Closed
DorpsGek opened this issue Jan 1, 2013 · 7 comments
Closed

Game unpause if press highscore table. #5428

DorpsGek opened this issue Jan 1, 2013 · 7 comments
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

DorpsGek commented Jan 1, 2013

oafw opened the ticket and wrote:

Game unpause if press highscore table.

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/5428
@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 3, 2013

oafw wrote:

Tiny patch. r24882.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/5428#comment11845

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 5, 2013

Zuu wrote:

Why do you use the PM_PAUSED_GAME_SCRIPT pause mode?


This comment was imported from FlySpray: https://bugs.openttd.org/task/5428#comment11853

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 7, 2013

oafw wrote:

I've used this for minimize code changes.
That's what happens when you press highscore tables button:
If you had paused game pasue mode will be PM_PAUSED_NORMAL and nothing will happen.
If you hadn't paused game pasue mode will be PM_PAUSED_GAME_SCRIPT and game will pause and unpause.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5428#comment11856

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 7, 2013

Zuu wrote:

A problem with your fix is that if the game was paused in pause mode PM_PAUSED_GAME_SCRIPT, you now allow players to unpause the game using the highscore table. Eg. you change the problem for another problem. Also, using the pause mode designed to be used for Game Scripts in other contexts looks wrong to me.

What you need to do is to store a variable if the game was paused or not prior to pausing the game. When the Highscore GUI is closed, you can then restore the old value. It is enough that this variable have the lifetime of the Highscore window. So you can probably make it a member variable of the Highscore window class.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5428#comment11857

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 8, 2013

oafw wrote:

You are right.
r24893.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/5428#comment11864

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 8, 2013

Zuu wrote:

+ game_paused_by_player = _pause_mode;

Always use this-> when accessing a member variable. (applies to this line and the other usages of game_paused_by_player)

Also this line assigns a boolean variable using _pause_mode which may be one of several values. We don't like implicitly converting a byte to a bool. Instead you should test _pause_mode against the constant for the relevant pause mode.

Like this:
this->game_paused_by_player = _pause_mode == PM_PAUSED_NORMAL;

Edit: Attached updated patch

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/5428#comment11865

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 8, 2013

Zuu closed the ticket.

Reason for closing: Fixed

In r24898. Thanks for your patch. (And sorry for forgetting to attribute you in the commit log. I will try to be better at that the next time)


This comment was imported from FlySpray: https://bugs.openttd.org/task/5428

@DorpsGek DorpsGek closed this as completed Jan 8, 2013
@DorpsGek DorpsGek added component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) bug labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant