26 #define log_citizens log_debug
33 #define log_citizens_add(_pcity, _delta, _pplayer) \
34 log_citizens("%s (size %d; %s): %+d citizen(s) for %s (now: %d)", \
35 city_name_get(_pcity), city_size_get(_pcity), \
36 player_name(city_owner(_pcity)), _delta, \
37 player_name(_pplayer), \
38 citizens_nation_get(_pcity, _pplayer->slot));
50 if (!
game.
info.citizen_nationality) {
83 city_nations[count] = pslot;
89 while (count > 0 && delta < 0) {
98 if (nationality == 1) {
103 if (selected != count) {
104 city_nations[selected] = city_nations[count - 1];
112 int diff =
MAX(delta, -nationality / 2);
129 if (pcity->
server.debug) {
134 #undef log_citizens_add
143 if (!
game.
info.citizen_nationality) {
184 if (!
game.
info.citizen_nationality) {
200 if (nationality != 0) {
201 city_nations[count++] = foreign_slot;
207 pslot = city_nations[
fc_rand(count)];
212 log_citizens(
"%s (size %d; %s): convert 1 citizen from %s",
226 ||
game.
info.conquest_convert_pct == 0) {
241 log_citizens(
"%s (size %d; %s): convert %d citizen from %s (conquered)",
void citizens_nation_move(struct city *pcity, const struct player_slot *pslot_from, const struct player_slot *pslot_to, int move)
Convert a (positive or negative) value to the citizens from one nation to another.
void citizens_nation_add(struct city *pcity, const struct player_slot *pslot, int add)
Add a (positive or negative) value to the citizens of the given nationality.
citizens citizens_nation_get(const struct city *pcity, const struct player_slot *pslot)
Get the number of citizens with the given nationality.
void citizens_nation_set(struct city *pcity, const struct player_slot *pslot, citizens count)
Set the number of citizens with the given nationality.
citizens citizens_nation_foreign(const struct city *pcity)
Get the number of foreign citizens.
citizens citizens_count(const struct city *pcity)
Return the number of citizens in a city.
#define citizens_foreign_iterate_end
#define citizens_foreign_iterate(_pcity, _pslot, _nationality)
#define citizens_iterate_end
#define citizens_iterate(_pcity, _pslot, _nationality)
void citizens_convert_conquest(struct city *pcity)
Convert citizens to the nationality of the one conquering the city.
void citizens_convert(struct city *pcity)
Convert one (random) foreign citizen to the nationality of the owner.
#define log_citizens_add(_pcity, _delta, _pplayer)
Update the nationality according to the city size.
static bool citizen_convert_check(struct city *pcity)
Return whether citizen should be converted this turn.
void citizens_update(struct city *pcity, struct player *plr)
void citizens_print(const struct city *pcity)
Print the data about the citizens.
struct player * city_owner(const struct city *pcity)
Return the owner of the city.
const char * city_name_get(const struct city *pcity)
Return the name of the city.
citizens city_size_get(const struct city *pcity)
Get the city size.
#define MAX_NUM_PLAYER_SLOTS
#define fc_assert_ret(condition)
struct player * player_slot_get_player(const struct player_slot *pslot)
Returns the team corresponding to the slot.
const char * player_name(const struct player *pplayer)
Return the leader name of the player.
struct city::@15::@17 server
struct packet_game_info info
struct player_slot * slot