Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/client_main.h Source File

Freeciv-3.1

Loading...
Searching...
No Matches
client_main.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__CLIENT_MAIN_H
14#define FC__CLIENT_MAIN_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20#include "fc_types.h"
21
22#include "packets.h" /* enum report_type */
23#include "worklist.h"
24
25/*
26 * Every TIMER_INTERVAL milliseconds real_timer_callback() is
27 * called. TIMER_INTERVAL has to stay 500 because real_timer_callback
28 * also updates the timeout info.
29 */
30#define TIMER_INTERVAL (int)(real_timer_callback() * 1000)
31
32/* Client states (see also enum server_states in srv_main.h).
33 * Changing those values don't break the network compatibility.
34 *
35 * C_S_INITIAL: Client boot, only used once on program start.
36 * C_S_DISCONNECTED: The state when the client is not connected
37 * to a server. In this state, neither game nor ruleset
38 * is in effect.
39 * C_S_PREPARING: Connected in pregame. Game and ruleset are done.
40 * C_S_RUNNING: Connected ith game in progress.
41 * C_S_OVER: Connected with game over.
42 */
43 enum client_states {
44 C_S_INITIAL,
45 C_S_DISCONNECTED,
46 C_S_PREPARING,
47 C_S_RUNNING,
48 C_S_OVER,
49};
50
51int client_main(int argc, char *argv[], bool postpone_tileset);
52int default_tileset_select(void);
53
54void client_packet_input(void *packet, int type);
55
56void send_report_request(enum report_type type);
57void send_attribute_block_request(void);
58void send_turn_done(void);
59
60void user_ended_turn(void);
61
62void set_client_state(enum client_states newstate);
63enum client_states client_state(void);
64void set_server_busy(bool busy);
65bool is_server_busy(void);
66
67void client_remove_cli_conn(struct connection *pconn);
68void client_remove_all_cli_conn(void);
69
70extern char *logfile;
71extern char *scriptfile;
72extern char *savefile;
73extern char sound_plugin_name[512];
74extern char sound_set_name[512];
75extern char music_set_name[512];
76extern char server_host[512];
77extern char user_name[512];
78extern char fc_password[MAX_LEN_PASSWORD];
79extern char metaserver[512];
80extern int server_port;
81extern bool auto_connect;
82extern bool auto_spawn;
83extern bool waiting_for_end_turn;
84
85#ifdef FREECIV_DEBUG
86extern bool hackless;
87#endif /* FREECIV_DEBUG */
88
89struct global_worklist_list; /* Defined in global_worklist.[ch]. */
90
91/* Structure for holding global client data.
92 *
93 * TODO: Lots more variables could be added here. */
94 extern struct civclient {
95 /* this is the client's connection to the server */
96 struct connection conn;
97 struct global_worklist_list *worklists;
98} client;
99
100void wait_till_request_got_processed(int request_id);
101bool client_is_observer(void);
102bool client_is_global_observer(void);
103int client_player_number(void);
104bool client_has_player(void);
105
106#define client_player() client.conn.playing
107
108bool client_map_is_known_and_seen(const struct tile *ptile,
109 const struct player *pplayer,
110 enum vision_layer vlayer);
111void set_seconds_to_turndone(double seconds);
112int get_seconds_to_turndone(void);
113bool is_waiting_turn_change(void);
114void start_turn_change_wait(void);
115void stop_turn_change_wait(void);
116int get_seconds_to_new_turn(void);
117double real_timer_callback(void);
118bool can_client_control(void);
119bool can_client_issue_orders(void);
120bool can_client_change_view(void);
121bool can_meet_with_player(const struct player *pplayer);
122bool can_intel_with_player(const struct player *pplayer);
123const char *title_for_player(const struct player *pplayer,
124 char *buf, size_t buf_len);
125
126void client_exit(int return_value);
127
128bool is_client_quitting(void);
129void start_quitting(void);
130
131/* Set in GUI code. */
132extern const char * const gui_character_encoding;
133extern const bool gui_use_transliteration;
134
135#ifdef __cplusplus
136}
137#endif /* __cplusplus */
138
139#endif /* FC__CLIENT_MAIN_H */
music_set_name
char music_set_name[512]
Definition client_main.c:139
client_remove_all_cli_conn
void client_remove_all_cli_conn(void)
Definition client_main.c:1055
is_client_quitting
bool is_client_quitting(void)
Definition client_main.c:1637
can_client_control
bool can_client_control(void)
Definition client_main.c:1254
start_turn_change_wait
void start_turn_change_wait(void)
Definition client_main.c:1137
client_is_global_observer
bool client_is_global_observer(void)
Definition client_main.c:1346
client_remove_cli_conn
void client_remove_cli_conn(struct connection *pconn)
Definition client_main.c:1037
get_seconds_to_new_turn
int get_seconds_to_new_turn(void)
Definition client_main.c:1173
get_seconds_to_turndone
int get_seconds_to_turndone(void)
Definition client_main.c:1159
client_is_observer
bool client_is_observer(void)
Definition client_main.c:1086
metaserver
char metaserver[512]
Definition client_main.c:143
user_name
char user_name[512]
Definition client_main.c:141
can_meet_with_player
bool can_meet_with_player(const struct player *pplayer)
Definition client_main.c:1275
client_packet_input
void client_packet_input(void *packet, int type)
Definition client_main.c:777
real_timer_callback
double real_timer_callback(void)
Definition client_main.c:1183
client_map_is_known_and_seen
bool client_map_is_known_and_seen(const struct tile *ptile, const struct player *pplayer, enum vision_layer vlayer)
Definition client_main.c:1374
waiting_for_end_turn
bool waiting_for_end_turn
Definition client_main.c:154
logfile
char * logfile
Definition client_main.c:133
send_attribute_block_request
void send_attribute_block_request(void)
Definition client_main.c:1069
client_states
client_states
Definition client_main.h:43
C_S_PREPARING
@ C_S_PREPARING
Definition client_main.h:46
C_S_DISCONNECTED
@ C_S_DISCONNECTED
Definition client_main.h:45
C_S_INITIAL
@ C_S_INITIAL
Definition client_main.h:44
C_S_RUNNING
@ C_S_RUNNING
Definition client_main.h:47
C_S_OVER
@ C_S_OVER
Definition client_main.h:48
client_main
int client_main(int argc, char *argv[], bool postpone_tileset)
Definition client_main.c:344
server_host
char server_host[512]
Definition client_main.c:140
can_intel_with_player
bool can_intel_with_player(const struct player *pplayer)
Definition client_main.c:1286
client_player_number
int client_player_number(void)
Definition client_main.c:1354
stop_turn_change_wait
void stop_turn_change_wait(void)
Definition client_main.c:1149
set_server_busy
void set_server_busy(bool busy)
Definition client_main.c:1324
user_ended_turn
void user_ended_turn(void)
Definition client_main.c:801
send_turn_done
void send_turn_done(void)
Definition client_main.c:809
client
struct civclient client
auto_connect
bool auto_connect
Definition client_main.c:145
client_state
enum client_states client_state(void)
Definition client_main.c:1029
is_waiting_turn_change
bool is_waiting_turn_change(void)
Definition client_main.c:1129
sound_plugin_name
char sound_plugin_name[512]
Definition client_main.c:137
auto_spawn
bool auto_spawn
Definition client_main.c:146
scriptfile
char * scriptfile
Definition client_main.c:134
set_seconds_to_turndone
void set_seconds_to_turndone(double seconds)
Definition client_main.c:1113
send_report_request
void send_report_request(enum report_type type)
Definition client_main.c:839
sound_set_name
char sound_set_name[512]
Definition client_main.c:138
can_client_issue_orders
bool can_client_issue_orders(void)
Definition client_main.c:1265
start_quitting
void start_quitting(void)
Definition client_main.c:1645
client_has_player
bool client_has_player(void)
Definition client_main.c:1365
gui_character_encoding
const char *const gui_character_encoding
Definition gui_main.c:160
is_server_busy
bool is_server_busy(void)
Definition client_main.c:1338
title_for_player
const char * title_for_player(const struct player *pplayer, char *buf, size_t buf_len)
Definition client_main.c:1297
client_exit
void client_exit(int return_value)
Definition client_main.c:728
fc_password
char fc_password[MAX_LEN_PASSWORD]
Definition client_main.c:142
default_tileset_select
int default_tileset_select(void)
Definition client_main.c:322
wait_till_request_got_processed
void wait_till_request_got_processed(int request_id)
Definition client_main.c:1077
server_port
int server_port
Definition client_main.c:144
gui_use_transliteration
const bool gui_use_transliteration
Definition gui_main.c:161
set_client_state
void set_client_state(enum client_states newstate)
Definition client_main.c:847
savefile
char * savefile
Definition client_main.c:135
can_client_change_view
bool can_client_change_view(void)
Definition client_main.c:1313
MAX_LEN_PASSWORD
#define MAX_LEN_PASSWORD
Definition connection.h:58
fc_types.h
type
GType type
Definition repodlgs.c:1312
packets.h
report_type
report_type
Definition packets.h:73
civclient
Definition client_main.h:94
civclient::worklists
struct global_worklist_list * worklists
Definition client_main.h:97
civclient::conn
struct connection conn
Definition client_main.h:96
connection
Definition connection.h:141
player
Definition player.h:249
tile
Definition tile.h:49
worklist.h