From b3fd7879596defeb6af78acb4ea45e4418821bdf Mon Sep 17 00:00:00 2001 From: glx22 Date: Sat, 7 Sep 2019 18:37:01 +0200 Subject: Fix #7188: check the validity of command callback for scripts (#7701) --- src/game/game_instance.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/game') diff --git a/src/game/game_instance.cpp b/src/game/game_instance.cpp index be093ca00..8d4f5f2b2 100644 --- a/src/game/game_instance.cpp +++ b/src/game/game_instance.cpp @@ -257,11 +257,13 @@ void GameInstance::Died() * @param tile The tile on which the command was executed. * @param p1 p1 as given to DoCommandPInternal. * @param p2 p2 as given to DoCommandPInternal. + * @param cmd cmd as given to DoCommandPInternal. */ -void CcGame(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) +void CcGame(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd) { - Game::GetGameInstance()->DoCommandCallback(result, tile, p1, p2); - Game::GetGameInstance()->Continue(); + if (Game::GetGameInstance()->DoCommandCallback(result, tile, p1, p2, cmd)) { + Game::GetGameInstance()->Continue(); + } } CommandCallback *GameInstance::GetDoCommandCallback() -- cgit v1.2.3-54-g00ecf