Freeciv-3.3: /fast/freeciv/nightly/main/server/gamehand.h File Reference

Freeciv-3.3

Loading...
Searching...
No Matches
Functions
gamehand.h File Reference

Go to the source code of this file.

## Functions

void | init_new_game (void)
void | send_year_to_clients (void)
void | send_game_info (struct conn_list *dest)
void | send_scenario_info (struct conn_list *dest)
void | send_scenario_description (struct conn_list *dest)
void | cache_rulesets (void)
enum unit_role_id | crole_to_role_id (char crole)
struct unit_type * | crole_to_unit_type (char crole, struct player *pplayer)
int | update_timeout (void)
void | increase_timeout_because_unit_moved (void)
const char * | new_challenge_filename (struct connection *pc)

## Function Documentation

## ◆ cache_rulesets()

void cache_rulesets | ( | void |  | ) |

Create cache of available rulesets.

Definition at line 1136 of file gamehand.c.

Referenced by send_ruleset_choices(), and show_rulesets().

## ◆ crole_to_role_id()

enum unit_role_id crole_to_role_id | ( | char | crole | ) |

Get role_id for given role character

Definition at line 87 of file gamehand.c.

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. If pplayer given, will check also that they don't already have an unique unit.

Definition at line 120 of file gamehand.c.

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

## ◆ increase_timeout_because_unit_moved()

void increase_timeout_because_unit_moved | ( | void |  | ) |

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 1039 of file gamehand.c.

Referenced by unit_move().

## ◆ init_new_game()

void init_new_game | ( | void |  | ) |

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

Definition at line 454 of file gamehand.c.

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.c.

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 == NULL 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 910 of file gamehand.c.

Referenced by api_edit_create_building(), api_edit_remove_building(), 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(), and transfer_city().

## ◆ send_scenario_description()

void send_scenario_description | ( | struct conn_list * | dest | ) |

Send description of the current scenario. dest NULL causes send to everyone

Definition at line 967 of file gamehand.c.

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 NULL causes send to everyone

Definition at line 953 of file gamehand.c.

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

## ◆ send_year_to_clients()

void send_year_to_clients | ( | void |  | ) |

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

Definition at line 884 of file gamehand.c.

Referenced by end_turn().

## ◆ update_timeout()

int update_timeout | ( | void |  | ) |

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 988 of file gamehand.c.

Referenced by end_turn().