From 38dc762f626b55befafa5890afeec0029bfa0592 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 30 Dec 2018 00:04:34 +0100 Subject: [PATCH] Initialize gCommandPosition with LOCATION_NULL in case its not set. --- src/openrct2/Game.cpp | 5 +++++ src/openrct2/actions/GameAction.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 1348b92e2e..57429537c2 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -435,6 +435,11 @@ int32_t game_do_command_p( *ebx &= ~GAME_COMMAND_FLAG_APPLY; + // Make sure the camera position won't change if the command skips setting them. + gCommandPosition.x = LOCATION_NULL; + gCommandPosition.y = LOCATION_NULL; + gCommandPosition.z = LOCATION_NULL; + // First call for validity and price check new_game_command_table[command](eax, ebx, ecx, edx, esi, edi, ebp); cost = *ebx; diff --git a/src/openrct2/actions/GameAction.h b/src/openrct2/actions/GameAction.h index 5cecd7b41a..daeb95cbb5 100644 --- a/src/openrct2/actions/GameAction.h +++ b/src/openrct2/actions/GameAction.h @@ -69,7 +69,7 @@ public: rct_string_id ErrorTitle = STR_NONE; rct_string_id ErrorMessage = STR_NONE; std::array ErrorMessageArgs; - CoordsXYZ Position = {}; + CoordsXYZ Position = { LOCATION_NULL, LOCATION_NULL, LOCATION_NULL }; money32 Cost = 0; uint16_t ExpenditureType = 0;