]> git.pond.sub.org Git - empserver/commit
Simplify ask_olist and get_dlist() not to re-read land units
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 2 Jan 2010 08:14:55 +0000 (09:14 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 19 Jan 2010 07:37:05 +0000 (08:37 +0100)
commitec75a407c75b3ed7407ce3c3f39953e0991e8aed
tree885258c5e599c42416b38aa519caacd56cb6a5dc
parentba0d4d00362dd6e57ec8e9a3b893dd9a95319018
Simplify ask_olist and get_dlist() not to re-read land units

getland() is obviously redundant in get_dlist(), because the land unit
can't have changed since the previous read.

What's up with ask_olist() is less obvious.  For each capable land
unit, ask_olist() asks the player whether to attack with it.  If it
attacks, it gets copied into olist.  Since asking the player yields
the processor, these copies can become stale.  However, re-reading
fixes that just for the last one.  Moreover, the code copes with stale
copies just fine: ask_olist() is always directly followed by
att_get_offense() or att_move_in_off(), and both replace the
potentially stale copy in olist.
src/lib/subs/attsub.c