Freeciv21
Develop your civilization from humble roots to a global empire
citizenshand.cpp File Reference
#include "log.h"
#include "rand.h"
#include "citizens.h"
#include "city.h"
#include "fc_types.h"
#include "game.h"
#include "player.h"
#include "citizenshand.h"
+ Include dependency graph for citizenshand.cpp:

Go to the source code of this file.

Macros

#define log_citizens   log_debug
 
#define log_citizens_add(_pcity, _delta, _pplayer)
 Update the nationality according to the city size. More...
 

Functions

void citizens_update (struct city *pcity, struct player *plr)
 
void citizens_print (const struct city *pcity)
 Print the data about the citizens. More...
 
static bool citizen_convert_check (struct city *pcity)
 Return whether citizen should be converted this turn. More...
 
void citizens_convert (struct city *pcity)
 Convert one (random) foreign citizen to the nationality of the owner. More...
 
void citizens_convert_conquest (struct city *pcity)
 Convert citizens to the nationality of the one conquering the city. More...
 

Macro Definition Documentation

◆ log_citizens

#define log_citizens   log_debug

Definition at line 26 of file citizenshand.cpp.

◆ log_citizens_add

#define log_citizens_add (   _pcity,
  _delta,
  _pplayer 
)
Value:
log_citizens("%s (size %d; %s): %+d citizen(s) for %s (now: %d)", \
city_name_get(_pcity), city_size_get(_pcity), \
player_name(city_owner(_pcity)), _delta, \
player_name(_pplayer), \
citizens_nation_get(_pcity, _pplayer->slot));
citizens citizens_nation_get(const struct city *pcity, const struct player_slot *pslot)
Get the number of citizens with the given nationality.
Definition: citizens.cpp:65
#define log_citizens
struct player * city_owner(const struct city *pcity)
Return the owner of the city.
Definition: city.cpp:1083
const char * city_name_get(const struct city *pcity)
Return the name of the city.
Definition: city.cpp:1077
citizens city_size_get(const struct city *pcity)
Get the city size.
Definition: city.cpp:1101
const char * player_name(const struct player *pplayer)
Return the leader name of the player.
Definition: player.cpp:816

Update the nationality according to the city size.

New citiens are added using the nationality of the owner. If the city size is reduced, the citizens are removed first from the foreign citizens.

Definition at line 33 of file citizenshand.cpp.

Function Documentation

◆ citizen_convert_check()

static bool citizen_convert_check ( struct city pcity)
static

Return whether citizen should be converted this turn.

Definition at line 168 of file citizenshand.cpp.

Referenced by citizens_convert().

◆ citizens_convert()

void citizens_convert ( struct city pcity)

Convert one (random) foreign citizen to the nationality of the owner.

Definition at line 176 of file citizenshand.cpp.

Referenced by update_city_activities().

◆ citizens_convert_conquest()

void citizens_convert_conquest ( struct city pcity)

Convert citizens to the nationality of the one conquering the city.

Definition at line 221 of file citizenshand.cpp.

Referenced by transfer_city().

◆ citizens_print()

void citizens_print ( const struct city pcity)

Print the data about the citizens.

Definition at line 139 of file citizenshand.cpp.

Referenced by citizens_update().

◆ citizens_update()

void citizens_update ( struct city pcity,
struct player plr 
)