Re: (PR#9610) AI movemap

"Per I. Mathisen" <per-0/[email protected]> Sun, 19 Dec 2004 15:59:41 -0800
Newsgroups gmane.games.freeciv.ai
Message-ID <[email protected]>
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=9610 >

On Sun, 19 Dec 2004, Benedict Adamson wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=9610 >
> 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