Freeciv21
Develop your civilization from humble roots to a global empire
gamehand.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void init_new_game ()
 Initialize a new game: place the players' units onto the map, etc. More...
 
void send_year_to_clients ()
 Tell clients the year, and also update turn_done and nturns_idle fields for all players. More...
 
void send_game_info (struct conn_list *dest)
 Send game_info packet; some server options and various stuff... More...
 
void send_scenario_info (struct conn_list *dest)
 Send current scenario info. More...
 
void send_scenario_description (struct conn_list *dest)
 Send description of the current scenario. More...
 
enum unit_role_id crole_to_role_id (char crole)
 Get role_id for given role character. More...
 
struct unit_typecrole_to_unit_type (char crole, struct player *pplayer)
 Get unit_type for given role character. More...
 
int update_timeout ()
 adjusts game.info.timeout based on various server options More...
 
void increase_timeout_because_unit_moved ()
 adjusts game.seconds_to_turn_done when enemy moves a unit, we see it and the remaining timeout is smaller than the timeoutaddenemymove option. More...
 
const char * new_challenge_filename (struct connection *pc)
 Find a file that we can write too, and return it's name. More...
 

Function Documentation

◆ crole_to_role_id()

enum unit_role_id crole_to_role_id ( char  crole)

Get role_id for given role character.

Definition at line 1 of file gamehand.cpp.

Referenced by crole_to_unit_type(), and startunits_callback().

◆ crole_to_unit_type()

struct unit_type* crole_to_unit_type ( char  crole,
struct player pplayer 
)

Get unit_type for given role character.

Definition at line 108 of file gamehand.cpp.

Referenced by give_midgame_initial_units(), place_starting_unit(), and srv_ready().

◆ increase_timeout_because_unit_moved()

void increase_timeout_because_unit_moved ( )

adjusts game.seconds_to_turn_done when enemy moves a unit, we see it and the remaining timeout is smaller than the timeoutaddenemymove option.

It's possible to use a similar function to do that per-player. In theory there should be a separate timeout for each player and the added time should only go onto the victim's timer.

Definition at line 1040 of file gamehand.cpp.

Referenced by unit_move().

◆ init_new_game()

void init_new_game ( )

Initialize a new game: place the players' units onto the map, etc.

Definition at line 416 of file gamehand.cpp.

Referenced by srv_ready().

◆ new_challenge_filename()

const char* new_challenge_filename ( struct connection pc)

Find a file that we can write too, and return it's name.

Definition at line 1099 of file gamehand.cpp.

Referenced by establish_new_connection().

◆ send_game_info()

void send_game_info ( struct conn_list *  dest)

Send game_info packet; some server options and various stuff...

dest == nullptr means game.est_connections

It may be sent at any time. It MUST be sent before any player info, as it contains the number of players. To avoid inconsistency, it SHOULD be sent after rulesets and any other server settings.

Definition at line 905 of file gamehand.cpp.

Referenced by begin_phase(), begin_turn(), city_build_free_buildings(), end_turn(), establish_new_connection(), first_timeout_action(), found_new_tech(), handle_edit_city(), handle_edit_game(), handle_edit_mode(), handle_edit_player(), increase_timeout_because_unit_moved(), load_command(), remove_city(), set_ai_level(), set_command(), timeout_action(), timeout_set_command(), and transfer_city().

◆ send_scenario_description()

void send_scenario_description ( struct conn_list *  dest)

Send description of the current scenario.

dest nullptr causes send to everyone

Definition at line 967 of file gamehand.cpp.

Referenced by establish_new_connection(), handle_edit_scenario_desc(), and load_command().

◆ send_scenario_info()

void send_scenario_info ( struct conn_list *  dest)

Send current scenario info.

dest nullptr causes send to everyone

Definition at line 950 of file gamehand.cpp.

Referenced by establish_new_connection(), handle_edit_game(), and load_command().

◆ send_year_to_clients()

void send_year_to_clients ( )

Tell clients the year, and also update turn_done and nturns_idle fields for all players.

Definition at line 880 of file gamehand.cpp.

Referenced by end_turn().

◆ update_timeout()

int update_timeout ( )

adjusts game.info.timeout based on various server options

timeoutint: adjust game.info.timeout every timeoutint turns timeoutinc: adjust game.info.timeout by adding timeoutinc to it. timeoutintinc: every time we adjust game.info.timeout, we add timeoutintinc to timeoutint. timeoutincmult: every time we adjust game.info.timeout, we multiply timeoutinc by timeoutincmult

Definition at line 989 of file gamehand.cpp.

Referenced by end_turn().