Freeciv-3.1: /fast/freeciv/nightly/S3_1/server/plrhand.h Source File

Freeciv-3.1

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_type;
19struct player;
20struct rgbcolor;
21struct section_file;
22struct unit_list;
23
24 enum plr_info_level { INFO_MINIMUM, INFO_MEETING, INFO_EMBASSY, INFO_FULL };
25
26struct player *server_create_player(int player_id, const char *ai_tname,
27 struct rgbcolor *prgbcolor,
28 bool allow_ai_type_fallbacking);
29const struct rgbcolor *player_preferred_color(struct player *pplayer);
30bool player_color_changeable(const struct player *pplayer, const char **reason);
31void assign_player_colors(void);
32void server_player_set_color(struct player *pplayer,
33 const struct rgbcolor *prgbcolor);
34const char *player_color_ftstr(struct player *pplayer);
35void server_player_init(struct player *pplayer, bool initmap,
36 bool needs_team);
37void give_midgame_initial_units(struct player *pplayer, struct tile *ptile);
38void server_remove_player(struct player *pplayer);
39void kill_player(struct player *pplayer);
40void update_revolution(struct player *pplayer);
41void government_change(struct player *pplayer, struct government *gov,
42 bool revolution_finished);
43int revolution_length(struct government *gov, struct player *plr);
44void update_capital(struct player *pplayer);
45
46void player_limit_to_max_rates(struct player *pplayer);
47
48void server_player_set_name(struct player *pplayer, const char *name);
49bool server_player_set_name_full(const struct connection *caller,
50 struct player *pplayer,
51 const struct nation_type *pnation,
52 const char *name,
53 char *error_buf, size_t error_buf_len);
54
55struct nation_type *pick_a_nation(const struct nation_list *choices,
56 bool ignore_conflicts,
57 bool needs_startpos,
58 enum barbarian_type barb_type);
59bool nation_is_in_current_set(const struct nation_type *pnation);
60bool client_can_pick_nation(const struct nation_type *nation);
61void count_playable_nations(void);
62void send_nation_availability(struct conn_list *dest, bool nationset_change);
63void fit_nationset_to_players(void);
64
65/* Iterate over nations in the currently selected set.
66 * Does not filter on playability or anything else. */
67#define allowed_nations_iterate(pnation) \
68 nations_iterate(pnation) { \
69 if (nation_is_in_current_set(pnation)) {
70
71#define allowed_nations_iterate_end \
72 } \
73 } nations_iterate_end
74
75void check_player_max_rates(struct player *pplayer);
76void make_contact(struct player *pplayer1, struct player *pplayer2,
77 struct tile *ptile);
78void maybe_make_contact(struct tile *ptile, struct player *pplayer);
79void enter_war(struct player *pplayer, struct player *pplayer2);
80void player_update_last_war_action(struct player *pplayer);
81
82void player_info_freeze(void);
83void player_info_thaw(void);
84
85void send_player_all_c(struct player *src, struct conn_list *dest);
86void send_player_info_c(struct player *src, struct conn_list *dest);
87void send_player_diplstate_c(struct player *src, struct conn_list *dest);
88
89struct conn_list *player_reply_dest(struct player *pplayer);
90
91void shuffle_players(void);
92void set_shuffled_players(int *shuffled_players);
93struct player *shuffled_player(int i);
94void reset_all_start_commands(bool plrchange);
95
96#define shuffled_players_iterate(NAME_pplayer)\
97do {\
98 int MY_i;\
99 struct player *NAME_pplayer;\
100 log_debug("shuffled_players_iterate @ %s line %d",\
101 __FILE__, __FC_LINE__);\
102 for (MY_i = 0; MY_i < player_slot_count(); MY_i++) {\
103 NAME_pplayer = shuffled_player(MY_i);\
104 if (NAME_pplayer != NULL) {\
105
106#define shuffled_players_iterate_end\
107 }\
108 }\
109} while (FALSE)
110
111#define phase_players_iterate(pplayer)\
112do {\
113 shuffled_players_iterate(pplayer) {\
114 if (is_player_phase(pplayer, game.info.phase)) {
115
116#define phase_players_iterate_end\
117 }\
118 } shuffled_players_iterate_end;\
119} while (FALSE);
120
121#define alive_phase_players_iterate(pplayer) \
122do { \
123 phase_players_iterate(pplayer) { \
124 if (pplayer->is_alive) {
125
126#define alive_phase_players_iterate_end \
127 } \
128 } phase_players_iterate_end \
129} while (FALSE);
130
131bool civil_war_possible(struct player *pplayer, bool conquering_city,
132 bool honour_server_option);
133bool civil_war_triggered(struct player *pplayer);
134struct player *civil_war(struct player *pplayer);
135
136void update_players_after_alliance_breakup(struct player *pplayer,
137 struct player *pplayer2,
138 const struct unit_list
139 *pplayer_seen_units,
140 const struct unit_list
141 *pplayer2_seen_units);
142
143/* Player counts, total player_count() is in common/player.c */
144int barbarian_count(void);
145int normal_player_count(void);
146
147void player_status_add(struct player *plr, enum player_status status);
148bool player_status_check(struct player *plr, enum player_status status);
149void player_status_reset(struct player *plr);
150
151const char *player_delegation_get(const struct player *pplayer);
152void player_delegation_set(struct player *pplayer, const char *username);
153bool player_delegation_active(const struct player *pplayer);
154
155void send_delegation_info(const struct connection *pconn);
156
157struct player *player_by_user_delegated(const char *name);
158
159/* player colors */
160void playercolor_init(void);
161void playercolor_free(void);
162
163int playercolor_count(void);
164void playercolor_add(struct rgbcolor *prgbcolor);
165struct rgbcolor *playercolor_get(int id);
166
167void player_set_to_ai_mode(struct player *pplayer,
168 enum ai_level skill_level);
169void player_set_under_human_control(struct player *pplayer);
170
171#endif /* FC__PLRHAND_H */
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:2471
server_player_set_name
void server_player_set_name(struct player *pplayer, const char *name)
Definition plrhand.c:2097
barbarian_count
int barbarian_count(void)
Definition plrhand.c:3026
send_player_all_c
void send_player_all_c(struct player *src, struct conn_list *dest)
Definition plrhand.c:983
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:1723
client_can_pick_nation
bool client_can_pick_nation(const struct nation_type *nation)
Definition plrhand.c:2443
player_preferred_color
const struct rgbcolor * player_preferred_color(struct player *pplayer)
Definition plrhand.c:1503
player_update_last_war_action
void player_update_last_war_action(struct player *pplayer)
Definition plrhand.c:746
normal_player_count
int normal_player_count(void)
Definition plrhand.c:3034
player_set_under_human_control
void player_set_under_human_control(struct player *pplayer)
Definition plrhand.c:3281
playercolor_free
void playercolor_free(void)
Definition plrhand.c:3171
player_status_check
bool player_status_check(struct player *plr, enum player_status status)
Definition plrhand.c:3050
give_midgame_initial_units
void give_midgame_initial_units(struct player *pplayer, struct tile *ptile)
Definition plrhand.c:1699
player_limit_to_max_rates
void player_limit_to_max_rates(struct player *pplayer)
Definition plrhand.c:1886
civil_war_triggered
bool civil_war_triggered(struct player *pplayer)
Definition plrhand.c:2785
server_player_set_color
void server_player_set_color(struct player *pplayer, const struct rgbcolor *prgbcolor)
Definition plrhand.c:1652
player_set_to_ai_mode
void player_set_to_ai_mode(struct player *pplayer, enum ai_level skill_level)
Definition plrhand.c:3259
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:1997
player_delegation_active
bool player_delegation_active(const struct player *pplayer)
Definition plrhand.c:3096
player_info_thaw
void player_info_thaw(void)
Definition plrhand.c:964
player_info_freeze
void player_info_freeze(void)
Definition plrhand.c:955
player_by_user_delegated
struct player * player_by_user_delegated(const char *name)
Definition plrhand.c:3147
maybe_make_contact
void maybe_make_contact(struct tile *ptile, struct player *pplayer)
Definition plrhand.c:2191
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:2282
playercolor_init
void playercolor_init(void)
Definition plrhand.c:3162
check_player_max_rates
void check_player_max_rates(struct player *pplayer)
Definition plrhand.c:657
kill_player
void kill_player(struct player *pplayer)
Definition plrhand.c:125
player_color_ftstr
const char * player_color_ftstr(struct player *pplayer)
Definition plrhand.c:1672
send_player_info_c
void send_player_info_c(struct player *src, struct conn_list *dest)
Definition plrhand.c:1000
set_shuffled_players
void set_shuffled_players(int *shuffled_players)
Definition plrhand.c:2232
civil_war
struct player * civil_war(struct player *pplayer)
Definition plrhand.c:2835
player_status_reset
void player_status_reset(struct player *plr)
Definition plrhand.c:3058
send_delegation_info
void send_delegation_info(const struct connection *pconn)
Definition plrhand.c:3104
player_reply_dest
struct conn_list * player_reply_dest(struct player *pplayer)
Definition plrhand.c:1425
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:685
civil_war_possible
bool civil_war_possible(struct player *pplayer, bool conquering_city, bool honour_server_option)
Definition plrhand.c:2738
playercolor_get
struct rgbcolor * playercolor_get(int id)
Definition plrhand.c:3200
player_delegation_set
void player_delegation_set(struct player *pplayer, const char *username)
Definition plrhand.c:3080
plr_info_level
plr_info_level
Definition plrhand.h:24
INFO_MEETING
@ INFO_MEETING
Definition plrhand.h:24
INFO_MINIMUM
@ INFO_MINIMUM
Definition plrhand.h:24
INFO_EMBASSY
@ INFO_EMBASSY
Definition plrhand.h:24
INFO_FULL
@ INFO_FULL
Definition plrhand.h:24
playercolor_count
int playercolor_count(void)
Definition plrhand.c:3210
shuffle_players
void shuffle_players(void)
Definition plrhand.c:2207
server_remove_player
void server_remove_player(struct player *pplayer)
Definition plrhand.c:1772
government_change
void government_change(struct player *pplayer, struct government *gov, bool revolution_finished)
Definition plrhand.c:336
server_player_init
void server_player_init(struct player *pplayer, bool initmap, bool needs_team)
Definition plrhand.c:1450
make_contact
void make_contact(struct player *pplayer1, struct player *pplayer2, struct tile *ptile)
Definition plrhand.c:2132
player_status_add
void player_status_add(struct player *plr, enum player_status status)
Definition plrhand.c:3042
playercolor_add
void playercolor_add(struct rgbcolor *prgbcolor)
Definition plrhand.c:3190
update_capital
void update_capital(struct player *pplayer)
Definition plrhand.c:612
count_playable_nations
void count_playable_nations(void)
Definition plrhand.c:2428
player_color_changeable
bool player_color_changeable(const struct player *pplayer, const char **reason)
Definition plrhand.c:1546
assign_player_colors
void assign_player_colors(void)
Definition plrhand.c:1563
send_player_diplstate_c
void send_player_diplstate_c(struct player *src, struct conn_list *dest)
Definition plrhand.c:1059
shuffled_player
struct player * shuffled_player(int i)
Definition plrhand.c:2250
player_delegation_get
const char * player_delegation_get(const struct player *pplayer)
Definition plrhand.c:3067
nation_is_in_current_set
bool nation_is_in_current_set(const struct nation_type *pnation)
Definition plrhand.c:2419
enter_war
void enter_war(struct player *pplayer, struct player *pplayer2)
Definition plrhand.c:729
revolution_length
int revolution_length(struct government *gov, struct player *plr)
Definition plrhand.c:438
fit_nationset_to_players
void fit_nationset_to_players(void)
Definition plrhand.c:2488
reset_all_start_commands
void reset_all_start_commands(bool plrchange)
Definition plrhand.c:2553
update_revolution
void update_revolution(struct player *pplayer)
Definition plrhand.c:553
connection
Definition connection.h:141
government
Definition government.h:52
nation_type
Definition nation.h:97
nation_type::barb_type
enum barbarian_type barb_type
Definition nation.h:109
player
Definition player.h:249
player::status
bv_pstatus status
Definition player.h:318
player::username
char username[MAX_LEN_NAME]
Definition player.h:252
rgbcolor
Definition rgbcolor.h:33
section_file
Definition section_file.h:36
tile
Definition tile.h:49