Freeciv21
Develop your civilization from humble roots to a global empire
srv_main.cpp File Reference
#include <fc_config.h>
#include <cstring>
#include <QCoreApplication>
#include <QDebug>
#include <QElapsedTimer>
#include "bitvector.h"
#include "bugs.h"
#include "fciconv.h"
#include "fcintl.h"
#include "log.h"
#include "rand.h"
#include "support.h"
#include "timing.h"
#include "citymap.h"
#include "achievements.h"
#include "calendar.h"
#include "city.h"
#include "culture.h"
#include "dataio_raw.h"
#include "effects.h"
#include "events.h"
#include "fc_interface.h"
#include "game.h"
#include "map.h"
#include "mapimg.h"
#include "multipliers.h"
#include "nation.h"
#include "packets.h"
#include "player.h"
#include "research.h"
#include "style.h"
#include "tech.h"
#include "unit.h"
#include "unitlist.h"
#include "victory.h"
#include "aiiface.h"
#include "animals.h"
#include "auth.h"
#include "barbarian.h"
#include "cityhand.h"
#include "citytools.h"
#include "cityturn.h"
#include "connecthand.h"
#include "console.h"
#include "diplhand.h"
#include "edithand.h"
#include "fcdb.h"
#include "gamehand.h"
#include "maphand.h"
#include "meta.h"
#include "notify.h"
#include "plrhand.h"
#include "report.h"
#include "ruleset.h"
#include "sanitycheck.h"
#include "score.h"
#include "sernet.h"
#include "server_settings.h"
#include "settings.h"
#include "spacerace.h"
#include "srv_log.h"
#include "stdinhand.h"
#include "techtools.h"
#include "unittools.h"
#include "voting.h"
#include "advbuilding.h"
#include "advdata.h"
#include "advspace.h"
#include "autosettlers.h"
#include "infracache.h"
#include "savemain.h"
#include "script_server.h"
#include "mapgen.h"
#include "mapgen_utils.h"
#include "aitraits.h"
#include "difficulty.h"
#include "srv_main.h"

Go to the source code of this file.

Macros

#define IDENTITY_NUMBER_SIZE   250000
 

Functions

static void announce_player (struct player *pplayer)
 Announce what nation player rules to everyone. More...
 
static void handle_observer_ready (struct connection *pconn)
 Handle a player-ready packet from global observer. More...
 
 BV_DEFINE (bv_identity_numbers, IDENTITY_NUMBER_SIZE)
 
void init_game_seed ()
 Initialize the game seed. More...
 
void srv_init ()
 Initialize freeciv server. More...
 
void handle_client_info (struct connection *pc, int obsolete, int emerg_version, const char *distribution)
 Handle client info packet. More...
 
enum server_states server_state ()
 Return current server state. More...
 
void set_server_state (enum server_states newstate)
 Set current server state. More...
 
bool game_was_started ()
 Returns iff the game was started once upon a time. More...
 
bool check_for_game_over ()
 Returns TRUE if any one game end condition is fulfilled, FALSE otherwise. More...
 
void send_all_info (struct conn_list *dest)
 Send all information for when game starts or client reconnects. More...
 
static void do_reveal_effects ()
 Give map information to players with EFT_REVEAL_CITIES or EFT_REVEAL_MAP effects (traditionally from the Apollo Program). More...
 
