Re: (PR#9610) AI movemap

"Vasco Alexandre da Silva Costa" <[email protected]> Tue, 21 Dec 2004 14:47:01 -0800
Newsgroups gmane.games.freeciv.ai
Message-ID <[email protected]>
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=9610 >

On Tue, 21 Dec 2004, Benedict Adamson wrote:

>
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=9610 >
>
> Per I. Mathisen wrote:
> ...
> > 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
> ...
>
> I don't think we do know how large to make the vector before recording
> things in it. Each vector records the IDs of all the units that that can
> reach a particular tile in one (or two) turns. How can we know that
> before computing the movemap? If specvec provided a push_back function,
> as the std::vector template of C++  does, we could use a specvec.
>
> Or am I missing something?

See the vector_reserve and vector_append functions.

> Note that the genlist are never used directly outside the movemap code
> itself; the provided movemap_iterate_one_turn and
> movemap_iterate_two_turn macros hide it.

---
Vasco Alexandre da Silva Costa @ Instituto Superior Tecnico, Lisboa