Freeciv-3.2
|
#include <stdio.h>
#include "capability.h"
#include "fcintl.h"
#include "log.h"
#include "mem.h"
#include "rand.h"
#include "registry.h"
#include "shared.h"
#include "string_vector.h"
#include "support.h"
#include "ai.h"
#include "calendar.h"
#include "events.h"
#include "game.h"
#include "improvement.h"
#include "modpack.h"
#include "movement.h"
#include "nation.h"
#include "packets.h"
#include "citytools.h"
#include "connecthand.h"
#include "maphand.h"
#include "notify.h"
#include "plrhand.h"
#include "srv_main.h"
#include "stdinhand.h"
#include "unittools.h"
#include "advdata.h"
#include "gamehand.h"
#include "speclist.h"
#include "specpq.h"
Go to the source code of this file.
Data Structures | |
struct | team_placement_config |
struct | team_placement_state |
struct | mrc_sendclient_data |
Macros | |
#define | CHALLENGE_ROOT "challenge" |
#define | SPECLIST_TAG startpos |
#define | SPECLIST_TYPE struct startpos |
#define | startpos_list_iterate(list, plink, psp) |
#define | startpos_list_iterate_end LIST_BOTH_ITERATE_END |
#define | SPECPQ_TAG team_placement |
#define | SPECPQ_DATA_TYPE struct team_placement_state * |
#define | SPECPQ_PRIORITY_TYPE long |
#define | team_placement_closest sq_map_distance |
#define CHALLENGE_ROOT "challenge" |
Definition at line 57 of file gamehand.c.
Definition at line 59 of file gamehand.c.
Definition at line 60 of file gamehand.c.
#define SPECPQ_DATA_TYPE struct team_placement_state * |
Definition at line 80 of file gamehand.c.
Definition at line 81 of file gamehand.c.
#define SPECPQ_TAG team_placement |
Definition at line 79 of file gamehand.c.
Definition at line 62 of file gamehand.c.
#define startpos_list_iterate_end LIST_BOTH_ITERATE_END |
Definition at line 65 of file gamehand.c.
#define team_placement_closest sq_map_distance |
Definition at line 256 of file gamehand.c.
Create cache of available rulesets.
Definition at line 1133 of file gamehand.c.
Referenced by send_ruleset_choices(), and show_rulesets().
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().
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().
|
static |
Find the best team placement, according to the 'team_placement' setting.
Definition at line 310 of file gamehand.c.
Referenced by init_new_game().
|
static |
Find a valid position not far from our starting position.
Definition at line 222 of file gamehand.c.
Referenced by init_new_game().
|
static |
Generate challenge filename for this connection, cannot fail.
Definition at line 1052 of file gamehand.c.
Referenced by new_challenge_filename().
|
static |
Get challenge filename for this connection.
Definition at line 1059 of file gamehand.c.
Referenced by get_challenge_fullname(), and new_challenge_filename().
|
static |
Get challenge full filename for this connection.
Definition at line 1072 of file gamehand.c.
Referenced by handle_single_want_hack_req().
void handle_ruleset_select | ( | struct connection * | pc, |
const struct packet_ruleset_select * | packet | ||
) |
Change ruleset based on modpack.
Definition at line 1183 of file gamehand.c.
Referenced by server_handle_packet().
void handle_single_want_hack_req | ( | struct connection * | pc, |
const struct packet_single_want_hack_req * | packet | ||
) |
Opens a file specified by the packet and compares the packet values with the file values. Sends an answer to the client once it's done.
Definition at line 1234 of file gamehand.c.
Referenced by server_handle_packet().
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 1036 of file gamehand.c.
Referenced by unit_move().
Initialize a new game: place the players' units onto the map, etc.
Definition at line 451 of file gamehand.c.
Referenced by srv_ready().
const char * new_challenge_filename | ( | struct connection * | pc | ) |
Find a file that we can write too, and return it's name.
Definition at line 1096 of file gamehand.c.
Referenced by establish_new_connection().
|
static |
Place a starting unit for the player. Returns tile where unit was really placed. By default the ptype is used and crole does not matter, but if former is NULL, crole will be used instead.
Definition at line 158 of file gamehand.c.
Referenced by init_new_game().
|
static |
Callback called from modpack ruleset cache iteration.
Definition at line 1110 of file gamehand.c.
Referenced by send_ruleset_choices().
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 907 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().
|
static |
Call this on a connection with HACK access to send it a set of ruleset choices. Probably this should be called immediately when granting HACK access to a connection.
Definition at line 1164 of file gamehand.c.
Referenced by handle_single_want_hack_req().
Send description of the current scenario. dest NULL causes send to everyone
Definition at line 964 of file gamehand.c.
Referenced by establish_new_connection(), handle_edit_scenario_desc(), and load_command().
Send current scenario info. dest NULL causes send to everyone
Definition at line 950 of file gamehand.c.
Referenced by establish_new_connection(), handle_edit_game(), and load_command().
Tell clients the year, and also update turn_done and nturns_idle fields for all players.
Definition at line 881 of file gamehand.c.
Referenced by end_turn().
|
static |
Calculate the distance between tiles, according to the 'teamplacement' setting set to 'CONTINENT'.
Definition at line 262 of file gamehand.c.
Referenced by do_team_placement().
|
static |
Calculate the distance between tiles, according to the 'teamplacement' setting set to 'HORIZONTAL'.
Definition at line 274 of file gamehand.c.
Referenced by do_team_placement().
|
static |
Destroys a team_placement_state structure.
Definition at line 301 of file gamehand.c.
Referenced by do_team_placement().
|
static |
Calculate the distance between tiles, according to the 'teamplacement' setting set to 'VERTICAL'.
Definition at line 288 of file gamehand.c.
Referenced by do_team_placement().
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 985 of file gamehand.c.
Referenced by end_turn().