[freeciv-ai] Re: Goto coordinates and ai roles
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Thu, 23 Jan 2003, Ross W. Wetmore wrote:
> The map_position pointer (to independently allocated storage) is a bit
> of a maintenance headache as Raimar suggests. Go the step further and
> just don't do it that way.
>
> Instead, add the pointer to the punit struct, and point it back at the
> goto_dest_x, goto_dest_y elements which you can convert to an unnamed
> map_position, or a union of the existing elements and a map_position
> if you need to preserve backwards compatibility. There is no need to
> worry about managing memory - ever as that is done when the punit struct
> is created and destroyed, and it is the only one to use this memory.
>
> If the pointer is null the goto_dest locations are not valid, if it is
> non-null it is pointed correctly and can be used to access the values,
> i.e. to set a goto_dest, fill in the values (just like now) and point
> to the &punit->goto_dest_x or however you reference it. To mark it as
> invalid, just null out the pointer.
This is a rather imaginative approach, which invokes some rather rude
associations in my dirty mind.
If I understand it correctly, this pointer will have only two possible
values: pointing to the unit itself, or just NULL. I think there is a
special name for a variable which takes only two values (and it doesn't
invoke any rude associations in my mind, yet). Why not use it?
Best wishes,
G.
- [freeciv-ai] Re: Goto coordinates and ai roles, Ross W. Wetmore, 2003/01/18
- [freeciv-ai] Re: Goto coordinates and ai roles, Mike Kaufman, 2003/01/18
- [freeciv-ai] Re: Goto coordinates and ai roles, Per I. Mathisen, 2003/01/20
- Message not available
- [freeciv-ai] Re: Goto coordinates and ai roles, Raimar Falke, 2003/01/21
- [freeciv-ai] Re: Goto coordinates and ai roles, Ross W. Wetmore, 2003/01/23
- [freeciv-ai] Re: Goto coordinates and ai roles, Raimar Falke, 2003/01/24
- [freeciv-ai] Re: Goto coordinates and ai roles,
Gregory Berkolaiko <=
- [freeciv-ai] Re: Goto coordinates and ai roles, Ross Wetmore, 2003/01/27
- [freeciv-ai] Re: Goto coordinates and ai roles, Gregory Berkolaiko, 2003/01/28
- [freeciv-ai] Re: Goto coordinates and ai roles, Per I. Mathisen, 2003/01/28
- [freeciv-ai] Re: Goto coordinates and ai roles, Raimar Falke, 2003/01/29
- [freeciv-ai] Re: Goto coordinates and ai roles, Gregory Berkolaiko, 2003/01/29
|
|