Complete.Org: Mailing Lists: Archives: freeciv-ai: December 2004:
[freeciv-ai] Re: (PR#9610) AI movemap

[freeciv-ai] Re: (PR#9610) AI movemap

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [freeciv-ai] Re: (PR#9610) AI movemap
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sun, 19 Dec 2004 15:59:41 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: >

On Sun, 19 Dec 2004, Benedict Adamson wrote:
> <URL: >
> I wrote:
> ...
> > The movemap structure seems to mishandle deleted units.
> ...
> > The list[s] actually
> > holds pointers to the unit IDs (&punit->id), which is no safer than
> > holding thepointers to the units themselves (punit).
> ...
> Subsequent investigation confirmed my suspicion. Attached is a corrected
> version of Per's movemap patch. This version uses a genlist rather than
> a speclist. This should be applicable to the CVS development version of
> 2004-12-18. However, I had to extract the patch from my own, greatly
> modified version of the code, so it is untested.

Oh, my. Good catch!

I am not too hot on your fix, though. Using genlists directly is bad. I
think perhaps using a specvec here might be better. We know how big to
make it beforehand, and we won't be doing any inserts/deletions after we
have created it, before we deallocate and recreate it.

Could you post your greatly modified version too? Even if it doesn't work
- it would just be nice to see where you are taking it.

  - Per

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