[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]
Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> writes:
> It is. I would like a discussion what is preferred: id or pointer. If
> one type is selected we can start our crusade.
With get_player, I think we need both and both inlined.
get_player is there to make things more understandable. Maybe we
should make some extra checks.
------------------------------------------------------------------------
struct player *get_player(int player_id)
{
assert(player_id >= 0 && player_id < game.max_players);
return &game.players[player_id];
}
int get_player_by_id(struct player *pplayer)
{
assert(pplayer->player_no >= 0 && pplayer->player_no < game.max_players);
return pplayer->player_no;
}
------------------------------------------------------------------------
Or something like that. Well, not so good example. But as simple
functions as these are, you might get smaller code size and game
is definitely faster when you get rid of actual function call.
--
//Markus
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, (continued)
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Justin Moore, 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, Justin Moore, 2001/08/21
- [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, Justin Moore, 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, Trent Piepho, 2001/08/22
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Justin Moore, 2001/08/23
- Message not available
- [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand, Ross W. Wetmore, 2001/08/21
- [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,
Markus Linnala <=
- [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, 2001/08/21
- [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
|
|