Stop sharing requirement_unit_state_ereq().
[freeciv.git] / client / client_main.h
blobefc79559a4b108a4b667efc9ab62711e8acc9174
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.
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
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
20 #include "fc_types.h"
22 #include "packets.h" /* enum report_type */
23 #include "worklist.h"
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.
30 #define TIMER_INTERVAL (int)(real_timer_callback() * 1000)
32 /* Client states (see also enum server_states in srv_main.h).
33 * Changing those values don't break the network compatibility.
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.
43 enum client_states {
44 C_S_INITIAL,
45 C_S_DISCONNECTED,
46 C_S_PREPARING,
47 C_S_RUNNING,
48 C_S_OVER,
51 int client_main(int argc, char *argv[]);
53 void client_packet_input(void *packet, int type);
55 void send_report_request(enum report_type type);
56 void send_attribute_block_request(void);
57 void send_turn_done(void);
59 void user_ended_turn(void);
61 void set_client_state(enum client_states newstate);
62 enum client_states client_state(void);
63 void set_server_busy(bool busy);
64 bool is_server_busy(void);
66 void client_remove_cli_conn(struct connection *pconn);
67 void client_remove_all_cli_conn(void);
69 extern char *logfile;
70 extern char *scriptfile;
71 extern char *savefile;
72 extern char sound_plugin_name[512];
73 extern char sound_set_name[512];
74 extern char music_set_name[512];
75 extern char server_host[512];
76 extern char user_name[512];
77 extern char password[MAX_LEN_PASSWORD];
78 extern char metaserver[512];
79 extern int server_port;
80 extern bool auto_connect;
81 extern bool auto_spawn;
82 extern bool waiting_for_end_turn;
84 #ifdef FREECIV_DEBUG
85 extern bool hackless;
86 #endif /* FREECIV_DEBUG */
88 struct global_worklist_list; /* Defined in global_worklist.[ch]. */
90 /* Structure for holding global client data.
92 * TODO: Lots more variables could be added here. */
93 extern struct civclient {
94 /* this is the client's connection to the server */
95 struct connection conn;
96 struct global_worklist_list *worklists;
97 } client;
99 void wait_till_request_got_processed(int request_id);
100 bool client_is_observer(void);
101 bool client_is_global_observer(void);
102 int client_player_number(void);
103 bool client_has_player(void);
104 struct player *client_player(void);
105 void set_seconds_to_turndone(double seconds);
106 int get_seconds_to_turndone(void);
107 bool is_waiting_turn_change(void);
108 void start_turn_change_wait(void);
109 void stop_turn_change_wait(void);
110 int get_seconds_to_new_turn(void);
111 double real_timer_callback(void);
112 bool can_client_control(void);
113 bool can_client_issue_orders(void);
114 bool can_client_change_view(void);
115 bool can_meet_with_player(const struct player *pplayer);
116 bool can_intel_with_player(const struct player *pplayer);
118 void client_exit(void);
120 bool is_client_quitting(void);
121 void start_quitting(void);
123 /* Set in GUI code. */
124 extern const char * const gui_character_encoding;
125 extern const bool gui_use_transliteration;
127 #ifdef __cplusplus
129 #endif /* __cplusplus */
131 #endif /* FC__CLIENT_MAIN_H */