Freeciv-3.3
Loading...
Searching...
No Matches
Macros | Functions
citizenshand.c 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 "cityturn.h"
#include "sanitycheck.h"
#include "citizenshand.h"

Go to the source code of this file.

Macros

#define LOG_CITIZENS_DEBUG
 
#define log_citizens   log_debug
 
#define LOG_OR_ASSERT_CITIZENS
 
#define log_citizens_add(_pcity, _delta, _pplayer)
 

Functions

struct playercitizens_unit_nationality (const struct city *pcity, int pop_cost, struct citizens_reduction *pchange)
 
void citizens_reduction_apply (struct city *pcity, const struct citizens_reduction *pchange)
 
void citizens_update (struct city *pcity, struct player *plr)
 
void citizens_print (const struct city *pcity)
 
static bool citizen_convert_check (struct city *pcity)
 
void citizens_convert (struct city *pcity)
 
void citizens_convert_conquest (struct city *pcity)
 

Macro Definition Documentation

◆ log_citizens

#define log_citizens   log_debug

Definition at line 39 of file citizenshand.c.

◆ log_citizens_add

#define log_citizens_add (   _pcity,
  _delta,
  _pplayer 
)
Value:
log_citizens("%s (size %d; %s): %+d citizen(s) for %s (now: %d)", \
citizens citizens_nation_get(const struct city *pcity, const struct player_slot *pslot)
Definition citizens.c:74
#define log_citizens
const char * city_name_get(const struct city *pcity)
Definition city.c:1137
static citizens city_size_get(const struct city *pcity)
Definition city.h:566
#define city_owner(_pcity_)
Definition city.h:560
char * incite_cost
Definition comments.c:76
const char * player_name(const struct player *pplayer)
Definition player.c:895

Definition at line 161 of file citizenshand.c.

◆ LOG_CITIZENS_DEBUG

#define LOG_CITIZENS_DEBUG

Definition at line 36 of file citizenshand.c.

◆ LOG_OR_ASSERT_CITIZENS

#define LOG_OR_ASSERT_CITIZENS

Definition at line 49 of file citizenshand.c.

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 328 of file citizenshand.c.

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 340 of file citizenshand.c.

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 386 of file citizenshand.c.

Referenced by transfer_city().

◆ citizens_print()

void citizens_print ( const struct city pcity)

Print the data about the citizens.

Definition at line 299 of file citizenshand.c.

Referenced by citizens_update().

◆ citizens_reduction_apply()

void citizens_reduction_apply ( struct city pcity,
const struct citizens_reduction pchange 
)

Applies citizens reduction that may be planned previously in citizens_unit_nationality(). Does not check or change city size. If the nationality has less citizens that are to be removed, just removes as many as possible.

Definition at line 173 of file citizenshand.c.

Referenced by city_build_unit().

◆ citizens_unit_nationality()

struct player * citizens_unit_nationality ( const struct city pcity,
int  pop_cost,
struct citizens_reduction pchange 
)

Get the nationality of a unit built by the city and optionally the numbers of citizens to go into the unit from different nationalities. pcity must be a real city. The algorithm is the same as in citizens_update().

Definition at line 59 of file citizenshand.c.

Referenced by city_create_unit().

◆ citizens_update()

void citizens_update ( struct city pcity,
struct player plr 
)

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 202 of file citizenshand.c.

Referenced by city_add_unit(), city_reduce_size(), city_refresh_after_city_size_increase(), create_city(), sg_load_player_city_citizens(), and sg_load_player_city_citizens().