Complete.Org: Mailing Lists: Archives: freeciv-dev: December 1999:
[Freeciv-Dev] Re: infinite loop in barbarian leader goto? (PR#189)
Home

[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]
To: freeciv-dev@xxxxxxxxxxx
Cc: Greg Wooledge <wooledge@xxxxxxxxxxx>, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: infinite loop in barbarian leader goto? (PR#189)
From: Corin Anderson <corin@xxxxxxxxxx>
Date: Thu, 23 Dec 1999 22:17:21 -0800 (PST)

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

Attachment: aiunit.c.diff
Description: Text document


[Prev in Thread] Current Thread [Next in Thread]