Skip to content

Commit

Permalink
Stop disbanding units under UWT when bouncing them
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lmoureaux committed Nov 22, 2023
1 parent 452fbc5 commit 6bc9bb5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions server/unittools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 6bc9bb5

Please sign in to comment.