Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2003:
[Freeciv-Dev] Re: (PR#4536) pcity->ai.urgency not updated after reload
Home

[Freeciv-Dev] Re: (PR#4536) pcity->ai.urgency not updated after reload

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#4536) pcity->ai.urgency not updated after reload
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Fri, 11 Jul 2003 14:17:26 -0700
Reply-to: rt@xxxxxxxxxxxxxx

On Fri, 11 Jul 2003, Jason Short wrote:

> --On Friday, July 11, 2003 09:29:35 -0700 Gregory Berkolaiko 
> <Gregory.Berkolaiko@xxxxxxxxxxxx> wrote:
> 
> >
> > On Fri, 11 Jul 2003, Jason Short wrote:
> >
> >> Valgrind shows that pcity->ai.urgency is never updated after a saved
> >> game is loaded.
> >
> > AFAIU it was introduced by commenting out srv_main.c:1772
> > ===================
> > Revision 1.125 / (download) - [select for diffs] , Fri May 2 16:41:04
> > 2003 UTC (2 months, 1 week ago) by per
> > Changes since 1.124: +1 -1 lines
> > Diff to previous 1.124
> >
> > Kludge fix for a bug that appear with AI government code change. The bug
> > appears because we send unit info before data has been properly
> > initialized in the client. A call to assess_danger_player() that seems
> > totally unnecessary triggers the bug, and has therefore been removed.
> > Further investigation and fixing is in order, however.
> > ===================
> >
> > For more info see 4107.
> >
> >> Most likely this is a bug; the urgency should be recalculated when it is
> >> needed.  Possibly the urgency should be saved.  This patch simply
> >> initializes it to 0.
> >
> > Does valgrind tell us where is it used uninitialized?
> 
> 
> ==32185== Conditional jump or move depends on uninitialised value(s)
> ==32185==    at 0x80C9D74: ai_airlift (aiunit.c:110)
> ==32185==    by 0x80CFDF3: ai_manage_units (aiunit.c:2894)
> ==32185==    by 0x804DEA8: ai_start_turn (srv_main.c:432)
> ==32185==    by 0x804F6E2: main_loop (srv_main.c:1438)

[...]

Och...  I think the best solution would be to call assess_danger_player in
ai_start_turn.  This would slow things down a bit, but would make AI 
marginally more sensible...

G.





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