39#define PLAYER_DEFAULT_TAX_RATE 0
40#define PLAYER_DEFAULT_SCIENCE_RATE 100
41#define PLAYER_DEFAULT_LUXURY_RATE 0
43#define ANON_PLAYER_NAME "noname"
48#define ANON_USER_NAME N_("Unassigned")
50#define OWNER_NONE (-1)
70#define SPECENUM_NAME player_status
72#define SPECENUM_VALUE0 PSTATUS_NORMAL
74#define SPECENUM_VALUE1 PSTATUS_DYING
76#define SPECENUM_VALUE2 PSTATUS_WINNER
78#define SPECENUM_VALUE3 PSTATUS_SURRENDER
80#define SPECENUM_COUNT PSTATUS_COUNT
136#define SPECENUM_NAME diplstate_type
137#define SPECENUM_VALUE0 DS_ARMISTICE
138#define SPECENUM_VALUE0NAME N_("?diplomatic_state:Armistice")
139#define SPECENUM_VALUE1 DS_WAR
140#define SPECENUM_VALUE1NAME N_("?diplomatic_state:War")
141#define SPECENUM_VALUE2 DS_CEASEFIRE
142#define SPECENUM_VALUE2NAME N_("?diplomatic_state:Cease-fire")
143#define SPECENUM_VALUE3 DS_PEACE
144#define SPECENUM_VALUE3NAME N_("?diplomatic_state:Peace")
145#define SPECENUM_VALUE4 DS_ALLIANCE
146#define SPECENUM_VALUE4NAME N_("?diplomatic_state:Alliance")
147#define SPECENUM_VALUE5 DS_NO_CONTACT
148#define SPECENUM_VALUE5NAME N_("?diplomatic_state:Never met")
149#define SPECENUM_VALUE6 DS_TEAM
150#define SPECENUM_VALUE6NAME N_("?diplomatic_state:Team")
153#define SPECENUM_COUNT DS_LAST
162#define SPECENUM_NAME diplrel_other
163#define SPECENUM_VALUE7 DRO_GIVES_SHARED_VISION
164#define SPECENUM_VALUE7NAME N_("Gives shared vision")
165#define SPECENUM_VALUE8 DRO_RECEIVES_SHARED_VISION
166#define SPECENUM_VALUE8NAME N_("Receives shared vision")
167#define SPECENUM_VALUE9 DRO_HOSTS_EMBASSY
168#define SPECENUM_VALUE9NAME N_("Hosts embassy")
169#define SPECENUM_VALUE10 DRO_HAS_EMBASSY
170#define SPECENUM_VALUE10NAME N_("Has embassy")
171#define SPECENUM_VALUE11 DRO_HOSTS_REAL_EMBASSY
172#define SPECENUM_VALUE11NAME N_("Hosts real embassy")
173#define SPECENUM_VALUE12 DRO_HAS_REAL_EMBASSY
174#define SPECENUM_VALUE12NAME N_("Has real embassy")
175#define SPECENUM_VALUE13 DRO_HAS_CASUS_BELLI
176#define SPECENUM_VALUE13NAME N_("Has Casus Belli")
177#define SPECENUM_VALUE14 DRO_PROVIDED_CASUS_BELLI
178#define SPECENUM_VALUE14NAME N_("Provided Casus Belli")
179#define SPECENUM_VALUE15 DRO_FOREIGN
180#define SPECENUM_VALUE15NAME N_("Foreign")
181#define SPECENUM_VALUE16 DRO_HAS_TEAM_EMBASSY
182#define SPECENUM_VALUE16NAME N_("Has team embassy")
183#define SPECENUM_VALUE17 DRO_HOSTS_TEAM_EMBASSY
184#define SPECENUM_VALUE17NAME N_("Hosts team embassy")
185#define SPECENUM_COUNT DRO_LAST
223#define MAX_ATTRIBUTE_BLOCK (256*1024)
231#define is_human(plr) !player_has_flag((plr), PLRF_AI)
232#define is_ai(plr) player_has_flag((plr), PLRF_AI)
233#define set_as_human(plr) BV_CLR((plr)->flags, PLRF_AI)
234#define set_as_ai(plr) BV_SET((plr)->flags, PLRF_AI)
408#define player_nation(_plr_) (_plr_)->nation
421 const struct tile *ptile);
423 const struct tile *ptile);
428 const struct tile *ptile,
431 const struct tile *ptile);
443 const struct tile *ptile);
451 const struct tile *ptile);
465 const struct player *plr2);
511 const enum effect_type
outcome,
528#define player_slots_iterate(_pslot) \
529 if (player_slots_initialised()) { \
530 struct player_slot *_pslot = player_slot_first(); \
531 for (; NULL != _pslot; _pslot = player_slot_next(_pslot)) {
532#define player_slots_iterate_end \
537#define players_iterate(_pplayer) \
538 player_slots_iterate(_pslot##_pplayer) { \
539 struct player *_pplayer = player_slot_get_player(_pslot##_pplayer); \
540 if (_pplayer != NULL) {
542#define players_iterate_end \
544 } player_slots_iterate_end;
547#define players_iterate_alive(_pplayer) \
548 players_iterate(_pplayer) { \
549 if (!_pplayer->is_alive) { \
552#define players_iterate_alive_end \
553 } players_iterate_end;
556#define SPECLIST_TAG player
557#define SPECLIST_TYPE struct player
560#define player_list_iterate(playerlist, pplayer) \
561 TYPED_LIST_ITERATE(struct player, playerlist, pplayer)
562#define player_list_iterate_end \
566#define MAX_AI_LOVE 1000
572#define ai_level_cmd(_level_) ai_level_name(_level_)
#define BV_DEFINE(name, bits)
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 * punit
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
struct unit struct city * target_city
#define MAX_NUM_PLAYER_SLOTS
#define MAX_NUM_MULTIPLIERS
bool is_settable_ai_level(enum ai_level level)
bool are_diplstates_equal(const struct player_diplstate *pds1, const struct player_diplstate *pds2)
bool player_can_invade_tile(const struct player *pplayer, const struct tile *ptile)
bool player_knows_techs_with_flag(const struct player *pplayer, enum tech_flag_id flag)
int player_multiplier_effect_value(const struct player *pplayer, const struct multiplier *pmul)
void * player_ai_data(const struct player *pplayer, const struct ai_type *ai)
bool player_has_state(const struct player *pplayer, enum plrstate_type state)
@ DIPL_ALLIANCE_PROBLEM_THEM
@ DIPL_ALLIANCE_PROBLEM_US
bool player_slot_is_used(const struct player_slot *pslot)
bv_diplrel_all_reqs diplrel_req_contradicts(const struct requirement *req)
int num_known_tech_with_flag(const struct player *pplayer, enum tech_flag_id flag)
bool is_valid_username(const char *name)
int player_multiplier_target_value(const struct player *pplayer, const struct multiplier *pmul)
bool can_player_see_tile(const struct player *plr, const struct tile *ptile)
struct unit * player_unit_by_number(const struct player *pplayer, int unit_id)
struct player * player_by_name_prefix(const char *name, enum m_pre_result *result)
int diplrel_by_rule_name(const char *value)
struct player * player_new(struct player_slot *pslot)
struct player * player_by_number(const int player_id)
bool player_in_city_map(const struct player *pplayer, const struct tile *ptile)
bool players_on_same_team(const struct player *pplayer1, const struct player *pplayer2)
bool can_player_see_unit_at(const struct player *pplayer, const struct unit *punit, const struct tile *ptile, bool is_transported)
enum diplstate_type cancel_pact_result(enum diplstate_type oldstate)
int player_slot_count(void)
struct player_slot * player_slot_by_number(int player_id)
int player_multiplier_value(const struct player *pplayer, const struct multiplier *pmul)
int player_get_expected_income(const struct player *pplayer)
int player_number(const struct player *pplayer)
enum dipl_reason pplayer_can_make_treaty(const struct player *p1, const struct player *p2, enum diplstate_type treaty)
const char * player_name(const struct player *pplayer)
void player_slots_free(void)
bool is_diplrel_to_other(const struct player *pplayer, int diplrel)
static bool is_barbarian(const struct player *pplayer)
int player_slot_max_used_number(void)
bool can_player_see_unit(const struct player *pplayer, const struct unit *punit)
bool pplayers_at_war(const struct player *pplayer, const struct player *pplayer2)
void player_set_ai_data(struct player *pplayer, const struct ai_type *ai, void *data)
void player_ruleset_close(struct player *pplayer)
void player_clear(struct player *pplayer, bool full)
int player_slot_index(const struct player_slot *pslot)
struct player * player_by_name(const char *name)
void player_slots_init(void)
bool player_has_flag(const struct player *pplayer, enum plr_flag_id flag)
bool player_has_real_embassy(const struct player *pplayer, const struct player *pplayer2)
bool team_has_embassy(const struct team *pteam, const struct player *tgt_player)
void player_set_color(struct player *pplayer, const struct rgbcolor *prgbcolor)
struct city * player_city_by_number(const struct player *pplayer, int city_id)
struct city * player_primary_capital(const struct player *pplayer)
int player_index(const struct player *pplayer)
int player_in_territory(const struct player *pplayer, const struct player *pplayer2)
struct player * player_by_user(const char *name)
const char * diplrel_name_translation(int value)
bool is_diplrel_between(const struct player *player1, const struct player *player2, int diplrel)
static bool player_is_cpuhog(const struct player *pplayer)
bool player_set_nation(struct player *pplayer, struct nation_type *pnation)
bool player_can_see_city_externals(const struct player *pow_player, const struct city *target_city)
int player_age(const struct player *pplayer)
enum dipl_reason pplayer_can_cancel_treaty(const struct player *p1, const struct player *p2)
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
int number_of_ai_levels(void)
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
bool can_player_see_hypotetic_units_at(const struct player *pplayer, const struct tile *ptile)
bool player_has_embassy_from_effect(const struct player *pplayer, const struct player *pplayer2)
void diplrel_mess_close(void)
bool players_non_invade(const struct player *pplayer1, const struct player *pplayer2)
bool player_can_do_action_result(struct player *pplayer, enum action_result result)
bool pplayers_non_attack(const struct player *pplayer, const struct player *pplayer2)
bool can_player_see_units_in_city(const struct player *pplayer, const struct city *pcity)
struct player * player_slot_get_player(const struct player_slot *pslot)
bool can_player_see_city_internals(const struct player *pplayer, const struct city *pcity)
struct player_slot * player_slot_next(struct player_slot *pslot)
bool player_can_trust_tile_has_no_units(const struct player *pplayer, const struct tile *ptile)
bool player_slots_initialised(void)
const char * love_text(const int love)
bool gives_shared_tiles(const struct player *me, const struct player *them)
bool player_has_embassy(const struct player *pplayer, const struct player *pplayer2)
enum casus_belli_range casus_belli_range_for(const struct player *offender, const struct unit_type *off_ut, const struct player *tgt_plr, const enum effect_type outcome, const struct action *paction, const struct tile *tgt_tile)
const char * diplrel_rule_name(int value)
bool gives_shared_vision(const struct player *me, const struct player *them)
bool player_owns_city(const struct player *pplayer, const struct city *pcity)
struct player_slot * player_slot_first(void)
void player_destroy(struct player *pplayer)
bool pplayers_in_peace(const struct player *pplayer, const struct player *pplayer2)
struct setting_list * level[OLEVELS_NUM]
enum ai_level skill_level
enum barbarian_type barbarian_type
int love[MAX_NUM_PLAYER_SLOTS]
enum diplstate_type max_state
char has_reason_to_cancel
struct city_list * cities
struct player_ai ai_common
const struct player_diplstate ** diplstates
struct government * target_government
char username[MAX_LEN_NAME]
struct government * government
struct connection * current_conn
char * savegame_ai_type_name
const struct ai_type * ai
char ranked_username[MAX_LEN_NAME]
struct conn_list * connections
struct player_economic economic
struct player_spaceship spaceship
struct attribute_block_s attribute_block
bv_player gives_shared_vision
struct player_score score
struct attribute_block_s attribute_block_buffer
struct player_tile * private_map
struct multiplier_value multipliers[MAX_NUM_MULTIPLIERS]
bv_player really_gives_vision
struct nation_type * nation
struct nation_style * style
struct player_slot * slot
bv_player gives_shared_tiles