static void do_have_contacts_effect ()
 Give contact to players with the EFT_HAVE_CONTACTS effect (traditionally from Marco Polo's Embassy). More...
 
static void do_border_vision_effect ()
 Handle the vision granting effect EFT_BORDER_VISION. More...
 
static void update_environmental_upset (enum environment_upset_type type, int *current, int *accum, int *level, int percent, void(*upset_action_fn)(int))
 Handle environmental upsets, meaning currently pollution or fallout. More...
 
static void notify_illegal_armistice_units (struct player *phost, struct player *pguest, int turns_left)
 Notify about units at risk of disband due to armistice. More...
 
static void remove_illegal_armistice_units (struct player *plr1, struct player *plr2)
 Remove illegal units when armistice turns into peace treaty. More...
 
static void update_diplomatics ()
 Check for cease-fires and armistices running out; update cancelling reasons and contact information. More...
 
static void kill_dying_players ()
 Check all players to see whether they are dying. More...
 
static void ai_start_phase ()
 Called at the start of each (new) phase to do AI activities. More...
 
void begin_turn (bool is_new_turn)
 Handle the beginning of each turn. More...
 
static int unit_wait_cmp (const struct unit_wait *const *a, const struct unit_wait *const *b)
 Comparator for sorting unit_waits in chronological order. More...
 
void begin_phase (bool is_new_phase)
 Begin a phase of movement. More...
 
void end_phase ()
 End a phase of movement. More...
 
void end_turn ()
 Handle the end of each turn. More...
 
void save_game_auto (const char *save_reason, enum autosave_type type)
 Save game with autosave filename. More...
 
void start_game ()
 Start actual game. More...
 
void server_quit ()
 Quit the server and exit. More...
 
void handle_report_req (struct connection *pconn, enum report_type type)
 Handle request asking report to be sent to client. More...
 
void identity_number_release (int id)
 Mark identity number free. More...
 
void identity_number_reserve (int id)
 Mark identity number allocated. More...
 
static bool identity_number_is_used (int id)
 Check whether identity number is currently allocated. More...
 
static int increment_identity_number ()
 Increment identity_number and return result. More...
 
int identity_number ()
 Identity ids wrap at IDENTITY_NUMBER_SIZE, skipping IDENTITY_NUMBER_ZERO Setup in server_game_init() More...
 
static bool is_client_edit_packet (int type)
 Returns TRUE if the packet type is an edit packet sent by the client. More...
 
bool server_packet_input (struct connection *pconn, void *packet, int type)
 Returns FALSE if connection should be closed (because the clients was rejected). More...
 
void check_for_full_turn_done ()
 Check if turn is really done. More...
 
void update_nations_with_startpos ()
 Update information about which nations have start positions on the map. More...
 
void handle_nation_select_req (struct connection *pc, int player_no, Nation_type_id nation_no, bool is_male, const char *name, int style)
 Handles a pick-nation packet from the client. More...
 
void handle_player_ready (struct player *requestor, int player_no, bool is_ready)
 Handle a player-ready packet. More...
 
const char * aifill (int amount)
 Fill or remove players to meet the given aifill. More...
 
static void player_set_nation_full (struct player *pplayer, struct nation_type *pnation)
 Tool for generate_players(). More...
 
void player_nation_defaults (struct player *pplayer, struct nation_type *pnation, bool set_name)
 Set nation for player with nation default values. More...
 
static void generate_players ()
 Assign random nations to players at game start. More...
 
const char * pick_random_player_name (const struct nation_type *pnation)
 Returns a random ruler name picked from given nation's ruler names that is not already in use. More...
 
void srv_scores ()
 Score calculation. More...
 
static void final_ruleset_adjustments ()
 Apply some final adjustments from the ruleset on to the game state. More...
 
void srv_ready ()
 Set up one game. More...
 
static void unit_wait_destroy (struct unit_wait *pwait)
 Free function for unit_wait. More...
 
void server_game_init (bool keep_ruleset_value)
 Initialize game data for the server (corresponds to server_game_free). More...
 
void server_game_free ()
 Free game data that we reinitialize as part of a server soft restart. More...
 
int server_plr_tile_city_id_get (const struct tile *ptile, const struct player *pplayer)
 Returns the id of the city the player map of 'pplayer' has at 'ptile' or IDENTITY_NUMBER_ZERO if the player map don't have a city there. More...
 
server_setting_id server_ss_by_name (const char *name)
 Returns the id of the server setting with the specified name. More...
 
const char * server_ss_name_get (server_setting_id id)
 Returns the name of the server setting with the specified id. More...
 
enum sset_type server_ss_type_get (server_setting_id id)
 Returns the type of the server setting with the specified id. More...
 
bool server_ss_val_bool_get (server_setting_id id)
 Returns the value of the boolean server setting with the specified id. More...
 
int server_ss_val_int_get (server_setting_id id)
 Returns the value of the integer server setting with the specified id. More...
 
unsigned int server_ss_val_bitwise_get (server_setting_id id)
 Returns the value of the bitwise server setting with the specified id. More...
 
known_type mapimg_server_tile_known (const struct tile *ptile, const struct player *pplayer, bool knowledge)
 Helper function for the mapimg module - tile knowledge. More...
 
terrainmapimg_server_tile_terrain (const struct tile *ptile, const struct player *pplayer, bool knowledge)
 Helper function for the mapimg module - tile terrain. More...
 
playermapimg_server_tile_owner (const struct tile *ptile, const struct player *pplayer, bool knowledge)
 Helper function for the mapimg module - tile owner. More...
 
playermapimg_server_tile_city (const struct tile *ptile, const struct player *pplayer, bool knowledge)
 Helper function for the mapimg module - city owner. More...
 
playermapimg_server_tile_unit (const struct tile *ptile, const struct player *pplayer, bool knowledge)
 Helper function for the mapimg module - unit owner. More...
 
int mapimg_server_plrcolor_count ()
 Helper function for the mapimg module - number of player colors. More...
 
rgbcolormapimg_server_plrcolor_get (int i)
 Helper function for the mapimg module - one player color. More...
 

Variables

struct server_arguments srvarg
 
struct civserver server
 
static enum server_states civserver_state = S_S_INITIAL
 
bool force_end_of_sniff
 
bv_identity_numbers identity_numbers_used
 
static bool has_been_srv_init = false
 
static civtimereot_timer = nullptr
 
static civtimerbetween_turns = nullptr
 

Macro Definition Documentation

◆ IDENTITY_NUMBER_SIZE

#define IDENTITY_NUMBER_SIZE   250000

Definition at line 132 of file srv_main.cpp.

Function Documentation

◆ ai_start_phase()

static void ai_start_phase ( )
static

Called at the start of each (new) phase to do AI activities.

Definition at line 1066 of file srv_main.cpp.

Referenced by begin_phase().

◆ aifill()

const char* aifill ( int  amount)

Fill or remove players to meet the given aifill.

If return is non-nullptr, points to a translated string explaining why the total number of players is less than 'amount'.

Definition at line 2440 of file srv_main.cpp.

Referenced by aifill_action(), connection_attach_real(), connection_detach(), load_command(), load_rulesetdir(), nationset_action(), freeciv::server::prepare_game(), remove_player_command(), pregame_options::set_aifill(), sg_load_savefile(), and sg_load_scenario().

◆ announce_player()

static void announce_player ( struct player pplayer)
static

Announce what nation player rules to everyone.

Definition at line 2816 of file srv_main.cpp.

Referenced by generate_players().

◆ begin_phase()

void begin_phase ( bool  is_new_phase)

Begin a phase of movement.

This handles all beginning-of-phase actions for one or more players.

Definition at line 1213 of file srv_main.cpp.

◆ begin_turn()

void begin_turn ( bool  is_new_turn)

Handle the beginning of each turn.

Note: This does not give "time" to any player; it is solely for updating turn-dependent data.

Definition at line 1083 of file srv_main.cpp.

◆ BV_DEFINE()

BV_DEFINE ( bv_identity_numbers  ,
IDENTITY_NUMBER_SIZE   
)

◆ check_for_full_turn_done()

void check_for_full_turn_done ( )

Check if turn is really done.

Returns nothing, but as a side effect sets force_end_of_sniff if no more input is expected this turn (i.e. turn done)

Definition at line 2179 of file srv_main.cpp.

Referenced by freeciv::server::begin_phase(), detach_command(), handle_player_phase_done(), lost_connection_to_client(), and player_set_to_ai_mode().

◆ check_for_game_over()

bool check_for_game_over ( )

Returns TRUE if any one game end condition is fulfilled, FALSE otherwise.

This function will notify players but will not set the server_state(). The caller must set the server state to S_S_OVER if the function returns TRUE.

Also send notifications about impending, predictable game end conditions.

Definition at line 265 of file srv_main.cpp.

Referenced by freeciv::server::end_turn().

◆ do_border_vision_effect()

static void do_border_vision_effect ( )
static

Handle the vision granting effect EFT_BORDER_VISION.

Definition at line 688 of file srv_main.cpp.

Referenced by end_phase().

◆ do_have_contacts_effect()

static void do_have_contacts_effect ( )
static

Give contact to players with the EFT_HAVE_CONTACTS effect (traditionally from Marco Polo's Embassy).

Definition at line 667 of file srv_main.cpp.

Referenced by end_phase().

◆ do_reveal_effects()

static void do_reveal_effects ( )
static

Give map information to players with EFT_REVEAL_CITIES or EFT_REVEAL_MAP effects (traditionally from the Apollo Program).

Definition at line 638 of file srv_main.cpp.

Referenced by end_phase().

◆ end_phase()

void end_phase ( )

End a phase of movement.

This handles all end-of-phase actions for one or more players.

Definition at line 1397 of file srv_main.cpp.

◆ end_turn()

void end_turn ( )

Handle the end of each turn.

Definition at line 1554 of file srv_main.cpp.

◆ final_ruleset_adjustments()

static void final_ruleset_adjustments ( )
static

Apply some final adjustments from the ruleset on to the game state.

We cannot do this during ruleset loading, since some players may be added later than that.

Definition at line 2861 of file srv_main.cpp.

Referenced by srv_ready().

◆ game_was_started()

◆ generate_players()

static void generate_players ( )
static

Assign random nations to players at game start.

This includes human players, AI players created with "set aifill <X>", and players created with "create <PlayerName>".

If a player's name matches one of the leader names for some nation, and that nation is available, choose that nation, and set the player sex appropriately. For example, when the Britons have not been chosen by anyone else, a player called Boudica whose nation has not been specified (for instance if they were created with "create Boudica") will become the Britons, and their sex will be female. Otherwise, the sex is chosen randomly, and the nation is chosen as below.

If this is a scenario and the scenario has specific start positions for some nations, try to pick those nations, favouring those with start positions which already-assigned players can't use. (Note that it's possible that we can't find enough nations with available start positions, depending on what nations players have already picked; in this case, it's OK to pick nations without start positions, as init_new_game() will fall back to mismatched start positions.)

Otherwise, pick available nations using pick_a_nation(), which tries to pick nations that look good with nations already in the game.

For 'aifill' players, the player name/sex is then reset to that of a random leader for the chosen nation.

Definition at line 2596 of file srv_main.cpp.

Referenced by srv_ready().

◆ handle_client_info()

void handle_client_info ( struct connection pc,
int  obsolete,
int  emerg_version,
const char *  distribution 
)

Handle client info packet.

Definition at line 222 of file srv_main.cpp.

◆ handle_nation_select_req()

void handle_nation_select_req ( struct connection pc,
int  player_no,
Nation_type_id  nation_no,
bool  is_male,
const char *  name,
int  style 
)

Handles a pick-nation packet from the client.

These packets are handled by connection because ctrl users may edit anyone's nation in pregame, and editing is possible during a running game.

Definition at line 2303 of file srv_main.cpp.

◆ handle_observer_ready()

static void handle_observer_ready ( struct connection pconn)
static

Handle a player-ready packet from global observer.

Definition at line 2368 of file srv_main.cpp.

Referenced by server_packet_input().

◆ handle_player_ready()

void handle_player_ready ( struct player requestor,
int  player_no,
bool  is_ready 
)

Handle a player-ready packet.

Definition at line 2386 of file srv_main.cpp.

Referenced by start_command().

◆ handle_report_req()

void handle_report_req ( struct connection pconn,
enum report_type  type 
)

Handle request asking report to be sent to client.

Definition at line 1928 of file srv_main.cpp.

◆ identity_number()

int identity_number ( )

Identity ids wrap at IDENTITY_NUMBER_SIZE, skipping IDENTITY_NUMBER_ZERO Setup in server_game_init()

Definition at line 1993 of file srv_main.cpp.

Referenced by create_city(), and create_unit_full().

◆ identity_number_is_used()

static bool identity_number_is_used ( int  id)
static

Check whether identity number is currently allocated.

Definition at line 1974 of file srv_main.cpp.

Referenced by identity_number().

◆ identity_number_release()

void identity_number_release ( int  id)

Mark identity number free.

Definition at line 1964 of file srv_main.cpp.

Referenced by srv_init().

◆ identity_number_reserve()

void identity_number_reserve ( int  id)

Mark identity number allocated.

Definition at line 1969 of file srv_main.cpp.

Referenced by identity_number(), server_game_init(), sg_load_player_cities(), sg_load_player_units(), and sg_load_player_vision().

◆ increment_identity_number()

static int increment_identity_number ( )
static

Increment identity_number and return result.

Definition at line 1982 of file srv_main.cpp.

Referenced by identity_number().

◆ init_game_seed()

void init_game_seed ( )

Initialize the game seed.

This may safely be called multiple times.

Definition at line 147 of file srv_main.cpp.

Referenced by sg_load_random(), and srv_ready().

◆ is_client_edit_packet()

static bool is_client_edit_packet ( int  type)
static

Returns TRUE if the packet type is an edit packet sent by the client.

NB: The first and last client edit packets here must match those defined in common/networking/packets.def.

Definition at line 2015 of file srv_main.cpp.

Referenced by server_packet_input().

◆ kill_dying_players()

static void kill_dying_players ( )
static

Check all players to see whether they are dying.

WARNING: do not call this while doing any handling of players, units, etc. If a player dies, all his units will be wiped and other data will be overwritten.

Definition at line 1038 of file srv_main.cpp.

Referenced by ai_start_phase(), end_phase(), and server_packet_input().

◆ mapimg_server_plrcolor_count()

int mapimg_server_plrcolor_count ( )

Helper function for the mapimg module - number of player colors.

Definition at line 3446 of file srv_main.cpp.

◆ mapimg_server_plrcolor_get()

rgbcolor* mapimg_server_plrcolor_get ( int  i)

Helper function for the mapimg module - one player color.

Definition at line 3451 of file srv_main.cpp.

◆ mapimg_server_tile_city()

player* mapimg_server_tile_city ( const struct tile ptile,
const struct player pplayer,
bool  knowledge 
)

Helper function for the mapimg module - city owner.

Definition at line 3401 of file srv_main.cpp.

◆ mapimg_server_tile_known()

known_type mapimg_server_tile_known ( const struct tile ptile,
const struct player pplayer,
bool  knowledge 
)

Helper function for the mapimg module - tile knowledge.

Definition at line 3356 of file srv_main.cpp.

◆ mapimg_server_tile_owner()

player* mapimg_server_tile_owner ( const struct tile ptile,
const struct player pplayer,
bool  knowledge 
)

Helper function for the mapimg module - tile owner.

Definition at line 3385 of file srv_main.cpp.

◆ mapimg_server_tile_terrain()

terrain* mapimg_server_tile_terrain ( const struct tile ptile,
const struct player pplayer,
bool  knowledge 
)

Helper function for the mapimg module - tile terrain.

Definition at line 3370 of file srv_main.cpp.

◆ mapimg_server_tile_unit()

player* mapimg_server_tile_unit ( const struct tile ptile,
const struct player pplayer,
bool  knowledge 
)

Helper function for the mapimg module - unit owner.

Definition at line 3426 of file srv_main.cpp.

◆ notify_illegal_armistice_units()

static void notify_illegal_armistice_units ( struct player phost,
struct player pguest,
int  turns_left 
)
static

Notify about units at risk of disband due to armistice.

Definition at line 761 of file srv_main.cpp.

Referenced by update_diplomatics().

◆ pick_random_player_name()

const char* pick_random_player_name ( const struct nation_type pnation)

Returns a random ruler name picked from given nation's ruler names that is not already in use.

May return nullptr if no unique name is available.

Definition at line 2787 of file srv_main.cpp.

Referenced by create_barbarian_player(), and player_nation_defaults().

◆ player_nation_defaults()

void player_nation_defaults ( struct player pplayer,
struct nation_type pnation,
bool  set_name 
)

Set nation for player with nation default values.

Definition at line 2545 of file srv_main.cpp.

Referenced by create_animals(), create_barbarian_player(), handle_edit_player_create(), player_set_nation_full(), and split_player().

◆ player_set_nation_full()

static void player_set_nation_full ( struct player pplayer,
struct nation_type pnation 
)
static

Tool for generate_players().

Definition at line 2535 of file srv_main.cpp.

Referenced by generate_players().

◆ remove_illegal_armistice_units()

static void remove_illegal_armistice_units ( struct player plr1,
struct player plr2 
)
static

Remove illegal units when armistice turns into peace treaty.

Definition at line 803 of file srv_main.cpp.

Referenced by update_diplomatics().

◆ save_game_auto()

void save_game_auto ( const char *  save_reason,
enum autosave_type  type 
)

Save game with autosave filename.

Definition at line 1788 of file srv_main.cpp.

Referenced by freeciv::server::begin_phase(), freeciv::server::pulse(), and srv_scores().

◆ send_all_info()

void send_all_info ( struct conn_list *  dest)

Send all information for when game starts or client reconnects.

Initial packets should have been sent before calling this function. See comment in connecthand.c::establish_new_connection().

Definition at line 607 of file srv_main.cpp.

Referenced by connection_attach_real(), and srv_ready().

◆ server_game_free()

void server_game_free ( )

Free game data that we reinitialize as part of a server soft restart.

Bear in mind that this function is called when the 'load' command is used, for instance.

Definition at line 3204 of file srv_main.cpp.

Referenced by load_command(), savegame2_load(), savegame3_load(), server_quit(), and freeciv::server::shut_game_down().

◆ server_game_init()

void server_game_init ( bool  keep_ruleset_value)

Initialize game data for the server (corresponds to server_game_free).

Definition at line 3179 of file srv_main.cpp.

Referenced by load_command(), savegame2_load(), savegame3_load(), and freeciv::server::shut_game_down().

◆ server_packet_input()

bool server_packet_input ( struct connection pconn,
void *  packet,
int  type 
)

Returns FALSE if connection should be closed (because the clients was rejected).

Returns TRUE else.

Definition at line 2024 of file srv_main.cpp.

Referenced by incoming_client_packets().

◆ server_plr_tile_city_id_get()

int server_plr_tile_city_id_get ( const struct tile ptile,
const struct player pplayer 
)

Returns the id of the city the player map of 'pplayer' has at 'ptile' or IDENTITY_NUMBER_ZERO if the player map don't have a city there.

Definition at line 3254 of file srv_main.cpp.

◆ server_quit()

void server_quit ( )

Quit the server and exit.

Definition at line 1869 of file srv_main.cpp.

Referenced by freeciv::server::~server().

◆ server_ss_by_name()

server_setting_id server_ss_by_name ( const char *  name)

Returns the id of the server setting with the specified name.

Definition at line 3266 of file srv_main.cpp.

Referenced by fc_interface_init_tool().

◆ server_ss_name_get()

const char* server_ss_name_get ( server_setting_id  id)

Returns the name of the server setting with the specified id.

Definition at line 3281 of file srv_main.cpp.

Referenced by fc_interface_init_tool().

◆ server_ss_type_get()

enum sset_type server_ss_type_get ( server_setting_id  id)

Returns the type of the server setting with the specified id.

Definition at line 3281 of file srv_main.cpp.

Referenced by fc_interface_init_tool().

◆ server_ss_val_bitwise_get()

unsigned int server_ss_val_bitwise_get ( server_setting_id  id)

Returns the value of the bitwise server setting with the specified id.

Definition at line 3341 of file srv_main.cpp.

Referenced by fc_interface_init_tool().

◆ server_ss_val_bool_get()

bool server_ss_val_bool_get ( server_setting_id  id)

Returns the value of the boolean server setting with the specified id.

Definition at line 3311 of file srv_main.cpp.

Referenced by fc_interface_init_tool().

◆ server_ss_val_int_get()

int server_ss_val_int_get ( server_setting_id  id)

Returns the value of the integer server setting with the specified id.

Definition at line 3326 of file srv_main.cpp.

Referenced by fc_interface_init_tool().

◆ server_state()

◆ set_server_state()

void set_server_state ( enum server_states  newstate)

◆ srv_init()

void srv_init ( )

Initialize freeciv server.

Definition at line 162 of file srv_main.cpp.

Referenced by main().

◆ srv_ready()

void srv_ready ( )

Set up one game.

Definition at line 2888 of file srv_main.cpp.

Referenced by freeciv::server::update_game_state().

◆ srv_scores()

void srv_scores ( )

Score calculation.

Definition at line 2834 of file srv_main.cpp.

Referenced by freeciv::server::end_turn().

◆ start_game()

void start_game ( )

Start actual game.

Everything has been set up already.

Definition at line 1830 of file srv_main.cpp.

Referenced by start_command().

◆ unit_wait_cmp()

static int unit_wait_cmp ( const struct unit_wait *const *  a,
const struct unit_wait *const *  b 
)
static

Comparator for sorting unit_waits in chronological order.

Definition at line 1203 of file srv_main.cpp.

Referenced by begin_phase().

◆ unit_wait_destroy()

static void unit_wait_destroy ( struct unit_wait pwait)
static

Free function for unit_wait.

Definition at line 3167 of file srv_main.cpp.

Referenced by server_game_init().

◆ update_diplomatics()

static void update_diplomatics ( )
static

Check for cease-fires and armistices running out; update cancelling reasons and contact information.

Definition at line 835 of file srv_main.cpp.

Referenced by end_turn().

◆ update_environmental_upset()

static void update_environmental_upset ( enum environment_upset_type  type,
int *  current,
int *  accum,
int *  level,
int  percent,
void(*)(int)  upset_action_fn 
)
static

Handle environmental upsets, meaning currently pollution or fallout.

Definition at line 717 of file srv_main.cpp.

Referenced by end_turn().

◆ update_nations_with_startpos()

void update_nations_with_startpos ( )

Update information about which nations have start positions on the map.

Call this on server start, or when loading a scenario.

Definition at line 2239 of file srv_main.cpp.

Referenced by load_rulesetdir(), and sg_load_map_startpos().

Variable Documentation

◆ between_turns

civtimer* between_turns = nullptr
static

Definition at line 142 of file srv_main.cpp.

Referenced by real_timer_callback(), server_quit(), and start_turn_change_wait().

◆ civserver_state

enum server_states civserver_state = S_S_INITIAL
static

Definition at line 115 of file srv_main.cpp.

Referenced by set_server_state().

◆ eot_timer

civtimer* eot_timer = nullptr
static

Definition at line 140 of file srv_main.cpp.

Referenced by server_quit().

◆ force_end_of_sniff

◆ has_been_srv_init

bool has_been_srv_init = false
static

Definition at line 137 of file srv_main.cpp.

Referenced by srv_init().

◆ identity_numbers_used

bv_identity_numbers identity_numbers_used

◆ server

struct civserver server

Definition at line 115 of file srv_main.cpp.

Referenced by main(), parse_metaserver_data(), and server_open_socket().

◆ srvarg