[Freeciv-Dev] Re: infinite loop in barbarian leader goto? (PR#189)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Wed, 8 Dec 1999, Greg Wooledge wrote:
> While playing the CVS version (Dec. 6 snapshot), the client appeared to
> be locked up. I checked top and found that the civserver appeared to be
> running away. I attached gdb to the running civserver, and got this
> stack trace:
[snip]
This bug has yet to be closed. I noticed it again today, in two separate
games (what else should I be doing during Christmas break?). Attached is
a patch that fixes the problem.
Briefly, the problem was that the goto code that the Barbarian Leader used
(same goto code that all AIs use) may opt to -not- move a unit if there
aren't quite enough movement points left to guarantee the move.
Unfortunately, the Barbarian Leader code has a big while loop that tries
to exhaust the moves_left of the unit, by doing gotos. You can see the
problem -- the goto won't actually move, so the barbarian leader will
continue to loop. In fewer lines of code than this explanation the
problem can be avoided.
Corey
aiunit.c.diff
Description: Text document
|
|