]> git.pond.sub.org Git - empserver/commit
Don't let planes fly to a carrier without sufficient space
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 23 Jun 2012 14:38:04 +0000 (16:38 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 12 Jul 2012 17:51:57 +0000 (19:51 +0200)
commitb60e5be22c8b5559f82ad6dcb90f3fd747c9bc49
treef967cfcd35b5b61aec63eb32f3066a01af660c91
parent81efebd36712dbc24a216446a0bdf3221418cae3
Don't let planes fly to a carrier without sufficient space

We test whether the the carrier has space for each plane individually
instead of whether it has space for all of them.  The planes that fit
land, the others abort and get teleported home.  Abusable.

pln_oneway_to_carrier_ok() was created in commit 1127762c (v4.2.17) to
fix almost the same bug.  It worked fine then, because
fit_plane_on_ship() worked with load counters, and incremented them.

Broken in commit 3e370da5 (v4.3.17), which made fit_plane_on_ship()
count the loaded planes, to permit the removal of load counters.  But
unlike load counters, loaded planes don't change during
pln_oneway_to_carrier_ok().  Thus, each plane is checked individually.

Fix by tallying all the planes before checking for space.
src/lib/subs/plnsub.c