(svn r21428) -Fix [FS#4021]: vehicles could be built while the game it paused. Now you can enable or disable that with a setting

This commit is contained in:
rubidium 2010-12-07 21:09:30 +00:00
parent e170b1d83e
commit 49162ab39b
4 changed files with 35 additions and 8 deletions

View File

@ -515,6 +515,11 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac
int x = TileX(tile) * TILE_SIZE;
int y = TileY(tile) * TILE_SIZE;
if (_pause_mode != PM_UNPAUSED && !IsCommandAllowedWhilePaused(cmd)) {
ShowErrorMessage(GB(cmd, 16, 16), STR_ERROR_NOT_ALLOWED_WHILE_PAUSED, WL_INFO, x, y);
return false;
}
#ifdef ENABLE_NETWORK
/* Only set p2 when the command does not come from the network. */
if (!(cmd & CMD_NETWORK_COMMAND) && GetCommandFlags(cmd) & CMD_CLIENT_ID && p2 == 0) p2 = CLIENT_ID_SERVER;

View File

@ -3464,6 +3464,7 @@ STR_ERROR_OWNED_BY :{WHITE}... owne
STR_ERROR_AREA_IS_OWNED_BY_ANOTHER :{WHITE}... area is owned by another company
STR_ERROR_NAME_MUST_BE_UNIQUE :{WHITE}Name must be unique
STR_ERROR_GENERIC_OBJECT_IN_THE_WAY :{WHITE}{1:STRING} in the way
STR_ERROR_NOT_ALLOWED_WHILE_PAUSED :{WHITE}Not allowed while paused
# Local authority errors
STR_ERROR_LOCAL_AUTHORITY_REFUSES_TO_ALLOW_THIS :{WHITE}{TOWN} local authority refuses to allow this

View File

@ -1365,7 +1365,7 @@ void GameLoop()
if (!_pause_mode && HasBit(_display_opt, DO_FULL_ANIMATION)) DoPaletteAnimations();
if (!_pause_mode || _cheats.build_in_pause.value) MoveAllTextEffects();
if (!_pause_mode || _settings_game.construction.command_pause_level > CMDPL_NO_CONSTRUCTION) MoveAllTextEffects();
InputLoop();

View File

@ -2213,13 +2213,34 @@ static void MouseLoop(MouseClick click, int mousewheel)
case MC_DOUBLE_LEFT:
case MC_LEFT:
DEBUG(misc, 2, "Cursor: 0x%X (%d)", _cursor.sprite, _cursor.sprite);
if (_thd.place_mode != HT_NONE &&
/* query button and place sign button work in pause mode */
_cursor.sprite != SPR_CURSOR_QUERY &&
_cursor.sprite != SPR_CURSOR_SIGN &&
_pause_mode != PM_UNPAUSED &&
!_cheats.build_in_pause.value) {
return;
if (_thd.place_mode != HT_NONE && _pause_mode != PM_UNPAUSED) {
switch (_settings_game.construction.command_pause_level) {
case CMDPL_ALL_ACTIONS:
/* We allow all actions. */
break;
case CMDPL_NO_LANDSCAPING:
if (_cursor.sprite == SPR_CURSOR_CLONE_TRAIN ||
_cursor.sprite == SPR_CURSOR_CLONE_ROADVEH ||
_cursor.sprite == SPR_CURSOR_CLONE_SHIP ||
_cursor.sprite == SPR_CURSOR_CLONE_AIRPLANE) {
/* Cloning is allowed. */
break;
}
/* FALL THROUGH */
case CMDPL_NO_CONSTRUCTION:
if (_cursor.sprite == SPR_CURSOR_SIGN ||
(_cursor.sprite >= SPR_CURSOR_PICKSTATION_FIRST && _cursor.sprite <= SPR_CURSOR_PICKSTATION_LAST)) {
/* Building signs or making orders is allowed. */
break;
}
/* FALL THROUGH */
case CMDPL_NO_ACTIONS:
if (_cursor.sprite == SPR_CURSOR_QUERY) break;
/* All other ones are not allowed to build. */
return;
}
}
if (!HandleViewportClicked(vp, x, y) &&