<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39743 >

1-Static or dynamics datas?

The most of the main structures (player, connection, advance, ...)
except city and unit are declared static (for example
game.players[MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS];). Is this a
deliberate choice? Maybe it could be a player_list, then there shouldn't
have maximum of players. I understand that it was certainly to find
player by id faster, but it seems that the unit/city->owner is now a
pointer.

2-struct unit

I see numerous ids in this structures. Shouldn't they be replaced by
pointers?
homecity could be a (struct city *)
transported_by could be a (struct unit *)
It could be a struct unit_list *transported_units, to find faster and
clearer what units are transported. Then occupancy member would be
replaced by unit_list_size().

3-struct city

I don't like:
int trade[NUM_TRADEROUTES], trade_value[NUM_TRADEROUTES];
Shouldn't this replaced by a (struct trade_route_list *) where struct
trade_route would be like:
struct trade_route {
  struct city *city1, *city2;
  int value;
};
Then it could be a setting to define the maximum of trade routes you
could get in one city. More, it could allow to improve AI with defining
a list of trade route to establish, and allow users to plan trade
routes, with adding a status member like:
enum trade_route_status {
  TRADE_ROUTE_PLANNED,
  TRADE_ROUTE_IN_ROUTE,
  TRADE_ROUTE_IN_ROUTE_AND_PLANNED,
  TRADE_ROUTE_ESTABLISHED
};

Comments welcome.

_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to