Freeciv-3.2: /fast/freeciv/nightly/S3_2/server/plrhand.h Source File

Freeciv-3.2

Loading...
Searching...
No Matches
plrhand.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__PLRHAND_H
14#define FC__PLRHAND_H
15
16struct connection;
17struct conn_list;
18struct nation_list;
19struct nation_type;
20struct player;
21struct rgbcolor;
22struct section_file;
23struct unit_list;
24
25 enum plr_info_level { INFO_MINIMUM, INFO_MEETING, INFO_EMBASSY, INFO_FULL };
26
27struct player *server_create_player(int player_id, const char *ai_tname,
28 struct rgbcolor *prgbcolor,
29 bool allow_ai_type_fallbacking);
30const struct rgbcolor *player_preferred_color(struct player *pplayer);
31bool player_color_changeable(const struct player *pplayer, const char **reason);
32void assign_player_colors(void);
33void server_player_set_color(struct player *pplayer,
34 const struct rgbcolor *prgbcolor);
35const char *player_color_ftstr(struct player *pplayer);
36void server_player_init(struct player *pplayer, bool initmap,
37 bool needs_team);
38void give_midgame_initial_units(struct player *pplayer, struct tile *ptile);
39void server_remove_player(struct player *pplayer);
40void kill_player(struct player *pplayer);
41void update_revolution(struct player *pplayer);
42void government_change(struct player *pplayer, struct government *gov,
43 bool revolution_finished);
44void player_loot_player(struct player *pvictor, struct player *pvictim);
45int revolution_length(struct government *gov, struct player *plr);
46void update_capital(struct player *pplayer);
47
48void player_limit_to_max_rates(struct player *pplayer);
49
50void server_player_set_name(struct player *pplayer, const char *name);
51bool server_player_set_name_full(const struct connection *caller,
52 struct player *pplayer,
53 const struct nation_type *pnation,
54 const char *name,
55 char *error_buf, size_t error_buf_len);
56
57struct nation_type *pick_a_nation(const struct nation_list *choices,
58 bool ignore_conflicts,
59 bool needs_startpos,
60 enum barbarian_type barb_type);
61bool nation_is_in_current_set(const struct nation_type *pnation);
62bool client_can_pick_nation(const struct nation_type *nation);
63void count_playable_nations(void);
64void send_nation_availability(struct conn_list *dest, bool nationset_change);
65void fit_nationset_to_players(void);
66
67/* Iterate over nations in the currently selected set.
68 * Does not filter on playability or anything else. */
69#define allowed_nations_iterate(pnation) \
70 nations_iterate(pnation) { \
71 if (nation_is_in_current_set(pnation)) {
72
73#define allowed_nations_iterate_end \
74 } \
75 } nations_iterate_end
76
77void check_player_max_rates(struct player *pplayer);
78void make_contact(struct player *pplayer1, struct player *pplayer2,
79 struct tile *ptile);
80void maybe_make_contact(struct tile *ptile, struct player *pplayer);
81void enter_war(struct player *pplayer, struct player *pplayer2);
82void player_update_last_war_action(struct player *pplayer);
83
84void player_info_freeze(void);
85void player_info_thaw(void);
86
87void send_player_all_c(struct player *src, struct conn_list *dest);
88void send_player_info_c(struct player *src, struct conn_list *dest);
89void send_player_diplstate_c(struct player *src, struct conn_list *dest);
90
91struct conn_list *player_reply_dest(struct player *pplayer);
92
93void shuffle_players(void);
94void set_shuffled_players(int *shuffled_players);
95struct player *shuffled_player(int i);
96void reset_all_start_commands(bool plrchange);
97
98#define shuffled_players_iterate(NAME_pplayer)\
99do {\
100 int MY_i;\
101 struct player *NAME_pplayer;\
102 log_debug("shuffled_players_iterate @ %s line %d",\
103 __FILE__, __FC_LINE__);\
104 for (MY_i = 0; MY_i < player_slot_count(); MY_i++) {\
105 NAME_pplayer = shuffled_player(MY_i);\
106 if (NAME_pplayer != NULL) {\
107
108#define shuffled_players_iterate_end\
109 }\
110 }\
111} while (FALSE)
112
113#define phase_players_iterate(pplayer)\
114do {\
115 shuffled_players_iterate(pplayer) {\
116 if (is_player_phase(pplayer, game.info.phase)) {
117
118#define phase_players_iterate_end\
119 }\
120 } shuffled_players_iterate_end;\
121} while (FALSE);
122
123#define alive_phase_players_iterate(pplayer) \
124do { \
125 phase_players_iterate(pplayer) { \
126 if (pplayer->is_alive) {
127
128#define alive_phase_players_iterate_end \
129 } \
130 } phase_players_iterate_end \
131} while (FALSE);
132
133bool civil_war_possible(struct player *pplayer, bool conquering_city,
134 bool honour_server_option);
135bool civil_war_triggered(struct player *pplayer);
136struct player *civil_war(struct player *pplayer);
137
138void update_players_after_alliance_breakup(struct player *pplayer,
139 struct player *pplayer2,
140 const struct unit_list
141 *pplayer_seen_units,
142 const struct unit_list
143 *pplayer2_seen_units);
144
145/* Player counts, total player_count() is in common/player.c */
146int barbarian_count(void);
147int normal_player_count(void);
148
149void player_status_add(struct player *plr, enum player_status status);
150bool player_status_check(struct player *plr, enum player_status status);
151void player_status_reset(struct player *plr);
152
153const char *player_delegation_get(const struct player *pplayer);
154void player_delegation_set(struct player *pplayer, const char *username);
155bool player_delegation_active(const struct player *pplayer);
156
157void send_delegation_info(const struct connection *pconn);
158
159struct player *player_by_user_delegated(const char *name);
160
161/* player colors */
162void playercolor_init(void);
163void playercolor_free(void);
164
165int playercolor_count(void);
166void playercolor_add(struct rgbcolor *prgbcolor);
167struct rgbcolor *playercolor_get(int id);
168
169void player_set_to_ai_mode(struct player *pplayer,
170 enum ai_level skill_level);
171void player_set_under_human_control(struct player *pplayer);
172
173void update_national_activities(struct player *pplayer, int old_gold);
174
175#endif /* FC__PLRHAND_H */
incite_cost
char * incite_cost
Definition comments.c:74
name
const char * name
Definition inputfile.c:127
send_nation_availability
void send_nation_availability(struct conn_list *dest, bool nationset_change)
Definition plrhand.c:2637
server_player_set_name
void server_player_set_name(struct player *pplayer, const char *name)
Definition plrhand.c:2263
barbarian_count
int barbarian_count(void)
Definition plrhand.c:3192
send_player_all_c
void send_player_all_c(struct player *src, struct conn_list *dest)
Definition plrhand.c:1125
server_create_player
struct player * server_create_player(int player_id, const char *ai_tname, struct rgbcolor *prgbcolor, bool allow_ai_type_fallbacking)
Definition plrhand.c:1889
client_can_pick_nation
bool client_can_pick_nation(const struct nation_type *nation)
Definition plrhand.c:2609
player_preferred_color
const struct rgbcolor * player_preferred_color(struct player *pplayer)
Definition plrhand.c:1669
player_update_last_war_action
void player_update_last_war_action(struct player *pplayer)
Definition plrhand.c:863
normal_player_count
int normal_player_count(void)
Definition plrhand.c:3200
player_set_under_human_control
void player_set_under_human_control(struct player *pplayer)
Definition plrhand.c:3447
playercolor_free
void playercolor_free(void)
Definition plrhand.c:3337
player_status_check
bool player_status_check(struct player *plr, enum player_status status)
Definition plrhand.c:3216
give_midgame_initial_units
void give_midgame_initial_units(struct player *pplayer, struct tile *ptile)
Definition plrhand.c:1865
player_limit_to_max_rates
void player_limit_to_max_rates(struct player *pplayer)
Definition plrhand.c:2052
civil_war_triggered
bool civil_war_triggered(struct player *pplayer)
Definition plrhand.c:2951
server_player_set_color
void server_player_set_color(struct player *pplayer, const struct rgbcolor *prgbcolor)
Definition plrhand.c:1818
player_set_to_ai_mode
void player_set_to_ai_mode(struct player *pplayer, enum ai_level skill_level)
Definition plrhand.c:3425
server_player_set_name_full
bool server_player_set_name_full(const struct connection *caller, struct player *pplayer, const struct nation_type *pnation, const char *name, char *error_buf, size_t error_buf_len)
Definition plrhand.c:2163
player_delegation_active
bool player_delegation_active(const struct player *pplayer)
Definition plrhand.c:3262
player_info_thaw
void player_info_thaw(void)
Definition plrhand.c:1106
player_info_freeze
void player_info_freeze(void)
Definition plrhand.c:1097
player_by_user_delegated
struct player * player_by_user_delegated(const char *name)
Definition plrhand.c:3313
maybe_make_contact
void maybe_make_contact(struct tile *ptile, struct player *pplayer)
Definition plrhand.c:2357
pick_a_nation
struct nation_type * pick_a_nation(const struct nation_list *choices, bool ignore_conflicts, bool needs_startpos, enum barbarian_type barb_type)
Definition plrhand.c:2448
playercolor_init
void playercolor_init(void)
Definition plrhand.c:3328
check_player_max_rates
void check_player_max_rates(struct player *pplayer)
Definition plrhand.c:774
kill_player
void kill_player(struct player *pplayer)
Definition plrhand.c:126
player_color_ftstr
const char * player_color_ftstr(struct player *pplayer)
Definition plrhand.c:1838
send_player_info_c
void send_player_info_c(struct player *src, struct conn_list *dest)
Definition plrhand.c:1142
set_shuffled_players
void set_shuffled_players(int *shuffled_players)
Definition plrhand.c:2398
civil_war
struct player * civil_war(struct player *pplayer)
Definition plrhand.c:3001
player_status_reset
void player_status_reset(struct player *plr)
Definition plrhand.c:3224
send_delegation_info
void send_delegation_info(const struct connection *pconn)
Definition plrhand.c:3270
update_national_activities
void update_national_activities(struct player *pplayer, int old_gold)
Definition plrhand.c:3467
player_reply_dest
struct conn_list * player_reply_dest(struct player *pplayer)
Definition plrhand.c:1589
update_players_after_alliance_breakup
void update_players_after_alliance_breakup(struct player *pplayer, struct player *pplayer2, const struct unit_list *pplayer_seen_units, const struct unit_list *pplayer2_seen_units)
Definition plrhand.c:802
civil_war_possible
bool civil_war_possible(struct player *pplayer, bool conquering_city, bool honour_server_option)
Definition plrhand.c:2904
playercolor_get
struct rgbcolor * playercolor_get(int id)
Definition plrhand.c:3366
player_delegation_set
void player_delegation_set(struct player *pplayer, const char *username)
Definition plrhand.c:3246
plr_info_level
plr_info_level
Definition plrhand.h:25
INFO_MEETING
@ INFO_MEETING
Definition plrhand.h:25
INFO_MINIMUM
@ INFO_MINIMUM
Definition plrhand.h:25
INFO_EMBASSY
@ INFO_EMBASSY
Definition plrhand.h:25
INFO_FULL
@ INFO_FULL
Definition plrhand.h:25
playercolor_count
int playercolor_count(void)
Definition plrhand.c:3376
shuffle_players
void shuffle_players(void)
Definition plrhand.c:2373
server_remove_player
void server_remove_player(struct player *pplayer)
Definition plrhand.c:1938
government_change
void government_change(struct player *pplayer, struct government *gov, bool revolution_finished)
Definition plrhand.c:337
server_player_init
void server_player_init(struct player *pplayer, bool initmap, bool needs_team)
Definition plrhand.c:1614
make_contact
void make_contact(struct player *pplayer1, struct player *pplayer2, struct tile *ptile)
Definition plrhand.c:2298
player_status_add
void player_status_add(struct player *plr, enum player_status status)
Definition plrhand.c:3208
playercolor_add
void playercolor_add(struct rgbcolor *prgbcolor)
Definition plrhand.c:3356
update_capital
void update_capital(struct player *pplayer)
Definition plrhand.c:729
count_playable_nations
void count_playable_nations(void)
Definition plrhand.c:2594
player_color_changeable
bool player_color_changeable(const struct player *pplayer, const char **reason)
Definition plrhand.c:1712
assign_player_colors
void assign_player_colors(void)
Definition plrhand.c:1729
send_player_diplstate_c
void send_player_diplstate_c(struct player *src, struct conn_list *dest)
Definition plrhand.c:1208
shuffled_player
struct player * shuffled_player(int i)
Definition plrhand.c:2416
player_loot_player
void player_loot_player(struct player *pvictor, struct player *pvictim)
Definition plrhand.c:411
player_delegation_get
const char * player_delegation_get(const struct player *pplayer)
Definition plrhand.c:3233
nation_is_in_current_set
bool nation_is_in_current_set(const struct nation_type *pnation)
Definition plrhand.c:2585
enter_war
void enter_war(struct player *pplayer, struct player *pplayer2)
Definition plrhand.c:846
revolution_length
int revolution_length(struct government *gov, struct player *plr)
Definition plrhand.c:550
fit_nationset_to_players
void fit_nationset_to_players(void)
Definition plrhand.c:2654
reset_all_start_commands
void reset_all_start_commands(bool plrchange)
Definition plrhand.c:2719
update_revolution
void update_revolution(struct player *pplayer)
Definition plrhand.c:670
connection
Definition connection.h:136
government
Definition government.h:52
nation_type
Definition nation.h:98
nation_type::barb_type
enum barbarian_type barb_type
Definition nation.h:110
player
Definition player.h:247
player::status
bv_pstatus status
Definition player.h:320
player::username
char username[MAX_LEN_NAME]
Definition player.h:250
rgbcolor
Definition rgbcolor.h:33
section_file
Definition section_file.h:36
tile
Definition tile.h:50