From 10ebac7e3bce1545a63486f07aeb786b194549e5 Mon Sep 17 00:00:00 2001 From: Matthew Fioravante Date: Tue, 18 Dec 2018 22:45:03 -0500 Subject: [PATCH] Proceed with movement vehicle fix If you try to move a vehicle which isn't on the map, ProceedWithMovement will not wait for this to complete. Instead the movement stays queued forever until you enter the same map as the vehicle. This also works if you use SetVehicleLocation() after the move command to put the vehicle on the same map as you. Once the vehicle is on the same map as the player, the movement will immediately execute. Fixes an issue where the game would hang in HH3 when ProceedWithMovement was used. To see the bug before this commit, setup the following event code ``` Move Vehicle Airship: Up ProceedWithMovement Teleport to map with airship ``` In RPG_RT you'll teleport, and then upon arriving the airship will move. In player the game will hang. --- src/game_map.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/game_map.cpp b/src/game_map.cpp index 6a4c79d01bc..329aa639ad9 100644 --- a/src/game_map.cpp +++ b/src/game_map.cpp @@ -1312,10 +1312,11 @@ bool Game_Map::IsAnyEventStarting() { } bool Game_Map::IsAnyMovePending() { - std::vector::iterator it; - for (it = pending.begin(); it != pending.end(); ++it) - if (!(*it)->IsMoveRouteRepeated()) + for (auto& ev: pending) { + if (ev->GetMapId() == GetMapId() && ev->IsMoveRouteRepeated()) { return true; + } + } return false; }