Freeciv-3.3
Loading...
Searching...
No Matches
citizens.h
Go to the documentation of this file.
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)
6 any later version.
7
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
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/* utility */
21#include "shared.h" /* bool */
22
23/* common */
24#include "fc_types.h"
25
26struct player_slot;
27struct city;
28
29void citizens_init(struct city *pcity);
30void citizens_free(struct city *pcity);
31
33 const struct player_slot *pslot);
35void citizens_nation_set(struct city *pcity, const struct player_slot *pslot,
36 citizens count);
37void citizens_nation_add(struct city *pcity, const struct player_slot *pslot,
38 int add);
40 const struct player_slot *pslot_from,
41 const struct player_slot *pslot_to,
42 int move);
43
44citizens citizens_count(const struct city *pcity);
45struct player_slot *citizens_random(const struct city *pcity);
46
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) { \
52 continue; \
53 }
54#define citizens_iterate_end \
55 } player_slots_iterate_end;
56
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) { \
61 continue; \
62 }
63#define citizens_foreign_iterate_end \
64 } citizens_iterate_end;
65
66#ifdef __cplusplus
67}
68#endif /* __cplusplus */
69
70#endif /* FC__CITIZENS_H */
struct player_slot * citizens_random(const struct city *pcity)
Definition citizens.c:190
void citizens_free(struct city *pcity)
Definition citizens.c:58
void citizens_nation_move(struct city *pcity, const struct player_slot *pslot_from, const struct player_slot *pslot_to, int move)
Definition citizens.c:130
void citizens_nation_add(struct city *pcity, const struct player_slot *pslot, int add)
Definition citizens.c:104
citizens citizens_nation_get(const struct city *pcity, const struct player_slot *pslot)
Definition citizens.c:74
void citizens_nation_set(struct city *pcity, const struct player_slot *pslot, citizens count)
Definition citizens.c:145
citizens citizens_nation_foreign(const struct city *pcity)
Definition citizens.c:91
citizens citizens_count(const struct city *pcity)
Definition citizens.c:162
void citizens_init(struct city *pcity)
Definition citizens.c:32
char * incite_cost
Definition comments.c:76
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:78
unsigned char citizens
Definition fc_types.h:247
Definition city.h:317