Stop help talking about units' ability to attack relative to non-native
[freeciv.git] / server / srv_main.h
blob015224a0bf924e93dd20869d73f2d8e6f3d781a5
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__SRV_MAIN_H
14 #define FC__SRV_MAIN_H
16 /* utility */
17 #include "log.h" /* enum log_level */
18 #include "netintf.h"
20 /* common */
21 #include "fc_types.h"
22 #include "game.h"
24 struct conn_list;
26 struct server_arguments {
27 /* metaserver information */
28 bool metaserver_no_send;
29 char metaserver_addr[256];
30 char identity_name[256];
31 unsigned short int metaserver_port;
32 /* address this server is to listen on (NULL => INADDR_ANY) */
33 char *bind_addr;
34 /* this server's listen port */
35 int port;
36 /* address to bind when connecting to the metaserver (NULL => bind_addr) */
37 char *bind_meta_addr;
38 /* the log level */
39 enum log_level loglevel;
40 /* filenames */
41 char *log_filename;
42 char *ranklog_filename;
43 char load_filename[512]; /* FIXME: may not be long enough? use MAX_PATH? */
44 char *script_filename;
45 char *saves_pathname;
46 char *scenarios_pathname;
47 char serverid[256];
48 /* quit if there no players after a given time interval */
49 int quitidle;
50 /* exit the server on game ending */
51 bool exit_on_end;
52 /* authentication options */
53 bool fcdb_enabled; /* defaults to FALSE */
54 char *fcdb_conf; /* freeciv database configuration file */
55 bool auth_enabled; /* defaults to FALSE */
56 bool auth_allow_guests; /* defaults to FALSE */
57 bool auth_allow_newusers; /* defaults to FALSE */
58 enum announce_type announce;
59 int fatal_assertions; /* default to -1 (disabled). */
62 /* used in savegame values */
63 #define SPECENUM_NAME server_states
64 #define SPECENUM_VALUE0 S_S_INITIAL
65 #define SPECENUM_VALUE1 S_S_RUNNING
66 #define SPECENUM_VALUE2 S_S_OVER
67 #include "specenum_gen.h"
69 /* Structure for holding global server data.
71 * TODO: Lots more variables could be added here. */
72 extern struct civserver {
73 int playable_nations;
74 int nbarbarians;
76 /* this counter creates all the city and unit numbers used.
77 * arbitrarily starts at 101, but at 65K wraps to 1.
78 * use identity_number()
80 #define IDENTITY_NUMBER_SKIP (100)
81 unsigned short identity_number;
83 char game_identifier[MAX_LEN_GAME_IDENTIFIER];
84 } server;
87 void init_game_seed(void);
88 void srv_init(void);
89 void srv_main(void);
90 void server_quit(void);
91 void save_game_auto(const char *save_reason, enum autosave_type type);
93 enum server_states server_state(void);
94 void set_server_state(enum server_states newstate);
96 void check_for_full_turn_done(void);
97 bool check_for_game_over(void);
98 bool game_was_started(void);
100 bool server_packet_input(struct connection *pconn, void *packet, int type);
101 void start_game(void);
102 void save_game(const char *orig_filename, const char *save_reason,
103 bool scenario);
104 const char *pick_random_player_name(const struct nation_type *pnation);
105 void player_nation_defaults(struct player *pplayer, struct nation_type *pnation,
106 bool set_name);
107 void send_all_info(struct conn_list *dest);
109 void identity_number_release(int id);
110 void identity_number_reserve(int id);
111 int identity_number(void);
112 void server_game_init(void);
113 void server_game_free(void);
114 void aifill(int amount);
116 extern struct server_arguments srvarg;
118 extern bool force_end_of_sniff;
120 void update_nations_with_startpos(void);
121 #endif /* FC__SRV_MAIN_H */