Freeciv-3.2
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 */
50
51int client_main(int argc, char *argv[], bool postpone_tileset);
53
54void client_packet_input(void *packet, int type);
55
58void send_turn_done(void);
59
60void user_ended_turn(void);
61
64void set_server_busy(bool busy);
65bool is_server_busy(void);
66
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. */
94extern struct civclient {
95 /* this is the client's connection to the server */
99
101bool client_is_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);
113bool is_waiting_turn_change(void);
114void start_turn_change_wait(void);
115void stop_turn_change_wait(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
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 */
char music_set_name[512]
void client_remove_all_cli_conn(void)
bool is_client_quitting(void)
bool can_client_control(void)
void start_turn_change_wait(void)
void fc__noreturn client_exit(int return_value)
bool client_is_global_observer(void)
void client_remove_cli_conn(struct connection *pconn)
int get_seconds_to_new_turn(void)
int get_seconds_to_turndone(void)
bool client_is_observer(void)
char metaserver[512]
char user_name[512]
bool can_meet_with_player(const struct player *pplayer)
void client_packet_input(void *packet, int type)
double real_timer_callback(void)
bool client_map_is_known_and_seen(const struct tile *ptile, const struct player *pplayer, enum vision_layer vlayer)
bool waiting_for_end_turn
char * logfile
void send_attribute_block_request(void)
client_states
Definition client_main.h:43
@ C_S_PREPARING
Definition client_main.h:46
@ C_S_DISCONNECTED
Definition client_main.h:45
@ C_S_INITIAL
Definition client_main.h:44
@ C_S_RUNNING
Definition client_main.h:47
@ C_S_OVER
Definition client_main.h:48
int client_main(int argc, char *argv[], bool postpone_tileset)
char server_host[512]
bool can_intel_with_player(const struct player *pplayer)
int client_player_number(void)
void stop_turn_change_wait(void)
void set_server_busy(bool busy)
void user_ended_turn(void)
void send_turn_done(void)
struct civclient client
bool auto_connect
enum client_states client_state(void)
bool is_waiting_turn_change(void)
char sound_plugin_name[512]
bool auto_spawn
char * scriptfile
void set_seconds_to_turndone(double seconds)
void send_report_request(enum report_type type)
char sound_set_name[512]
bool can_client_issue_orders(void)
void start_quitting(void)
bool client_has_player(void)
const char *const gui_character_encoding
Definition gui_main.c:161
bool is_server_busy(void)
const char * title_for_player(const struct player *pplayer, char *buf, size_t buf_len)
char fc_password[MAX_LEN_PASSWORD]
int default_tileset_select(void)
void wait_till_request_got_processed(int request_id)
int server_port
const bool gui_use_transliteration
Definition gui_main.c:162
void set_client_state(enum client_states newstate)
char * savefile
bool can_client_change_view(void)
char * incite_cost
Definition comments.c:75
#define MAX_LEN_PASSWORD
Definition conn_types.h:31
report_type
Definition conn_types.h:49
GType type
Definition repodlgs.c:1313
struct global_worklist_list * worklists
Definition client_main.h:97
struct connection conn
Definition client_main.h:96
Definition tile.h:50
#define fc__noreturn
Definition support.h:125