Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2004:
[Freeciv-Dev] (PR#9033) Infinite loop in ai_manage_ferryboat()
Home

[Freeciv-Dev] (PR#9033) Infinite loop in ai_manage_ferryboat()

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9033) Infinite loop in ai_manage_ferryboat()
From: "James Canete" <use_less@xxxxxxxxxxx>
Date: Sat, 19 Jun 2004 14:26:28 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9033 >

In ai_manage_ferryboat() in aiunit.c, there is a possibility for an
infinite loop.

If the boss of a ferryboat is off the boat, has no more moves left, and
not released control of the ferryboat, and the ferryboat has other
passengers, the ferry will loop continuously waiting for the boss to
move onto the boat.

This patch makes the ferryboat abandon its previous boss if it has other
passengers on the boat.  This seems to fix the infinite loop, but may
have other consequences.

The infinite loop did not show up previously because this piece of code
previously used punit->occupy, which was almost always set to zero, and
that caused a loaded barbarian boat to be wiped before it could do
anything.  And even if it wasn't a barbarian boat, the incorrect value
of punit->occupy would give a premature exit to the loop.

Savegames diverge from plain CVS quickly, but that was expected.

-James Canete

Attachment: fix_ai_infinite_loop.diff
Description: Binary data


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9033) Infinite loop in ai_manage_ferryboat(), James Canete <=