Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2000:
[Freeciv-Dev] bug/fix with ai.wallvalue (PR#331)
Home

[Freeciv-Dev] bug/fix with ai.wallvalue (PR#331)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] bug/fix with ai.wallvalue (PR#331)
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Mon, 3 Apr 2000 05:35:43 -0700 (PDT)

While doing some regession testing, I found a bug that the AI may
use uninitialized data.  Actually it is related to a previous bug, 
but the previous attempted fix only worked for all-AI games (and 
maybe only worked in the sense of giving determinist results for 
regression testing).

The problem is with pcity->ai.wallvalue, which is used in various
assess_defense* functions in ai, and set via call to assess_danger(),
normally via military_advisor_choose_build().  This means it is only 
set for AI players, and probably only makes sense for the "current" 
AI player after that assess_danger call (since data on others may be 
out of date).

In most cases the above restriction probably applies, however in
some cases assess_defense is also called for "foreign" cities: for 
pcity in invasion_funct(), and maybe dcity in ai_military_gothere().
In these cases pcity may be owned by a human, and ai.wallvalue is
unitialised.

The ai code is too inscrutable for me to work out what ai.wallvalue
is supposed to mean, but the problematic calls to assess_defense()
only use the boolean return value, so I think the follow patch is
a solution.

-- David

Attachment: fix_ai_wallvalue1.diff.gz
Description: GNU Zip compressed data


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