Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2000:
[Freeciv-Dev] Re: somebody fix struct *player! (was: FoW remove player b
Home

[Freeciv-Dev] Re: somebody fix struct *player! (was: FoW remove player b

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx (Freeciv developers)
Subject: [Freeciv-Dev] Re: somebody fix struct *player! (was: FoW remove player bug)
From: Reinier Post <rp@xxxxxxxxxx>
Date: Wed, 17 May 2000 13:47:57 +0200

> OTOH, it's not clear to me why you need to re-order the players ever
> --- if a player is removed, and that leaves a 'hole' in the player
> array indexes, does that matter?

The Freeciv code does not yet attempt to hide the game struct.
Iterations over players are always written out, like this:

  for (plrnum=0; plrnum<game.nplayers; ++plrnum) {
    struct player *pplayer = &game.player[plrnum];
    [...]
  }

Standard access operators can be written in game.h, to iterate over
game.players, and to add/remove elements.  A C++ version would have
had this abstraction from the start, but in C we can make do with macros.

-- 
Reinier



[Prev in Thread] Current Thread [Next in Thread]