1 /*****************************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 *****************************************************************************/
13 #ifndef FC__CITIZENS_H
14 #define FC__CITIZENS_H
18 #endif /* __cplusplus */
21 #include "shared.h" /* bool */
29 void citizens_init(struct city
*pcity
);
30 void citizens_free(struct city
*pcity
);
32 citizens
citizens_nation_get(const struct city
*pcity
,
33 const struct player_slot
*pslot
);
34 citizens
citizens_nation_foreign(const struct city
*pcity
);
35 void citizens_nation_set(struct city
*pcity
, const struct player_slot
*pslot
,
37 void citizens_nation_add(struct city
*pcity
, const struct player_slot
*pslot
,
39 void citizens_nation_move(struct city
*pcity
,
40 const struct player_slot
*pslot_from
,
41 const struct player_slot
*pslot_to
,
44 citizens
citizens_count(const struct city
*pcity
);
45 struct player_slot
*citizens_random(const struct city
*pcity
);
47 /* Iterates over all player slots (nationalities) with citizens. */
48 #define citizens_iterate(_pcity, _pslot, _nationality) \
49 player_slots_iterate(_pslot) { \
50 citizens _nationality = citizens_nation_get(_pcity, _pslot); \
51 if (_nationality == 0) { \
54 #define citizens_iterate_end \
55 } player_slots_iterate_end;
57 /* Like above but only foreign citizens. */
58 #define citizens_foreign_iterate(_pcity, _pslot, _nationality) \
59 citizens_iterate(_pcity, _pslot, _nationality) { \
60 if (_pslot == city_owner(_pcity)->slot) { \
63 #define citizens_foreign_iterate_end \
64 } citizens_iterate_end;
68 #endif /* __cplusplus */
70 #endif /* FC__CITIZENS_H */