OpenTTD

Tasklist

FS#5283 - Scripts and pause mode

Attached to Project: OpenTTD
Opened by frosch (frosch) - Thursday, 30 August 2012, 18:35 GMT
Type Bug
Category Script
Status Confirmed
Assigned To No-one
Operating System All
Severity High
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

Multiple problems:
1) In singleplayer the build-in-pause setting is only checked in DoCommandP, thus scripts (well. GS) circumvent any pause setting and can execute anything.

2) In singleplayer the GS can ask a question in pause mode, but the player cannot answer the question in the most restrictive build-on-pause setting. Closing the window causes "not allowed in pause" error.

3) In multiplayer the server command loop drops all commands in pause mode, which are not allowed. It does this without sending any error to the clients. This causes scripts to deadlock when they execute a command, since they are suspended until the command reports a result back.

3.1) GS can deadlock themself by pausing the game and then executing a command which is not allowed in pause mode. Even a human is not allowed to unpause the game then.
3.2) AIs are also deadlocked if they happen to execute a command in the same tick as the pause command is triggered. (The AI still runs when the game is not paused; but the command will be dropped and never report back)


To solve this:
a) Also perform the pause mode check for scripts in singleplayer, to make SP and MP behave consistent.
b) Make the server report an error if commands are dropped in pause mode, so scripts can continue.
c) Maybe GS should be allowed to execute all commands (also GSCompanyMode) regardless of pause setting.
This task depends upon

Loading...