[Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Tue, 21 Aug 2001, Raimar Falke wrote:
> There are further optimizations possible:
> - what about passing struct tile * instead of (int x, int y)?
> - what about using pointers instead of ids in structs?
Those are probably good ideas. One thing you have to watch out for is
dangling pointers. When a unit is deleted, you're not allowed to have any
pointers to it anymore. The main purpose of the function game_remove_unit()
is to find all these pointers in the various lists and remove them.
If you stick pointers in other places, you need to be assured that you can
remove them when the unit/city goes away. In some cases, like the GUI code,
this is very hard to do. So you don't do it, and use an ID instead.
It does seem like the owner and homecity fields in the unit struct could be
changed to pointers.
BTW, game_remove_unit takes an ID as an argument! Seems like this should be a
pointer. I think that's because it used to be a higher level function that
got called from the network code.
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, (continued)
[Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Markus Linnala, 2001/08/20
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Raimar Falke, 2001/08/20
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Trent Piepho, 2001/08/20
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Raimar Falke, 2001/08/21
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Trent Piepho, 2001/08/21
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Raimar Falke, 2001/08/21
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Trent Piepho, 2001/08/21
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Raimar Falke, 2001/08/21
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand,
Trent Piepho <=
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Kevin Brown, 2001/08/22
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Erik Sigra, 2001/08/22
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Raimar Falke, 2001/08/22
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Gaute B Strokkenes, 2001/08/24
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Raimar Falke, 2001/08/24
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Vasco Alexandre Da Silva Costa, 2001/08/24
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Alan Schmitt, 2001/08/25
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Falk Hueffner, 2001/08/25
[Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Vasco Alexandre Da Silva Costa, 2001/08/24
[Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Trent Piepho, 2001/08/20
|
|