Freeciv-3.3
Loading...
Searching...
No Matches
player.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__PLAYER_H
14#define FC__PLAYER_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/* utility */
21#include "bitvector.h"
22
23/* common */
24#include "connection.h"
25#include "effects.h"
26#include "fc_types.h"
27#include "multipliers.h"
28#include "shared.h"
29#include "spaceship.h"
30#include "style.h"
31#include "tech.h"
32#include "unitlist.h"
33#include "vision.h"
34
35struct ai_trait;
36struct city;
37struct nation_type;
38
39#define PLAYER_DEFAULT_TAX_RATE 0
40#define PLAYER_DEFAULT_SCIENCE_RATE 100
41#define PLAYER_DEFAULT_LUXURY_RATE 0
42
43#define ANON_PLAYER_NAME "noname"
44
45/* If changing this, be sure to adjust loading of pre-2.6 savegames
46 * which depend on saved username to tell if user (or ranked_user) is
47 * anonymous. */
48#define ANON_USER_NAME N_("Unassigned")
49
50#define OWNER_NONE (-1)
51
59
60struct player_slot;
61
63 int gold;
64 int tax;
66 int luxury;
68};
69
70#define SPECENUM_NAME player_status
71/* 'normal' status */
72#define SPECENUM_VALUE0 PSTATUS_NORMAL
73/* set once the player is in the process of dying */
74#define SPECENUM_VALUE1 PSTATUS_DYING
75/* this player is winner in scenario game */
76#define SPECENUM_VALUE2 PSTATUS_WINNER
77/* has indicated willingness to surrender */
78#define SPECENUM_VALUE3 PSTATUS_SURRENDER
79/* keep this last */
80#define SPECENUM_COUNT PSTATUS_COUNT
81#include "specenum_gen.h"
82
84
86 int happy;
89 int angry;
92 int techs;
96 int population; /* in thousand of citizen */
97 int cities;
98 int units;
101 int bnp;
102 int mfg;
104 int units_built; /* Number of units this player produced. */
105 int units_killed; /* Number of enemy units killed. */
106 int units_lost; /* Number of own units that died,
107 * by combat or otherwise. */
108 int units_used; /* Number of own units that disappeared upon use */
110 int game; /* Total score you get in player dialog. */
111};
112
113struct player_ai {
116 enum ai_level skill_level; /* 0-10 value for save/load/display */
117 int fuzzy; /* chance in 1000 to mis-decide */
118 int expand; /* percentage factor to value new cities */
119 int science_cost; /* Cost in bulbs to get new tech, relative
120 to non-AI players (100: Equal cost) */
121 int warmth, frost; /* threat of global warming / nuclear winter */
123
125
127};
128
129/* Diplomatic states (how one player views another).
130 * (Some diplomatic states are "pacts" (mutual agreements), others aren't.)
131 *
132 * Adding to or reordering this array will break many things.
133 *
134 * Used in the network protocol.
135 */
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")
151 /* When adding or removing entries, note that first value
152 * of diplrel_other should be next to last diplstate_type */
153#define SPECENUM_COUNT DS_LAST /* leave this last */
154#include "specenum_gen.h"
155
156/* Other diplomatic relation properties.
157 *
158 * The first element here is numbered DS_LAST
159 *
160 * Used in the network protocol.
161 */
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
186#include "specenum_gen.h"
187
189 /* Reserve a location for each possible DiplRel requirement. */
190 ((DRO_LAST - 1) * 2) * REQ_RANGE_COUNT);
191
196
197/* The following are for "pacts" */
199 enum diplstate_type type; /* This player's disposition towards other */
200 enum diplstate_type max_state; /* Maximum treaty level ever had */
201 int first_contact_turn; /* Turn we had first contact with this player */
202 char turns_left; /* Until pact (e.g., cease-fire) ends */
203 char has_reason_to_cancel; /* 0: no, 1: this turn, 2: this or next turn */
204 char contact_turns_left; /* Until contact ends */
205
206 int auto_cancel_turn; /* Used to avoid asymmetric turns_left */
207};
208
209/***************************************************************************
210 On the distinction between nations(formerly races), players, and users,
211 see doc/HACKING
212***************************************************************************/
213
217
219
221 void *data;
223#define MAX_ATTRIBUTE_BLOCK (256*1024) /* largest attribute block */
224};
225
226struct ai_type;
227struct ai_data;
228
229bool player_has_flag(const struct player *pplayer, enum plr_flag_id flag);
230
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)
235
236bool player_has_state(const struct player *pplayer, enum plrstate_type state);
237
239{
240 /* Value currently in force. */
241 int value;
242 /* Value to be used next turn. */
244 /* Turn that value was last changed. */
246};
247
248struct player
249{
254 char ranked_username[MAX_LEN_NAME]; /* the user who will be ranked */
256 int user_turns; /* number of turns this user has played */
258 struct government *government; /* may be NULL in pregame */
259 struct government *target_government; /* may be NULL */
261 struct team *team;
262 bool is_ready; /* Did the player click "start" yet? */
263 bool phase_done; /* Has human player finished */
264 bool ai_phase_done; /* Has AI type finished */
266 int turns_alive; /* Number of turns this player has spent alive;
267 * 0 when created, increment at the end of each turn */
271
272 /* Turn in which the player's revolution is over; see update_revolution. */
274
276
281 struct city_list *cities;
282 struct unit_list *units;
285
287
289 const struct ai_type *ai;
291
293
294 bool was_created; /* if the player was /created */
297 struct connection *current_conn; /* non-null while handling packet */
298 struct conn_list *connections; /* will replace conn */
299 int autoselect_weight; /* How likely scenario player is to get picked
300 * for an user to use. */
301
302 bv_player gives_shared_vision; /* bitvector those that give you
303 * shared vision */
305 int wonders[B_LAST]; /* contains city id's, WONDER_NOT_BUILT,
306 * or WONDER_LOST */
309
311
312 struct rgbcolor *rgb;
313
315
316 int history; /* National level culture - does not include culture of individual
317 * cities. */
318
319 union {
320 struct {
321 /* Only used in the server (./ai/ and ./server/). */
323
325
326 /* Player can see inside their borders. */
328
329 bv_player really_gives_vision; /* takes into account that p3 may see
330 * what p1 has via p2 */
331
333
334 struct adv_data *adv;
335
337
338 /* This user is allowed to take over the player. */
339 char delegate_to[MAX_LEN_NAME];
340 /* This is set when a player is 'involved' in a delegation.
341 * There are two cases:
342 * - if delegate_to[] is set, it records the original owner, with
343 * 'username' temporarily holding the delegate's name;
344 * - otherwise, it's set when a delegate's original player is 'put
345 * aside' while the delegate user controls a delegated player.
346 * (In this case orig_username == username.) */
347 char orig_username[MAX_LEN_NAME];
348
349 int huts; /* How many huts this player has found */
350
351 int bulbs_last_turn; /* Number of bulbs researched last turn only. */
353
354 struct {
355 /* Only used at the client (the server is omniscient; ./client/). */
356
357 /* Corresponds to the result of
358 (player:server:private_map[tile_index]:seen_count[vlayer] != 0). */
359 struct dbv tile_vision[V_COUNT];
360
362
364
366
369 };
370};
371
372/* Initialization and iteration */
373void player_slots_init(void);
374bool player_slots_initialised(void);
375void player_slots_free(void);
376
377struct player_slot *player_slot_first(void);
378struct player_slot *player_slot_next(struct player_slot *pslot);
379
380/* A player slot contains a possibly uninitialized player. */
381int player_slot_count(void);
382int player_slot_index(const struct player_slot *pslot);
383struct player *player_slot_get_player(const struct player_slot *pslot);
384bool player_slot_is_used(const struct player_slot *pslot);
385struct player_slot *player_slot_by_number(int player_id);
387
388/* General player accessor functions. */
389struct player *player_new(struct player_slot *pslot);
390void player_set_color(struct player *pplayer,
391 const struct rgbcolor *prgbcolor);
392void player_clear(struct player *pplayer, bool full);
393void player_ruleset_close(struct player *pplayer);
394void player_destroy(struct player *pplayer);
395
396int player_count(void);
397int player_index(const struct player *pplayer);
398int player_number(const struct player *pplayer);
399struct player *player_by_number(const int player_id);
400
401const char *player_name(const struct player *pplayer);
402struct player *player_by_name(const char *name);
403struct player *player_by_name_prefix(const char *name,
404 enum m_pre_result *result);
405struct player *player_by_user(const char *name);
406
407bool player_set_nation(struct player *pplayer, struct nation_type *pnation);
408#define player_nation(_plr_) (_plr_)->nation
409
410bool player_has_embassy(const struct player *pplayer,
411 const struct player *pplayer2);
412bool player_has_real_embassy(const struct player *pplayer,
413 const struct player *pplayer2);
414bool player_has_embassy_from_effect(const struct player *pplayer,
415 const struct player *pplayer2);
416bool team_has_embassy(const struct team *pteam, const struct player *tgt_player);
417
418int player_age(const struct player *pplayer);
419
420bool player_can_trust_tile_has_no_units(const struct player *pplayer,
421 const struct tile *ptile);
422bool can_player_see_hypotetic_units_at(const struct player *pplayer,
423 const struct tile *ptile);
424bool can_player_see_unit(const struct player *pplayer,
425 const struct unit *punit);
426bool can_player_see_unit_at(const struct player *pplayer,
427 const struct unit *punit,
428 const struct tile *ptile,
429 bool is_transported);
430bool can_player_see_tile(const struct player *plr,
431 const struct tile *ptile);
432
433bool can_player_see_units_in_city(const struct player *pplayer,
434 const struct city *pcity);
435bool can_player_see_city_internals(const struct player *pplayer,
436 const struct city *pcity);
438 const struct city *target_city);
439
440bool player_owns_city(const struct player *pplayer,
441 const struct city *pcity);
442bool player_can_invade_tile(const struct player *pplayer,
443 const struct tile *ptile);
444
445struct city *player_city_by_number(const struct player *pplayer,
446 int city_id);
447struct unit *player_unit_by_number(const struct player *pplayer,
448 int unit_id);
449
450bool player_in_city_map(const struct player *pplayer,
451 const struct tile *ptile);
452bool player_knows_techs_with_flag(const struct player *pplayer,
453 enum tech_flag_id flag);
454int num_known_tech_with_flag(const struct player *pplayer,
455 enum tech_flag_id flag);
456int player_get_expected_income(const struct player *pplayer);
457
458struct city *player_primary_capital(const struct player *pplayer);
459
460const char *love_text(const int love);
461
463
464struct player_diplstate *player_diplstate_get(const struct player *plr1,
465 const struct player *plr2);
467 const struct player_diplstate *pds2);
469 const struct player *p2,
472 const struct player *p2);
473bool pplayers_at_war(const struct player *pplayer,
474 const struct player *pplayer2);
475bool pplayers_allied(const struct player *pplayer,
476 const struct player *pplayer2);
477bool pplayers_in_peace(const struct player *pplayer,
478 const struct player *pplayer2);
479bool players_non_invade(const struct player *pplayer1,
480 const struct player *pplayer2);
481bool pplayers_non_attack(const struct player *pplayer,
482 const struct player *pplayer2);
483bool players_on_same_team(const struct player *pplayer1,
484 const struct player *pplayer2);
485int player_in_territory(const struct player *pplayer,
486 const struct player *pplayer2);
487
488/**************************************************************************
489 Return TRUE iff player is any kind of barbarian
490**************************************************************************/
491static inline bool is_barbarian(const struct player *pplayer)
492{
493 return pplayer->ai_common.barbarian_type != NOT_A_BARBARIAN;
494}
495
496bool gives_shared_vision(const struct player *me, const struct player *them);
497bool gives_shared_tiles(const struct player *me, const struct player *them);
498
499void diplrel_mess_close(void);
500bool is_diplrel_between(const struct player *player1,
501 const struct player *player2,
502 int diplrel);
503bool is_diplrel_to_other(const struct player *pplayer, int diplrel);
504int diplrel_by_rule_name(const char *value);
505const char *diplrel_rule_name(int value);
506const char *diplrel_name_translation(int value);
507
509 const struct unit_type *off_ut,
510 const struct player *tgt_plr,
511 const enum effect_type outcome,
512 const struct action *paction,
513 const struct tile *tgt_tile);
514
516
517int player_multiplier_value(const struct player *pplayer,
518 const struct multiplier *pmul);
519int player_multiplier_effect_value(const struct player *pplayer,
520 const struct multiplier *pmul);
521int player_multiplier_target_value(const struct player *pplayer,
522 const struct multiplier *pmul);
523
524bool player_can_do_action_result(struct player *pplayer,
525 enum action_result result);
526
527/* Iterate over all player slots */
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 \
533 } \
534 }
535
536/* iterate over all players, which are used at the moment */
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) {
541
542#define players_iterate_end \
543 } \
544 } player_slots_iterate_end;
545
546/* iterate over all players, which are used at the moment and are alive */
547#define players_iterate_alive(_pplayer) \
548 players_iterate(_pplayer) { \
549 if (!_pplayer->is_alive) { \
550 continue; \
551 }
552#define players_iterate_alive_end \
553 } players_iterate_end;
554
555/* get 'struct player_list' and related functions: */
556#define SPECLIST_TAG player
557#define SPECLIST_TYPE struct player
558#include "speclist.h"
559
560#define player_list_iterate(playerlist, pplayer) \
561 TYPED_LIST_ITERATE(struct player, playerlist, pplayer)
562#define player_list_iterate_end \
563 LIST_ITERATE_END
564
565/* ai love values should be in range [-MAX_AI_LOVE..MAX_AI_LOVE] */
566#define MAX_AI_LOVE 1000
567
568
569/* User functions. */
570bool is_valid_username(const char *name);
571
572#define ai_level_cmd(_level_) ai_level_name(_level_)
573bool is_settable_ai_level(enum ai_level level);
574int number_of_ai_levels(void);
575
576void *player_ai_data(const struct player *pplayer, const struct ai_type *ai);
577void player_set_ai_data(struct player *pplayer, const struct ai_type *ai,
578 void *data);
579
580static inline bool player_is_cpuhog(const struct player *pplayer)
581{
582 /* You have to make code change here to enable cpuhog AI. There is no even
583 * configure option to change this. That's intentional.
584 * Enabling them causes game to proceed differently, and for reproducing
585 * reported bugs we want to know if this has been changed. People are more
586 * likely to report that they have made code changes than remembering some
587 * specific configure option they happened to pass to build this time - or even
588 * knowing what configure options somebody else used when building freeciv for them. */
589 return FALSE;
590}
591
592#ifdef __cplusplus
593}
594#endif /* __cplusplus */
595
596#endif /* FC__PLAYER_H */
#define BV_DEFINE(name, bits)
Definition bitvector.h:140
struct civclient client
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 * punit
Definition dialogs_g.h:74
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
struct unit struct city * target_city
Definition dialogs_g.h:56
#define SP_MAX
Definition fc_types.h:267
#define MAX_NUM_PLAYER_SLOTS
Definition fc_types.h:32
#define MAX_NUM_MULTIPLIERS
Definition fc_types.h:55
#define MAX_LEN_NAME
Definition fc_types.h:66
#define B_LAST
Definition improvement.h:42
const char * name
Definition inputfile.c:127
bool is_settable_ai_level(enum ai_level level)
Definition player.c:1925
bool are_diplstates_equal(const struct player_diplstate *pds1, const struct player_diplstate *pds2)
Definition player.c:1505
bool player_can_invade_tile(const struct player *pplayer, const struct tile *ptile)
Definition player.c:270
bool player_knows_techs_with_flag(const struct player *pplayer, enum tech_flag_id flag)
Definition player.c:1328
int player_multiplier_effect_value(const struct player *pplayer, const struct multiplier *pmul)
Definition player.c:1975
void * player_ai_data(const struct player *pplayer, const struct ai_type *ai)
Definition player.c:1946
bool player_has_state(const struct player *pplayer, enum plrstate_type state)
Definition player.c:2004
dipl_reason
Definition player.h:192
@ DIPL_SENATE_BLOCKING
Definition player.h:193
@ DIPL_ALLIANCE_PROBLEM_THEM
Definition player.h:194
@ DIPL_ALLIANCE_PROBLEM_US
Definition player.h:194
@ DIPL_OK
Definition player.h:193
@ DIPL_ERROR
Definition player.h:193
bool player_slot_is_used(const struct player_slot *pslot)
Definition player.c:448
bv_diplrel_all_reqs diplrel_req_contradicts(const struct requirement *req)
Definition player.c:1829
int num_known_tech_with_flag(const struct player *pplayer, enum tech_flag_id flag)
Definition player.c:1273
bool is_valid_username(const char *name)
Definition player.c:1914
int player_multiplier_target_value(const struct player *pplayer, const struct multiplier *pmul)
Definition player.c:1987
bool can_player_see_tile(const struct player *plr, const struct tile *ptile)
Definition player.c:1091
struct unit * player_unit_by_number(const struct player *pplayer, int unit_id)
Definition player.c:1229
struct player * player_by_name_prefix(const char *name, enum m_pre_result *result)
Definition player.c:920
int diplrel_by_rule_name(const char *value)
Definition player.c:1585
struct player * player_new(struct player_slot *pslot)
Definition player.c:493
struct player * player_by_number(const int player_id)
Definition player.c:849
bool player_in_city_map(const struct player *pplayer, const struct tile *ptile)
Definition player.c:1249
bool players_on_same_team(const struct player *pplayer1, const struct player *pplayer2)
Definition player.c:1480
bool can_player_see_unit_at(const struct player *pplayer, const struct unit *punit, const struct tile *ptile, bool is_transported)
Definition player.c:1034
int player_count(void)
Definition player.c:817
enum diplstate_type cancel_pact_result(enum diplstate_type oldstate)
Definition player.c:68
int player_slot_count(void)
Definition player.c:418
struct player_slot * player_slot_by_number(int player_id)
Definition player.c:463
int player_multiplier_value(const struct player *pplayer, const struct multiplier *pmul)
Definition player.c:1964
int player_get_expected_income(const struct player *pplayer)
Definition player.c:1286
int player_number(const struct player *pplayer)
Definition player.c:837
enum dipl_reason pplayer_can_make_treaty(const struct player *p1, const struct player *p2, enum diplstate_type treaty)
Definition player.c:159
const char * player_name(const struct player *pplayer)
Definition player.c:895
void player_slots_free(void)
Definition player.c:386
bool is_diplrel_to_other(const struct player *pplayer, int diplrel)
Definition player.c:1566
static bool is_barbarian(const struct player *pplayer)
Definition player.h:491
int player_slot_max_used_number(void)
Definition player.c:476
bool can_player_see_unit(const struct player *pplayer, const struct unit *punit)
Definition player.c:1104
bool pplayers_at_war(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1388
void player_set_ai_data(struct player *pplayer, const struct ai_type *ai, void *data)
Definition player.c:1954
void player_ruleset_close(struct player *pplayer)
Definition player.c:745
void player_clear(struct player *pplayer, bool full)
Definition player.c:669
int player_slot_index(const struct player_slot *pslot)
Definition player.c:426
struct player * player_by_name(const char *name)
Definition player.c:881
void player_slots_init(void)
Definition player.c:360
bool player_has_flag(const struct player *pplayer, enum plr_flag_id flag)
Definition player.c:1996
bool player_has_real_embassy(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:240
bool team_has_embassy(const struct team *pteam, const struct player *tgt_player)
Definition player.c:220
void player_set_color(struct player *pplayer, const struct rgbcolor *prgbcolor)
Definition player.c:648
struct city * player_city_by_number(const struct player *pplayer, int city_id)
Definition player.c:1203
struct city * player_primary_capital(const struct player *pplayer)
Definition player.c:1337
int player_index(const struct player *pplayer)
Definition player.c:829
int player_in_territory(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1884
struct player * player_by_user(const char *name)
Definition player.c:940
const char * diplrel_name_translation(int value)
Definition player.c:1631
bool is_diplrel_between(const struct player *player1, const struct player *player2, int diplrel)
Definition player.c:1516
plrcolor_mode
Definition player.h:52
@ PLRCOL_PLR_RANDOM
Definition player.h:54
@ PLRCOL_PLR_SET
Definition player.h:55
@ PLRCOL_NATION_ORDER
Definition player.h:57
@ PLRCOL_TEAM_ORDER
Definition player.h:56
@ PLRCOL_PLR_ORDER
Definition player.h:53
static bool player_is_cpuhog(const struct player *pplayer)
Definition player.h:580
bool player_set_nation(struct player *pplayer, struct nation_type *pnation)
Definition player.c:861
bool player_can_see_city_externals(const struct player *pow_player, const struct city *target_city)
Definition player.c:1164
int player_age(const struct player *pplayer)
Definition player.c:954
enum dipl_reason pplayer_can_cancel_treaty(const struct player *p1, const struct player *p2)
Definition player.c:98
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
Definition player.c:324
int number_of_ai_levels(void)
Definition player.c:1938
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1409
bool can_player_see_hypotetic_units_at(const struct player *pplayer, const struct tile *ptile)
Definition player.c:993
bool player_has_embassy_from_effect(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:250
void diplrel_mess_close(void)
Definition player.c:1814
bool players_non_invade(const struct player *pplayer1, const struct player *pplayer2)
Definition player.c:1446
bool player_can_do_action_result(struct player *pplayer, enum action_result result)
Definition player.c:2028
bool pplayers_non_attack(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1463
bool can_player_see_units_in_city(const struct player *pplayer, const struct city *pcity)
Definition player.c:1133
struct player * player_slot_get_player(const struct player_slot *pslot)
Definition player.c:437
bool can_player_see_city_internals(const struct player *pplayer, const struct city *pcity)
Definition player.c:1149
struct player_slot * player_slot_next(struct player_slot *pslot)
Definition player.c:407
bool player_can_trust_tile_has_no_units(const struct player *pplayer, const struct tile *ptile)
Definition player.c:967
bool player_slots_initialised(void)
Definition player.c:378
const char * love_text(const int love)
Definition player.c:1354
player_debug_types
Definition player.h:214
@ PLAYER_DEBUG_LAST
Definition player.h:215
@ PLAYER_DEBUG_DIPLOMACY
Definition player.h:215
@ PLAYER_DEBUG_TECH
Definition player.h:215
bool gives_shared_tiles(const struct player *me, const struct player *them)
Definition player.c:1497
bool player_has_embassy(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:208
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)
Definition player.c:1644
const char * diplrel_rule_name(int value)
Definition player.c:1619
bool gives_shared_vision(const struct player *me, const struct player *them)
Definition player.c:1489
bool player_owns_city(const struct player *pplayer, const struct city *pcity)
Definition player.c:261
struct player_slot * player_slot_first(void)
Definition player.c:399
void player_destroy(struct player *pplayer)
Definition player.c:756
bool pplayers_in_peace(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1430
struct setting_list * level[OLEVELS_NUM]
Definition settings.c:190
m_pre_result
Definition shared.h:213
Definition ai.h:50
Definition city.h:317
void * handicaps
Definition player.h:115
enum ai_level skill_level
Definition player.h:116
struct ai_trait * traits
Definition player.h:126
enum barbarian_type barbarian_type
Definition player.h:122
int warmth
Definition player.h:121
int science_cost
Definition player.h:119
int love[MAX_NUM_PLAYER_SLOTS]
Definition player.h:124
int expand
Definition player.h:118
int fuzzy
Definition player.h:117
int maxbuycost
Definition player.h:114
int frost
Definition player.h:121
char contact_turns_left
Definition player.h:204
int auto_cancel_turn
Definition player.h:206
int first_contact_turn
Definition player.h:201
enum diplstate_type max_state
Definition player.h:200
enum diplstate_type type
Definition player.h:199
char has_reason_to_cancel
Definition player.h:203
int infra_points
Definition player.h:67
int units_killed
Definition player.h:105
int landarea
Definition player.h:94
int population
Definition player.h:96
int pollution
Definition player.h:99
int wonders
Definition player.h:91
int settledarea
Definition player.h:95
int units_used
Definition player.h:108
int specialists[SP_MAX]
Definition player.h:90
int units_lost
Definition player.h:106
int angry
Definition player.h:89
int techout
Definition player.h:93
int units
Definition player.h:98
int units_built
Definition player.h:104
int content
Definition player.h:87
int happy
Definition player.h:86
int spaceship
Definition player.h:103
int culture
Definition player.h:109
int unhappy
Definition player.h:88
int cities
Definition player.h:97
int literacy
Definition player.h:100
int techs
Definition player.h:92
struct city_list * cities
Definition player.h:281
int bulbs_last_turn
Definition player.h:351
bool random_name
Definition player.h:295
struct player_ai ai_common
Definition player.h:288
bv_plr_flags flags
Definition player.h:292
bv_pstatus status
Definition player.h:322
int primary_capital_id
Definition player.h:275
bool is_male
Definition player.h:257
int wonders[B_LAST]
Definition player.h:305
const struct player_diplstate ** diplstates
Definition player.h:278
bool unassigned_ranked
Definition player.h:255
struct government * target_government
Definition player.h:259
int autoselect_weight
Definition player.h:299
char username[MAX_LEN_NAME]
Definition player.h:252
bool is_winner
Definition player.h:269
bool is_connected
Definition player.h:296
int revolution_finishes
Definition player.h:273
int nturns_idle
Definition player.h:265
struct government * government
Definition player.h:258
struct dbv tile_known
Definition player.h:310
struct connection * current_conn
Definition player.h:297
struct team * team
Definition player.h:261
char * savegame_ai_type_name
Definition player.h:290
int turns_alive
Definition player.h:266
bool was_created
Definition player.h:294
int tech_upkeep
Definition player.h:363
const struct ai_type * ai
Definition player.h:289
struct unit_list * units
Definition player.h:282
char ranked_username[MAX_LEN_NAME]
Definition player.h:254
struct conn_list * connections
Definition player.h:298
int huts
Definition player.h:349
bool is_alive
Definition player.h:268
bv_player real_embassy
Definition player.h:277
struct player_economic economic
Definition player.h:284
int culture
Definition player.h:367
struct player_spaceship spaceship
Definition player.h:286
struct attribute_block_s attribute_block
Definition player.h:307
char name[MAX_LEN_NAME]
Definition player.h:251
bv_player gives_shared_vision
Definition player.h:302
enum mood_type mood
Definition player.h:361
struct player_score score
Definition player.h:283
struct attribute_block_s attribute_block_buffer
Definition player.h:308
struct player_tile * private_map
Definition player.h:324
struct multiplier_value multipliers[MAX_NUM_MULTIPLIERS]
Definition player.h:314
bv_player really_gives_vision
Definition player.h:329
struct nation_type * nation
Definition player.h:260
bool color_changeable
Definition player.h:365
int music_style
Definition player.h:280
struct nation_style * style
Definition player.h:279
bool border_vision
Definition player.h:327
bool phase_done
Definition player.h:263
struct adv_data * adv
Definition player.h:334
struct player_slot * slot
Definition player.h:250
bv_player gives_shared_tiles
Definition player.h:304
bool is_ready
Definition player.h:262
int history
Definition player.h:316
int user_turns
Definition player.h:256
bv_debug debug
Definition player.h:332
int last_war_action
Definition player.h:270
struct rgbcolor * rgb
Definition player.h:312
bool unassigned_user
Definition player.h:253
bool ai_phase_done
Definition player.h:264
Definition team.c:40
Definition tile.h:50
Definition unit.h:140
#define FALSE
Definition support.h:47