]> git.pond.sub.org Git - empserver/commit
Refactor and fix takeover.c
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 14 Sep 2008 19:13:16 +0000 (15:13 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 15 Sep 2008 23:40:44 +0000 (19:40 -0400)
commit5f6e27ff801cae398020cdff3a7b7547e72df439
tree8630be360afb0991e6e8254533d0218f505cf7a3
parent94a3108b23d23afa8e65aa8c138845cc905c3c28
Refactor and fix takeover.c

Factor new takeover_unit() out of takeover_ship(), takeover_plane(),
takeover_land().  This fixes the following bugs in assault, attack,
board, lboard, paradrop and pboard:

* When the "land unit loaded on land unit" relation had a cycle,
  takeover_land() went into an infinite recursion.  Such cycles exist
  only in a corrupt game state.

* Nukes armed on planes weren't taken over along with their plane.
  Broken in commit 2e40a4bb, v4.3.3.

* Taking over land units with negative mobility increased mobility to
  zero.  Ditto planes embarked on ships or land units.

* Taking over planes embarked on ships or land units didn't clear
  their wing.

* Taking over planes and land units updated their MOB_ACCESS timestamp
  (pln_access, lnd_access), except for planes not embarked on
  anything.  This had no effect.
src/lib/subs/takeover.c