From 6bc9bb5de05cf5d327d1841fceaabe7b3073da66 Mon Sep 17 00:00:00 2001 From: Louis Moureaux Date: Sun, 12 Nov 2023 22:50:22 +0100 Subject: [PATCH] Stop disbanding units under UWT when bouncing them When a unit affected by unit wait time was bounced, the generated move order was rejected by the move handling code. As a consequence, the unit ended up being disbanded. This affected units doing terraforming work (e.g. turning land to ocean). This forced players to issue the terraforming orders at least UWT seconds before TC, which forced them to connect at specific times of the day. Since one of the goals of UWT is exactly to avoid this constraint around TC, adding a similar constraint around TC - UWT is the opposite of good. --- server/unittools.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/unittools.cpp b/server/unittools.cpp index 1109c740dd..ec40bf9054 100644 --- a/server/unittools.cpp +++ b/server/unittools.cpp @@ -1375,8 +1375,15 @@ void bounce_unit(struct unit *punit, bool verbose, bounce_reason reason, packet.orders[i] = steps[i].order; } + // Disable unit wait time since this is a forced action + auto timestamp = punit->action_timestamp; + punit->action_timestamp = 0; + handle_unit_orders(pplayer, &packet); + // Restore unit wait time + punit->action_timestamp = timestamp; + if (punit->tile != punit_tile) { return; }