Freeciv-3.1: /fast/freeciv/nightly/S3_1/common/player.h Source File

Freeciv-3.1

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 "nation.h"
29#include "shared.h"
30#include "spaceship.h"
31#include "style.h"
32#include "tech.h"
33#include "traits.h"
34#include "unitlist.h"
35#include "vision.h"
36
37struct city;
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 enum plrcolor_mode {
51 PLRCOL_PLR_ORDER,
52 PLRCOL_PLR_RANDOM,
53 PLRCOL_PLR_SET,
54 PLRCOL_TEAM_ORDER,
55 PLRCOL_NATION_ORDER
56};
57
58#define SPECENUM_NAME plr_flag_id
59#define SPECENUM_VALUE0 PLRF_AI
60#define SPECENUM_VALUE0NAME "ai"
61#define SPECENUM_VALUE1 PLRF_SCENARIO_RESERVED
62#define SPECENUM_VALUE1NAME "ScenarioReserved"
63#define SPECENUM_COUNT PLRF_COUNT
64#define SPECENUM_BITVECTOR bv_plr_flags
65#include "specenum_gen.h"
66
67struct player_slot;
68
69 struct player_economic {
70 int gold;
71 int tax;
72 int science;
73 int luxury;
74 int infra_points;
75};
76
77#define SPECENUM_NAME player_status
78/* 'normal' status */
79#define SPECENUM_VALUE0 PSTATUS_NORMAL
80/* set once the player is in the process of dying */
81#define SPECENUM_VALUE1 PSTATUS_DYING
82/* this player is winner in scenario game */
83#define SPECENUM_VALUE2 PSTATUS_WINNER
84/* has indicated willingness to surrender */
85#define SPECENUM_VALUE3 PSTATUS_SURRENDER
86/* keep this last */
87#define SPECENUM_COUNT PSTATUS_COUNT
88#include "specenum_gen.h"
89
90 BV_DEFINE(bv_pstatus, PSTATUS_COUNT);
91
92 struct player_score {
93 int happy;
94 int content;
95 int unhappy;
96 int angry;
97 int specialists[SP_MAX];
98 int wonders;
99 int techs;
100 int techout;
101 int landarea;
102 int settledarea;
103 int population; /* in thousand of citizen */
104 int cities;
105 int units;
106 int pollution;
107 int literacy;
108 int bnp;
109 int mfg;
110 int spaceship;
111 int units_built; /* Number of units this player produced. */
112 int units_killed; /* Number of enemy units killed. */
113 int units_lost; /* Number of own units that died,
114 * by combat or otherwise. */
115 int culture;
116 int game; /* Total score you get in player dialog. */
117};
118
119 struct player_ai {
120 int maxbuycost;
121 void *handicaps;
122 enum ai_level skill_level; /* 0-10 value for save/load/display */
123 int fuzzy; /* chance in 1000 to mis-decide */
124 int expand; /* percentage factor to value new cities */
125 int science_cost; /* Cost in bulbs to get new tech, relative
126 to non-AI players (100: Equal cost) */
127 int warmth, frost; /* threat of global warming / nuclear winter */
128 enum barbarian_type barbarian_type;
129
130 int love[MAX_NUM_PLAYER_SLOTS];
131
132 struct ai_trait *traits;
133};
134
135/* Diplomatic states (how one player views another).
136 * (Some diplomatic states are "pacts" (mutual agreements), others aren't.)
137 *
138 * Adding to or reordering this array will break many things.
139 *
140 * Used in the network protocol.
141 */
142#define SPECENUM_NAME diplstate_type
143#define SPECENUM_VALUE0 DS_ARMISTICE
144#define SPECENUM_VALUE0NAME N_("?diplomatic_state:Armistice")
145#define SPECENUM_VALUE1 DS_WAR
146#define SPECENUM_VALUE1NAME N_("?diplomatic_state:War")
147#define SPECENUM_VALUE2 DS_CEASEFIRE
148#define SPECENUM_VALUE2NAME N_("?diplomatic_state:Cease-fire")
149#define SPECENUM_VALUE3 DS_PEACE
150#define SPECENUM_VALUE3NAME N_("?diplomatic_state:Peace")
151#define SPECENUM_VALUE4 DS_ALLIANCE
152#define SPECENUM_VALUE4NAME N_("?diplomatic_state:Alliance")
153#define SPECENUM_VALUE5 DS_NO_CONTACT
154#define SPECENUM_VALUE5NAME N_("?diplomatic_state:Never met")
155#define SPECENUM_VALUE6 DS_TEAM
156#define SPECENUM_VALUE6NAME N_("?diplomatic_state:Team")
157 /* When adding or removing entries, note that first value
158 * of diplrel_other should be next to last diplstate_type */
159#define SPECENUM_COUNT DS_LAST /* leave this last */
160#include "specenum_gen.h"
161
162/* Other diplomatic relation properties.
163 *
164 * The first element here is numbered DS_LAST
165 *
166 * Used in the network protocol.
167 */
168#define SPECENUM_NAME diplrel_other
169#define SPECENUM_VALUE7 DRO_GIVES_SHARED_VISION
170#define SPECENUM_VALUE7NAME N_("Gives shared vision")
171#define SPECENUM_VALUE8 DRO_RECEIVES_SHARED_VISION
172#define SPECENUM_VALUE8NAME N_("Receives shared vision")
173#define SPECENUM_VALUE9 DRO_HOSTS_EMBASSY
174#define SPECENUM_VALUE9NAME N_("Hosts embassy")
175#define SPECENUM_VALUE10 DRO_HAS_EMBASSY
176#define SPECENUM_VALUE10NAME N_("Has embassy")
177#define SPECENUM_VALUE11 DRO_HOSTS_REAL_EMBASSY
178#define SPECENUM_VALUE11NAME N_("Hosts real embassy")
179#define SPECENUM_VALUE12 DRO_HAS_REAL_EMBASSY
180#define SPECENUM_VALUE12NAME N_("Has real embassy")
181#define SPECENUM_VALUE13 DRO_HAS_CASUS_BELLI
182#define SPECENUM_VALUE13NAME N_("Has Casus Belli")
183#define SPECENUM_VALUE14 DRO_PROVIDED_CASUS_BELLI
184#define SPECENUM_VALUE14NAME N_("Provided Casus Belli")
185#define SPECENUM_VALUE15 DRO_FOREIGN
186#define SPECENUM_VALUE15NAME N_("Foreign")
187#define SPECENUM_COUNT DRO_LAST
188#include "specenum_gen.h"
189
190 BV_DEFINE(bv_diplrel_all_reqs,
191 /* Reserve a location for each possible DiplRel requirement. */
192 ((DRO_LAST - 1) * 2) * REQ_RANGE_COUNT);
193
194 enum dipl_reason {
195 DIPL_OK, DIPL_ERROR, DIPL_SENATE_BLOCKING,
196 DIPL_ALLIANCE_PROBLEM_US, DIPL_ALLIANCE_PROBLEM_THEM
197};
198
199/* The following are for "pacts" */
200 struct player_diplstate {
201 enum diplstate_type type; /* This player's disposition towards other */
202 enum diplstate_type max_state; /* Maximum treaty level ever had */
203 int first_contact_turn; /* Turn we had first contact with this player */
204 char turns_left; /* Until pact (e.g., cease-fire) ends */
205 char has_reason_to_cancel; /* 0: no, 1: this turn, 2: this or next turn */
206 char contact_turns_left; /* Until contact ends */
207
208 int auto_cancel_turn; /* Used to avoid asymmetric turns_left */
209};
210
211/***************************************************************************
212 On the distinction between nations(formerly races), players, and users,
213 see doc/HACKING
214***************************************************************************/
215
216 enum player_debug_types {
217 PLAYER_DEBUG_DIPLOMACY, PLAYER_DEBUG_TECH, PLAYER_DEBUG_LAST
218};
219
220 BV_DEFINE(bv_debug, PLAYER_DEBUG_LAST);
221
222 struct attribute_block_s {
223 void *data;
224 int length;
225#define MAX_ATTRIBUTE_BLOCK (256*1024) /* largest attribute block */
226};
227
228struct ai_type;
229struct ai_data;
230
231bool player_has_flag(const struct player *pplayer, enum plr_flag_id flag);
232
233#define is_human(plr) !player_has_flag((plr), PLRF_AI)
234#define is_ai(plr) player_has_flag((plr), PLRF_AI)
235#define set_as_human(plr) BV_CLR((plr)->flags, PLRF_AI)
236#define set_as_ai(plr) BV_SET((plr)->flags, PLRF_AI)
237
238 struct multiplier_value
239{
240 /* Value currently in force. */
241 int value;
242 /* Value to be used next turn. */
243 int target;
244 /* Turn that value was last changed. */
245 int changed;
246};
247
248 struct player
249{
250 struct player_slot *slot;
251 char name[MAX_LEN_NAME];
252 char username[MAX_LEN_NAME];
253 bool unassigned_user;
254 char ranked_username[MAX_LEN_NAME]; /* the user who will be ranked */
255 bool unassigned_ranked;
256 int user_turns; /* number of turns this user has played */
257 bool is_male;
258 struct government *government; /* may be NULL in pregame */
259 struct government *target_government; /* may be NULL */
260 struct nation_type *nation;
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 */
265 int nturns_idle;
266 int turns_alive; /* Number of turns this player has spent alive;
267 * 0 when created, increment at the end of each turn */
268 bool is_alive;
269 bool is_winner;
270 int last_war_action;
271
272 /* Turn in which the player's revolution is over; see update_revolution. */
273 int revolution_finishes;
274
275 int primary_capital_id;
276
277 bv_player real_embassy;
278 const struct player_diplstate **diplstates;
279 struct nation_style *style;
280 int music_style;
281 struct city_list *cities;
282 struct unit_list *units;
283 struct player_score score;
284 struct player_economic economic;
285
286 struct player_spaceship spaceship;
287
288 struct player_ai ai_common;
289 const struct ai_type *ai;
290 char *savegame_ai_type_name;
291
292 bv_plr_flags flags;
293
294 bool was_created; /* if the player was /created */
295 bool random_name;
296 bool is_connected;
297 struct connection *current_conn; /* non-null while handling packet */
298 struct conn_list *connections; /* will replace conn */
299 bv_player gives_shared_vision; /* bitvector those that give you
300 * shared vision */
301 int wonders[B_LAST]; /* contains city id's, WONDER_NOT_BUILT,
302 * or WONDER_LOST */
303 struct attribute_block_s attribute_block;
304 struct attribute_block_s attribute_block_buffer;
305
306 struct dbv tile_known;
307
308 struct rgbcolor *rgb;
309
310 struct multiplier_value multipliers[MAX_NUM_MULTIPLIERS];
311
312 int history; /* National level culture - does not include culture of individual
313 * cities. */
314
315 union {
316 struct {
317 /* Only used in the server (./ai/ and ./server/). */
318 bv_pstatus status;
319
320 bool got_first_city; /* used to give player init_buildings in first
321 * city. Once set, never becomes unset.
322 * (Previously 'capital'.) */
323
324 struct player_tile *private_map;
325
326 /* Player can see inside their borders. */
327 bool border_vision;
328
329 bv_player really_gives_vision; /* takes into account that p3 may see
330 * what p1 has via p2 */
331
332 bv_debug debug;
333
334 struct adv_data *adv;
335
336 void *ais[FREECIV_AI_MOD_LAST];
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. */
352 } server;
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
361 enum mood_type mood;
362
363 int tech_upkeep;
364
365 bool color_changeable;
366
367 int culture;
368 } client;
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);
386int player_slot_max_used_number(void);
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
409bool player_has_embassy(const struct player *pplayer,
410 const struct player *pplayer2);
411bool player_has_real_embassy(const struct player *pplayer,
412 const struct player *pplayer2);
413bool player_has_embassy_from_effect(const struct player *pplayer,
414 const struct player *pplayer2);
415bool team_has_embassy(const struct team *pteam, const struct player *tgt_player);
416
417int player_age(const struct player *pplayer);
418
419bool player_can_trust_tile_has_no_units(const struct player *pplayer,
420 const struct tile *ptile);
421bool can_player_see_hypotetic_units_at(const struct player *pplayer,
422 const struct tile *ptile);
423bool can_player_see_unit(const struct player *pplayer,
424 const struct unit *punit);
425bool can_player_see_unit_at(const struct player *pplayer,
426 const struct unit *punit,
427 const struct tile *ptile,
428 bool is_transported);
429
430bool can_player_see_units_in_city(const struct player *pplayer,
431 const struct city *pcity);
432bool can_player_see_city_internals(const struct player *pplayer,
433 const struct city *pcity);
434bool player_can_see_city_externals(const struct player *pow_player,
435 const struct city *target_city);
436
437bool player_owns_city(const struct player *pplayer,
438 const struct city *pcity);
439bool player_can_invade_tile(const struct player *pplayer,
440 const struct tile *ptile);
441
442struct city *player_city_by_number(const struct player *pplayer,
443 int city_id);
444struct unit *player_unit_by_number(const struct player *pplayer,
445 int unit_id);
446
447bool player_in_city_map(const struct player *pplayer,
448 const struct tile *ptile);
449bool player_knows_techs_with_flag(const struct player *pplayer,
450 enum tech_flag_id flag);
451int num_known_tech_with_flag(const struct player *pplayer,
452 enum tech_flag_id flag);
453int player_get_expected_income(const struct player *pplayer);
454
455struct city *player_primary_capital(const struct player *pplayer);
456
457const char *love_text(const int love);
458
459enum diplstate_type cancel_pact_result(enum diplstate_type oldstate);
460
461struct player_diplstate *player_diplstate_get(const struct player *plr1,
462 const struct player *plr2);
463bool are_diplstates_equal(const struct player_diplstate *pds1,
464 const struct player_diplstate *pds2);
465enum dipl_reason pplayer_can_make_treaty(const struct player *p1,
466 const struct player *p2,
467 enum diplstate_type treaty);
468enum dipl_reason pplayer_can_cancel_treaty(const struct player *p1,
469 const struct player *p2);
470bool pplayers_at_war(const struct player *pplayer,
471 const struct player *pplayer2);
472bool pplayers_allied(const struct player *pplayer,
473 const struct player *pplayer2);
474bool pplayers_in_peace(const struct player *pplayer,
475 const struct player *pplayer2);
476bool players_non_invade(const struct player *pplayer1,
477 const struct player *pplayer2);
478bool pplayers_non_attack(const struct player *pplayer,
479 const struct player *pplayer2);
480bool players_on_same_team(const struct player *pplayer1,
481 const struct player *pplayer2);
482int player_in_territory(const struct player *pplayer,
483 const struct player *pplayer2);
484
485/**************************************************************************
486 Return TRUE iff player is any kind of barbarian
487**************************************************************************/
488 static inline bool is_barbarian(const struct player *pplayer)
489{
490 return pplayer->ai_common.barbarian_type != NOT_A_BARBARIAN;
491}
492
493bool gives_shared_vision(const struct player *me, const struct player *them);
494
495void diplrel_mess_close(void);
496bool is_diplrel_between(const struct player *player1,
497 const struct player *player2,
498 int diplrel);
499bool is_diplrel_to_other(const struct player *pplayer, int diplrel);
500int diplrel_by_rule_name(const char *value);
501const char *diplrel_rule_name(int value);
502const char *diplrel_name_translation(int value);
503
504enum casus_belli_range casus_belli_range_for(const struct player *offender,
505 const struct unit_type *off_ut,
506 const struct player *tgt_plr,
507 const enum effect_type outcome,
508 const struct action *paction,
509 const struct tile *tgt_tile);
510
511bv_diplrel_all_reqs diplrel_req_contradicts(const struct requirement *req);
512
513int player_multiplier_value(const struct player *pplayer,
514 const struct multiplier *pmul);
515int player_multiplier_effect_value(const struct player *pplayer,
516 const struct multiplier *pmul);
517int player_multiplier_target_value(const struct player *pplayer,
518 const struct multiplier *pmul);
519
520/* iterate over all player slots */
521#define player_slots_iterate(_pslot) \
522 if (player_slots_initialised()) { \
523 struct player_slot *_pslot = player_slot_first(); \
524 for (; NULL != _pslot; _pslot = player_slot_next(_pslot)) {
525#define player_slots_iterate_end \
526 } \
527 }
528
529/* iterate over all players, which are used at the moment */
530#define players_iterate(_pplayer) \
531 player_slots_iterate(_pslot##_pplayer) { \
532 struct player *_pplayer = player_slot_get_player(_pslot##_pplayer); \
533 if (_pplayer != NULL) {
534
535#define players_iterate_end \
536 } \
537 } player_slots_iterate_end;
538
539/* iterate over all players, which are used at the moment and are alive */
540#define players_iterate_alive(_pplayer) \
541 players_iterate(_pplayer) { \
542 if (!_pplayer->is_alive) { \
543 continue; \
544 }
545#define players_iterate_alive_end \
546 } players_iterate_end;
547
548/* get 'struct player_list' and related functions: */
549#define SPECLIST_TAG player
550#define SPECLIST_TYPE struct player
551#include "speclist.h"
552
553#define player_list_iterate(playerlist, pplayer) \
554 TYPED_LIST_ITERATE(struct player, playerlist, pplayer)
555#define player_list_iterate_end \
556 LIST_ITERATE_END
557
558/* ai love values should be in range [-MAX_AI_LOVE..MAX_AI_LOVE] */
559#define MAX_AI_LOVE 1000
560
561
562/* User functions. */
563bool is_valid_username(const char *name);
564
565#define ai_level_cmd(_level_) ai_level_name(_level_)
566bool is_settable_ai_level(enum ai_level level);
567int number_of_ai_levels(void);
568
569void *player_ai_data(const struct player *pplayer, const struct ai_type *ai);
570void player_set_ai_data(struct player *pplayer, const struct ai_type *ai,
571 void *data);
572
573 static inline bool player_is_cpuhog(const struct player *pplayer)
574{
575 /* You have to make code change here to enable cpuhog AI. There is no even
576 * configure option to change this. That's intentional.
577 * Enabling them causes game to proceed differently, and for reproducing
578 * reported bugs we want to know if this has been changed. People are more
579 * likely to report that they have made code changes than remembering some
580 * specific configure option they happened to pass to build this time - or even
581 * knowing what configure options somebody else used when building freeciv for them. */
582 return FALSE;
583}
584
585#ifdef __cplusplus
586}
587#endif /* __cplusplus */
588
589#endif /* FC__PLAYER_H */
bitvector.h
BV_DEFINE
#define BV_DEFINE(name, bits)
Definition bitvector.h:132
client
struct civclient client
Definition client_main.c:149
connection.h
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 * punit
Definition dialogs_g.h:73
target_city
struct unit struct city * target_city
Definition dialogs_g.h:55
effects.h
fc_types.h
SP_MAX
#define SP_MAX
Definition fc_types.h:379
MAX_NUM_PLAYER_SLOTS
#define MAX_NUM_PLAYER_SLOTS
Definition fc_types.h:32
MAX_NUM_MULTIPLIERS
#define MAX_NUM_MULTIPLIERS
Definition fc_types.h:55
MAX_LEN_NAME
#define MAX_LEN_NAME
Definition fc_types.h:66
B_LAST
#define B_LAST
Definition improvement.h:42
name
const char * name
Definition inputfile.c:127
multipliers.h
nation.h
is_settable_ai_level
bool is_settable_ai_level(enum ai_level level)
Definition player.c:1883
are_diplstates_equal
bool are_diplstates_equal(const struct player_diplstate *pds1, const struct player_diplstate *pds2)
Definition player.c:1469
player_can_invade_tile
bool player_can_invade_tile(const struct player *pplayer, const struct tile *ptile)
Definition player.c:264
player_knows_techs_with_flag
bool player_knows_techs_with_flag(const struct player *pplayer, enum tech_flag_id flag)
Definition player.c:1304
player_multiplier_effect_value
int player_multiplier_effect_value(const struct player *pplayer, const struct multiplier *pmul)
Definition player.c:1933
player_ai_data
void * player_ai_data(const struct player *pplayer, const struct ai_type *ai)
Definition player.c:1904
dipl_reason
dipl_reason
Definition player.h:194
DIPL_SENATE_BLOCKING
@ DIPL_SENATE_BLOCKING
Definition player.h:195
DIPL_ALLIANCE_PROBLEM_THEM
@ DIPL_ALLIANCE_PROBLEM_THEM
Definition player.h:196
DIPL_ALLIANCE_PROBLEM_US
@ DIPL_ALLIANCE_PROBLEM_US
Definition player.h:196
DIPL_OK
@ DIPL_OK
Definition player.h:195
DIPL_ERROR
@ DIPL_ERROR
Definition player.h:195
player_slot_is_used
bool player_slot_is_used(const struct player_slot *pslot)
Definition player.c:441
diplrel_req_contradicts
bv_diplrel_all_reqs diplrel_req_contradicts(const struct requirement *req)
Definition player.c:1787
num_known_tech_with_flag
int num_known_tech_with_flag(const struct player *pplayer, enum tech_flag_id flag)
Definition player.c:1249
is_valid_username
bool is_valid_username(const char *name)
Definition player.c:1872
player_multiplier_target_value
int player_multiplier_target_value(const struct player *pplayer, const struct multiplier *pmul)
Definition player.c:1945
player_unit_by_number
struct unit * player_unit_by_number(const struct player *pplayer, int unit_id)
Definition player.c:1205
player_by_name_prefix
struct player * player_by_name_prefix(const char *name, enum m_pre_result *result)
Definition player.c:911
diplrel_by_rule_name
int diplrel_by_rule_name(const char *value)
Definition player.c:1545
player_new
struct player * player_new(struct player_slot *pslot)
Definition player.c:486
player_by_number
struct player * player_by_number(const int player_id)
Definition player.c:840
player_in_city_map
bool player_in_city_map(const struct player *pplayer, const struct tile *ptile)
Definition player.c:1225
players_on_same_team
bool players_on_same_team(const struct player *pplayer1, const struct player *pplayer2)
Definition player.c:1452
can_player_see_unit_at
bool can_player_see_unit_at(const struct player *pplayer, const struct unit *punit, const struct tile *ptile, bool is_transported)
Definition player.c:1025
player_count
int player_count(void)
Definition player.c:808
cancel_pact_result
enum diplstate_type cancel_pact_result(enum diplstate_type oldstate)
Definition player.c:67
player_slot_count
int player_slot_count(void)
Definition player.c:411
player_slot_by_number
struct player_slot * player_slot_by_number(int player_id)
Definition player.c:456
player_multiplier_value
int player_multiplier_value(const struct player *pplayer, const struct multiplier *pmul)
Definition player.c:1922
player_get_expected_income
int player_get_expected_income(const struct player *pplayer)
Definition player.c:1262
player_number
int player_number(const struct player *pplayer)
Definition player.c:828
pplayer_can_make_treaty
enum dipl_reason pplayer_can_make_treaty(const struct player *p1, const struct player *p2, enum diplstate_type treaty)
Definition player.c:153
player_name
const char * player_name(const struct player *pplayer)
Definition player.c:886
player_slots_free
void player_slots_free(void)
Definition player.c:379
is_diplrel_to_other
bool is_diplrel_to_other(const struct player *pplayer, int diplrel)
Definition player.c:1526
is_barbarian
static bool is_barbarian(const struct player *pplayer)
Definition player.h:488
player_slot_max_used_number
int player_slot_max_used_number(void)
Definition player.c:469
can_player_see_unit
bool can_player_see_unit(const struct player *pplayer, const struct unit *punit)
Definition player.c:1084
pplayers_at_war
bool pplayers_at_war(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1364
player_set_ai_data
void player_set_ai_data(struct player *pplayer, const struct ai_type *ai, void *data)
Definition player.c:1912
player_ruleset_close
void player_ruleset_close(struct player *pplayer)
Definition player.c:736
player_clear
void player_clear(struct player *pplayer, bool full)
Definition player.c:660
player_slot_index
int player_slot_index(const struct player_slot *pslot)
Definition player.c:419
player_by_name
struct player * player_by_name(const char *name)
Definition player.c:872
player_slots_init
void player_slots_init(void)
Definition player.c:353
player_has_flag
bool player_has_flag(const struct player *pplayer, enum plr_flag_id flag)
Definition player.c:1954
player_has_real_embassy
bool player_has_real_embassy(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:234
team_has_embassy
bool team_has_embassy(const struct team *pteam, const struct player *tgt_player)
Definition player.c:214
player_set_color
void player_set_color(struct player *pplayer, const struct rgbcolor *prgbcolor)
Definition player.c:639
player_city_by_number
struct city * player_city_by_number(const struct player *pplayer, int city_id)
Definition player.c:1179
player_primary_capital
struct city * player_primary_capital(const struct player *pplayer)
Definition player.c:1313
player_index
int player_index(const struct player *pplayer)
Definition player.c:820
player_in_territory
int player_in_territory(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1842
player_by_user
struct player * player_by_user(const char *name)
Definition player.c:931
diplrel_name_translation
const char * diplrel_name_translation(int value)
Definition player.c:1591
is_diplrel_between
bool is_diplrel_between(const struct player *player1, const struct player *player2, int diplrel)
Definition player.c:1480
plrcolor_mode
plrcolor_mode
Definition player.h:50
PLRCOL_PLR_RANDOM
@ PLRCOL_PLR_RANDOM
Definition player.h:52
PLRCOL_PLR_SET
@ PLRCOL_PLR_SET
Definition player.h:53
PLRCOL_NATION_ORDER
@ PLRCOL_NATION_ORDER
Definition player.h:55
PLRCOL_TEAM_ORDER
@ PLRCOL_TEAM_ORDER
Definition player.h:54
PLRCOL_PLR_ORDER
@ PLRCOL_PLR_ORDER
Definition player.h:51
player_is_cpuhog
static bool player_is_cpuhog(const struct player *pplayer)
Definition player.h:573
player_set_nation
bool player_set_nation(struct player *pplayer, struct nation_type *pnation)
Definition player.c:852
player_can_see_city_externals
bool player_can_see_city_externals(const struct player *pow_player, const struct city *target_city)
Definition player.c:1143
player_age
int player_age(const struct player *pplayer)
Definition player.c:945
pplayer_can_cancel_treaty
enum dipl_reason pplayer_can_cancel_treaty(const struct player *p1, const struct player *p2)
Definition player.c:92
player_diplstate_get
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
Definition player.c:317
number_of_ai_levels
int number_of_ai_levels(void)
Definition player.c:1896
pplayers_allied
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1381
can_player_see_hypotetic_units_at
bool can_player_see_hypotetic_units_at(const struct player *pplayer, const struct tile *ptile)
Definition player.c:984
player_has_embassy_from_effect
bool player_has_embassy_from_effect(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:244
diplrel_mess_close
void diplrel_mess_close(void)
Definition player.c:1772
players_non_invade
bool players_non_invade(const struct player *pplayer1, const struct player *pplayer2)
Definition player.c:1418
pplayers_non_attack
bool pplayers_non_attack(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1435
can_player_see_units_in_city
bool can_player_see_units_in_city(const struct player *pplayer, const struct city *pcity)
Definition player.c:1113
player_slot_get_player
struct player * player_slot_get_player(const struct player_slot *pslot)
Definition player.c:430
can_player_see_city_internals
bool can_player_see_city_internals(const struct player *pplayer, const struct city *pcity)
Definition player.c:1129
player_slot_next
struct player_slot * player_slot_next(struct player_slot *pslot)
Definition player.c:400
player_can_trust_tile_has_no_units
bool player_can_trust_tile_has_no_units(const struct player *pplayer, const struct tile *ptile)
Definition player.c:958
player_slots_initialised
bool player_slots_initialised(void)
Definition player.c:371
love_text
const char * love_text(const int love)
Definition player.c:1330
player_debug_types
player_debug_types
Definition player.h:216
PLAYER_DEBUG_LAST
@ PLAYER_DEBUG_LAST
Definition player.h:217
PLAYER_DEBUG_DIPLOMACY
@ PLAYER_DEBUG_DIPLOMACY
Definition player.h:217
PLAYER_DEBUG_TECH
@ PLAYER_DEBUG_TECH
Definition player.h:217
player_has_embassy
bool player_has_embassy(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:202
casus_belli_range_for
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:1604
diplrel_rule_name
const char * diplrel_rule_name(int value)
Definition player.c:1579
gives_shared_vision
bool gives_shared_vision(const struct player *me, const struct player *them)
Definition player.c:1461
player_owns_city
bool player_owns_city(const struct player *pplayer, const struct city *pcity)
Definition player.c:255
player_slot_first
struct player_slot * player_slot_first(void)
Definition player.c:392
player_destroy
void player_destroy(struct player *pplayer)
Definition player.c:747
pplayers_in_peace
bool pplayers_in_peace(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1402
level
struct setting_list * level[OLEVELS_NUM]
Definition settings.c:183
shared.h
m_pre_result
m_pre_result
Definition shared.h:207
spaceship.h
specenum_gen.h
speclist.h
action
Definition actions.h:379
adv_data
Definition advdata.h:45
ai_trait
Definition traits.h:37
ai_type
Definition ai.h:50
attribute_block_s
Definition player.h:222
attribute_block_s::data
void * data
Definition player.h:223
attribute_block_s::length
int length
Definition player.h:224
city
Definition city.h:309
connection
Definition connection.h:141
dbv
Definition bitvector.h:32
government
Definition government.h:52
multiplier_value
Definition player.h:239
multiplier_value::value
int value
Definition player.h:241
multiplier_value::target
int target
Definition player.h:243
multiplier_value::changed
int changed
Definition player.h:245
multiplier
Definition multipliers.h:31
nation_style
Definition style.h:22
nation_type
Definition nation.h:97
player_ai
Definition player.h:119
player_ai::handicaps
void * handicaps
Definition player.h:121
player_ai::skill_level
enum ai_level skill_level
Definition player.h:122
player_ai::traits
struct ai_trait * traits
Definition player.h:132
player_ai::barbarian_type
enum barbarian_type barbarian_type
Definition player.h:128
player_ai::warmth
int warmth
Definition player.h:127
player_ai::science_cost
int science_cost
Definition player.h:125
player_ai::love
int love[MAX_NUM_PLAYER_SLOTS]
Definition player.h:130
player_ai::expand
int expand
Definition player.h:124
player_ai::fuzzy
int fuzzy
Definition player.h:123
player_ai::maxbuycost
int maxbuycost
Definition player.h:120
player_ai::frost
int frost
Definition player.h:127
player_diplstate
Definition player.h:200
player_diplstate::contact_turns_left
char contact_turns_left
Definition player.h:206
player_diplstate::turns_left
char turns_left
Definition player.h:204
player_diplstate::auto_cancel_turn
int auto_cancel_turn
Definition player.h:208
player_diplstate::first_contact_turn
int first_contact_turn
Definition player.h:203
player_diplstate::max_state
enum diplstate_type max_state
Definition player.h:202
player_diplstate::type
enum diplstate_type type
Definition player.h:201
player_diplstate::has_reason_to_cancel
char has_reason_to_cancel
Definition player.h:205
player_economic
Definition player.h:69
player_economic::luxury
int luxury
Definition player.h:73
player_economic::science
int science
Definition player.h:72
player_economic::tax
int tax
Definition player.h:71
player_economic::infra_points
int infra_points
Definition player.h:74
player_economic::gold
int gold
Definition player.h:70
player_score
Definition player.h:92
player_score::units_killed
int units_killed
Definition player.h:112
player_score::landarea
int landarea
Definition player.h:101
player_score::mfg
int mfg
Definition player.h:109
player_score::population
int population
Definition player.h:103
player_score::pollution
int pollution
Definition player.h:106
player_score::wonders
int wonders
Definition player.h:98
player_score::settledarea
int settledarea
Definition player.h:102
player_score::specialists
int specialists[SP_MAX]
Definition player.h:97
player_score::units_lost
int units_lost
Definition player.h:113
player_score::angry
int angry
Definition player.h:96
player_score::techout
int techout
Definition player.h:100
player_score::game
int game
Definition player.h:116
player_score::units
int units
Definition player.h:105
player_score::units_built
int units_built
Definition player.h:111
player_score::content
int content
Definition player.h:94
player_score::happy
int happy
Definition player.h:93
player_score::spaceship
int spaceship
Definition player.h:110
player_score::culture
int culture
Definition player.h:115
player_score::unhappy
int unhappy
Definition player.h:95
player_score::cities
int cities
Definition player.h:104
player_score::bnp
int bnp
Definition player.h:108
player_score::literacy
int literacy
Definition player.h:107
player_score::techs
int techs
Definition player.h:99
player_slot
Definition player.c:45
player_spaceship
Definition spaceship.h:94
player_tile
Definition maphand.h:30
player
Definition player.h:249
player::cities
struct city_list * cities
Definition player.h:281
player::bulbs_last_turn
int bulbs_last_turn
Definition player.h:351
player::random_name
bool random_name
Definition player.h:295
player::ai_common
struct player_ai ai_common
Definition player.h:288
player::flags
bv_plr_flags flags
Definition player.h:292
player::status
bv_pstatus status
Definition player.h:318
player::primary_capital_id
int primary_capital_id
Definition player.h:275
player::is_male
bool is_male
Definition player.h:257
player::got_first_city
bool got_first_city
Definition player.h:320
player::wonders
int wonders[B_LAST]
Definition player.h:301
player::diplstates
const struct player_diplstate ** diplstates
Definition player.h:278
player::unassigned_ranked
bool unassigned_ranked
Definition player.h:255
player::target_government
struct government * target_government
Definition player.h:259
player::username
char username[MAX_LEN_NAME]
Definition player.h:252
player::is_winner
bool is_winner
Definition player.h:269
player::is_connected
bool is_connected
Definition player.h:296
player::revolution_finishes
int revolution_finishes
Definition player.h:273
player::nturns_idle
int nturns_idle
Definition player.h:265
player::government
struct government * government
Definition player.h:258
player::tile_known
struct dbv tile_known
Definition player.h:306
player::current_conn
struct connection * current_conn
Definition player.h:297
player::team
struct team * team
Definition player.h:261
player::savegame_ai_type_name
char * savegame_ai_type_name
Definition player.h:290
player::turns_alive
int turns_alive
Definition player.h:266
player::was_created
bool was_created
Definition player.h:294
player::tech_upkeep
int tech_upkeep
Definition player.h:363
player::ai
const struct ai_type * ai
Definition player.h:289
player::units
struct unit_list * units
Definition player.h:282
player::ranked_username
char ranked_username[MAX_LEN_NAME]
Definition player.h:254
player::connections
struct conn_list * connections
Definition player.h:298
player::huts
int huts
Definition player.h:349
player::is_alive
bool is_alive
Definition player.h:268
player::real_embassy
bv_player real_embassy
Definition player.h:277
player::economic
struct player_economic economic
Definition player.h:284
player::culture
int culture
Definition player.h:367
player::spaceship
struct player_spaceship spaceship
Definition player.h:286
player::attribute_block
struct attribute_block_s attribute_block
Definition player.h:303
player::name
char name[MAX_LEN_NAME]
Definition player.h:251
player::gives_shared_vision
bv_player gives_shared_vision
Definition player.h:299
player::mood
enum mood_type mood
Definition player.h:361
player::score
struct player_score score
Definition player.h:283
player::attribute_block_buffer
struct attribute_block_s attribute_block_buffer
Definition player.h:304
player::private_map
struct player_tile * private_map
Definition player.h:324
player::multipliers
struct multiplier_value multipliers[MAX_NUM_MULTIPLIERS]
Definition player.h:310
player::really_gives_vision
bv_player really_gives_vision
Definition player.h:329
player::nation
struct nation_type * nation
Definition player.h:260
player::color_changeable
bool color_changeable
Definition player.h:365
player::music_style
int music_style
Definition player.h:280
player::style
struct nation_style * style
Definition player.h:279
player::border_vision
bool border_vision
Definition player.h:327
player::phase_done
bool phase_done
Definition player.h:263
player::adv
struct adv_data * adv
Definition player.h:334
player::slot
struct player_slot * slot
Definition player.h:250
player::is_ready
bool is_ready
Definition player.h:262
player::history
int history
Definition player.h:312
player::user_turns
int user_turns
Definition player.h:256
player::debug
bv_debug debug
Definition player.h:332
player::last_war_action
int last_war_action
Definition player.h:270
player::rgb
struct rgbcolor * rgb
Definition player.h:308
player::unassigned_user
bool unassigned_user
Definition player.h:253
player::ai_phase_done
bool ai_phase_done
Definition player.h:264
requirement
Definition requirements.h:80
rgbcolor
Definition rgbcolor.h:33
server
Definition servers.h:29
team
Definition team.c:40
tile
Definition tile.h:49
unit_type
Definition unittype.h:481
unit
Definition unit.h:138
style.h
FALSE
#define FALSE
Definition support.h:47
tech.h
traits.h
unitlist.h
vision.h