|
Freeciv-3.4
|
#include "fc_prehdrs.h"#include <stdarg.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include "astring.h"#include "bitvector.h"#include "deprecations.h"#include "fc_cmdline.h"#include "fciconv.h"#include "fcintl.h"#include "log.h"#include "mem.h"#include "rand.h"#include "registry.h"#include "support.h"#include "timing.h"#include "section_file.h"#include "capability.h"#include "events.h"#include "fc_types.h"#include "featured_text.h"#include "game.h"#include "map.h"#include "mapimg.h"#include "modpack.h"#include "packets.h"#include "player.h"#include "research.h"#include "rgbcolor.h"#include "srvdefs.h"#include "unitlist.h"#include "version.h"#include "aiiface.h"#include "citytools.h"#include "connecthand.h"#include "diplhand.h"#include "gamehand.h"#include "mapgen.h"#include "maphand.h"#include "meta.h"#include "notify.h"#include "plrhand.h"#include "report.h"#include "ruleload.h"#include "sanitycheck.h"#include "score.h"#include "sernet.h"#include "settings.h"#include "srv_log.h"#include "srv_main.h"#include "techtools.h"#include "voting.h"#include "advdata.h"#include "savemain.h"#include "script_server.h"#include "script_fcdb.h"#include "difficulty.h"#include "handicaps.h"#include "stdinhand.h"#include "spechash.h"#include "specenum_gen.h"Go to the source code of this file.
Data Structures | |
| struct | mrc_listcmd_data |
Variables | |
| static enum cmdlevel | default_access_level = ALLOW_BASIC |
| static enum cmdlevel | first_access_level = ALLOW_BASIC |
| const char * | script_extension = ".serv" |
| static struct kick_hash * | kick_table_by_addr = nullptr |
| static struct kick_hash * | kick_table_by_user = nullptr |
| static const char | horiz_line [] |
| static const char *const | vote_args [] |
| #define HELP_ARG_NUM (CMD_NUM + HELP_GENERAL_COUNT + settings_number()) |
Definition at line 6586 of file stdinhand.c.
| #define LOOKUP_OPTION_AMBIGUOUS (-2) |
Definition at line 1707 of file stdinhand.c.
| #define LOOKUP_OPTION_LEVEL_NAME (-3) |
Definition at line 1708 of file stdinhand.c.
| #define LOOKUP_OPTION_NO_RESULT (-1) |
Definition at line 1706 of file stdinhand.c.
| #define LOOKUP_OPTION_RULESETDIR (-4) |
Definition at line 1709 of file stdinhand.c.
| #define OPTION_NAME_SPACE 25 |
Definition at line 99 of file stdinhand.c.
| #define SPECENUM_COUNT MAPIMG_COUNT |
Definition at line 5674 of file stdinhand.c.
| #define SPECENUM_COUNT FCDB_COUNT |
Definition at line 5674 of file stdinhand.c.
| #define SPECENUM_COUNT HELP_GENERAL_COUNT |
Definition at line 5674 of file stdinhand.c.
Definition at line 4811 of file stdinhand.c.
Definition at line 4811 of file stdinhand.c.
Definition at line 4811 of file stdinhand.c.
Definition at line 4811 of file stdinhand.c.
Definition at line 4811 of file stdinhand.c.
Definition at line 4811 of file stdinhand.c.
Definition at line 4811 of file stdinhand.c.
| #define SPECENUM_VALUE0 RESET_GAME |
Definition at line 4812 of file stdinhand.c.
Definition at line 4812 of file stdinhand.c.
| #define SPECENUM_VALUE0 DELEGATE_CANCEL |
Definition at line 4812 of file stdinhand.c.
| #define SPECENUM_VALUE0 MAPIMG_COLORTEST |
Definition at line 4812 of file stdinhand.c.
| #define SPECENUM_VALUE0 FCDB_RELOAD |
Definition at line 4812 of file stdinhand.c.
| #define SPECENUM_VALUE0 HELP_GENERAL_COMMANDS |
Definition at line 4812 of file stdinhand.c.
Definition at line 4812 of file stdinhand.c.
| #define SPECENUM_VALUE0NAME "game" |
Definition at line 4813 of file stdinhand.c.
| #define SPECENUM_VALUE0NAME "cmd" |
Definition at line 4813 of file stdinhand.c.
| #define SPECENUM_VALUE0NAME "cancel" |
Definition at line 4813 of file stdinhand.c.
| #define SPECENUM_VALUE0NAME "colortest" |
Definition at line 4813 of file stdinhand.c.
| #define SPECENUM_VALUE0NAME "reload" |
Definition at line 4813 of file stdinhand.c.
| #define SPECENUM_VALUE0NAME "commands" |
Definition at line 4813 of file stdinhand.c.
| #define SPECENUM_VALUE0NAME "ais" |
Definition at line 4813 of file stdinhand.c.
| #define SPECENUM_VALUE1 RESET_RULESET |
Definition at line 4814 of file stdinhand.c.
Definition at line 4814 of file stdinhand.c.
| #define SPECENUM_VALUE1 DELEGATE_RESTORE |
Definition at line 4814 of file stdinhand.c.
| #define SPECENUM_VALUE1 MAPIMG_CREATE |
Definition at line 4814 of file stdinhand.c.
Definition at line 4814 of file stdinhand.c.
| #define SPECENUM_VALUE1 HELP_GENERAL_OPTIONS |
Definition at line 4814 of file stdinhand.c.
| #define SPECENUM_VALUE1 LIST_COLORS |
Definition at line 4814 of file stdinhand.c.
| #define SPECENUM_VALUE10 LIST_TEAMS |
Definition at line 7099 of file stdinhand.c.
| #define SPECENUM_VALUE10NAME "teams" |
Definition at line 7100 of file stdinhand.c.
| #define SPECENUM_VALUE11 LIST_VOTES |
Definition at line 7101 of file stdinhand.c.
| #define SPECENUM_VALUE11NAME "votes" |
Definition at line 7102 of file stdinhand.c.
| #define SPECENUM_VALUE1NAME "ruleset" |
Definition at line 4815 of file stdinhand.c.
| #define SPECENUM_VALUE1NAME "file" |
Definition at line 4815 of file stdinhand.c.
| #define SPECENUM_VALUE1NAME "restore" |
Definition at line 4815 of file stdinhand.c.
| #define SPECENUM_VALUE1NAME "create" |
Definition at line 4815 of file stdinhand.c.
| #define SPECENUM_VALUE1NAME "lua" |
Definition at line 4815 of file stdinhand.c.
| #define SPECENUM_VALUE1NAME "options" |
Definition at line 4815 of file stdinhand.c.
| #define SPECENUM_VALUE1NAME "colors" |
Definition at line 4815 of file stdinhand.c.
| #define SPECENUM_VALUE2 RESET_SCRIPT |
Definition at line 4816 of file stdinhand.c.
| #define SPECENUM_VALUE2 LUA_UNSAFE_CMD |
Definition at line 4816 of file stdinhand.c.
| #define SPECENUM_VALUE2 DELEGATE_SHOW |
Definition at line 4816 of file stdinhand.c.
| #define SPECENUM_VALUE2 MAPIMG_DEFINE |
Definition at line 4816 of file stdinhand.c.
| #define SPECENUM_VALUE2 LIST_CONNECTIONS |
Definition at line 4816 of file stdinhand.c.
| #define SPECENUM_VALUE2NAME "script" |
Definition at line 4817 of file stdinhand.c.
Definition at line 4817 of file stdinhand.c.
| #define SPECENUM_VALUE2NAME "show" |
Definition at line 4817 of file stdinhand.c.
| #define SPECENUM_VALUE2NAME "define" |
Definition at line 4817 of file stdinhand.c.
| #define SPECENUM_VALUE2NAME "connections" |
Definition at line 4817 of file stdinhand.c.
| #define SPECENUM_VALUE3 RESET_DEFAULT |
Definition at line 4818 of file stdinhand.c.
| #define SPECENUM_VALUE3 LUA_UNSAFE_FILE |
Definition at line 4818 of file stdinhand.c.
| #define SPECENUM_VALUE3 DELEGATE_TAKE |
Definition at line 4818 of file stdinhand.c.
| #define SPECENUM_VALUE3 MAPIMG_DELETE |
Definition at line 4818 of file stdinhand.c.
| #define SPECENUM_VALUE3 LIST_DELEGATIONS |
Definition at line 4818 of file stdinhand.c.
| #define SPECENUM_VALUE3NAME "default" |
Definition at line 4819 of file stdinhand.c.
Definition at line 4819 of file stdinhand.c.
| #define SPECENUM_VALUE3NAME "take" |
Definition at line 4819 of file stdinhand.c.
| #define SPECENUM_VALUE3NAME "delete" |
Definition at line 4819 of file stdinhand.c.
| #define SPECENUM_VALUE3NAME "delegations" |
Definition at line 4819 of file stdinhand.c.
| #define SPECENUM_VALUE4 DELEGATE_TO |
Definition at line 5171 of file stdinhand.c.
| #define SPECENUM_VALUE4 MAPIMG_SHOW |
Definition at line 5171 of file stdinhand.c.
| #define SPECENUM_VALUE4 LIST_IGNORE |
Definition at line 5171 of file stdinhand.c.
| #define SPECENUM_VALUE4NAME "to" |
Definition at line 5172 of file stdinhand.c.
| #define SPECENUM_VALUE4NAME "show" |
Definition at line 5172 of file stdinhand.c.
Definition at line 5172 of file stdinhand.c.
| #define SPECENUM_VALUE5 LIST_MAPIMG |
Definition at line 7089 of file stdinhand.c.
| #define SPECENUM_VALUE5NAME "map image definitions" |
Definition at line 7090 of file stdinhand.c.
| #define SPECENUM_VALUE6 LIST_PLAYERS |
Definition at line 7091 of file stdinhand.c.
| #define SPECENUM_VALUE6NAME "players" |
Definition at line 7092 of file stdinhand.c.
| #define SPECENUM_VALUE7 LIST_RULESETS |
Definition at line 7093 of file stdinhand.c.
| #define SPECENUM_VALUE7NAME "rulesets" |
Definition at line 7094 of file stdinhand.c.
| #define SPECENUM_VALUE8 LIST_SCENARIOS |
Definition at line 7095 of file stdinhand.c.
| #define SPECENUM_VALUE8NAME "scenarios" |
Definition at line 7096 of file stdinhand.c.
| #define SPECENUM_VALUE9 LIST_NATIONSETS |
Definition at line 7097 of file stdinhand.c.
| #define SPECENUM_VALUE9NAME "nationsets" |
Definition at line 7098 of file stdinhand.c.
| #define SPECHASH_ASTR_KEY_TYPE |
Definition at line 108 of file stdinhand.c.
| #define SPECHASH_IDATA_COPY time_duplicate |
Definition at line 111 of file stdinhand.c.
| #define SPECHASH_IDATA_FREE (kick_hash_data_free_fn_t) free |
Definition at line 112 of file stdinhand.c.
Definition at line 114 of file stdinhand.c.
Definition at line 109 of file stdinhand.c.
Definition at line 107 of file stdinhand.c.
| #define SPECHASH_UDATA_TO_IDATA | ( | t | ) | (&(t)) |
Definition at line 113 of file stdinhand.c.
Definition at line 110 of file stdinhand.c.
Returns true if there is at least one established connection.
Definition at line 1389 of file stdinhand.c.
Referenced by access_level_for_next_connection().
Return access level for next connection
Definition at line 1411 of file stdinhand.c.
Referenced by server_make_connection().
Execute a command in the context of the AI of the player.
Definition at line 5918 of file stdinhand.c.
Referenced by handle_stdin_input_real().
|
static |
Set user to away mode.
Definition at line 2066 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Cancel a vote... /cancelvote [vote number]|all.
Definition at line 2611 of file stdinhand.c.
Referenced by handle_stdin_input_real().
|
static |
Stop sending game info to metaserver.
Definition at line 514 of file stdinhand.c.
Referenced by metaconnection_command(), and metaserver_command().
|
static |
Translate an AI level back to its CMD_* value. If we just used /set ailevel [num] we wouldn't have to do this - rp
Definition at line 1962 of file stdinhand.c.
Referenced by set_ai_level(), and set_ai_level_direct().
| void cmd_reply | ( | enum command_id | cmd, |
| struct connection * | caller, | ||
| enum rfc_status rfc_status | , | ||
| const char * | format, | ||
| ... | |||
| ) |
var-args version as above, no prefix
Definition at line 417 of file stdinhand.c.
Referenced by aicmd_command(), away_command(), cancelvote_command(), close_metaserver_connection(), cmd_reply_matches(), cmd_reply_no_such_conn(), cmd_reply_no_such_player(), cmdlevel_command(), connectmsg_command(), create_command(), cut_client_connection(), debug_command(), default_command(), delegate_command(), detach_command(), end_command(), explain_option(), fcdb_command(), firstlevel_command(), handle_stdin_input_real(), ignore_command(), kick_command(), load_command(), lock_command(), lua_command(), mapimg_command(), metaconnection_command(), metapatches_command(), metaserver_command(), observe_command(), open_metaserver_connection(), playercolor_command(), playernation_command(), quit_game(), read_init_script_real(), remove_player_command(), reset_command(), ruleset_cache_listcmd_cb(), save_command(), scensave_command(), script_server_cmd_reply(), set_ai_level(), set_ai_level_direct(), set_cmdlevel(), set_command(), set_rulesetdir(), show_ais(), show_colors(), show_connections(), show_delegations(), show_help(), show_help_command(), show_help_command_list(), show_help_intro(), show_help_option(), show_help_option_list(), show_ignore(), show_list(), show_mapimg(), show_nationsets(), show_players(), show_ruleset_info(), show_rulesets(), show_scenarios(), show_serverid(), show_settings(), show_teams(), show_votes(), start_cmd_reply(), surrender_command(), take_command(), team_command(), timeout_command(), toggle_ai_player_direct(), unignore_command(), unlock_command(), validate_setting_arg(), vote_command(), and write_command().
|
static |
Feedback related to server commands caller == nullptr means console. No longer duplicate all output to console.
This lowlevel function takes a single line; prefix is prepended to line.
Definition at line 329 of file stdinhand.c.
Referenced by vcmd_reply_prefix().
|
static |
Send a reply to the caller listing the matched names from an ambiguous prefix.
Definition at line 6535 of file stdinhand.c.
Referenced by show_help().
|
static |
Command specific argument parsing has detected that connection argument is invalid. This function is common handling for that situation.
Definition at line 466 of file stdinhand.c.
Referenced by cmdlevel_command(), cut_client_connection(), detach_command(), kick_command(), observe_command(), and take_command().
|
static |
Command specific argument parsing has detected that player argument is invalid. This function is common handling for that situation.
Definition at line 431 of file stdinhand.c.
Referenced by aicmd_command(), debug_command(), delegate_command(), observe_command(), playercolor_command(), playernation_command(), remove_player_command(), set_ai_level(), take_command(), team_command(), and toggle_ai_command().
|
static |
Definition at line 403 of file stdinhand.c.
|
static |
var-args version of above duplicate declaration required for attribute to work...
Referenced by show_help_command(), show_help_option(), show_nationsets(), and show_settings_one().
Change command access level for individual player, or all, or new.
Definition at line 1439 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Convert a named command into an id. If accept_ambiguity is true, return the first command in the enum list which matches, else return CMD_AMBIGUOUS on ambiguity. (This is a trick to allow ambiguity to be handled in a flexible way without importing notify_player() messages inside this routine - rp)
Definition at line 226 of file stdinhand.c.
Referenced by handle_stdin_input_real().
| bool conn_is_kicked | ( | struct connection * | pconn, |
| int * | time_remaining | ||
| ) |
Returns FALSE if the connection isn't kicked and can connect the server normally.
Definition at line 6287 of file stdinhand.c.
Referenced by handle_login_request().
Set message to send to all new connections
Definition at line 1921 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Creates a named AI player. The function can be called before the start of the game (see create_command_pregame()) and for a running game (see create_command_newcomer(). In the later case, first free player slots are used before the slots of dead players are (re)used.
Definition at line 724 of file stdinhand.c.
Referenced by handle_stdin_input_real().
| enum rfc_status create_command_newcomer | ( | const char * | name, |
| const char * | ai, | ||
| bool | check, | ||
| struct nation_type * | pnation, | ||
| struct player ** | newplayer, | ||
| char * | buf, | ||
| size_t | buflen | ||
| ) |
Try to add a player to a running game in the following order:
If 'pnation' is defined this nation is used for the new player.
Definition at line 782 of file stdinhand.c.
Referenced by api_edit_create_player(), and create_command().
| enum rfc_status create_command_pregame | ( | const char * | name, |
| const char * | ai, | ||
| bool | check, | ||
| struct player ** | newplayer, | ||
| char * | buf, | ||
| size_t | buflen | ||
| ) |
Create player in pregame.
Definition at line 970 of file stdinhand.c.
Referenced by api_edit_create_player(), and create_command().
Handle cut command
Definition at line 6242 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Turn on selective debugging.
Definition at line 2706 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Set a setting to its default value
Definition at line 4943 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Returns possible parameters for the 'delegate' command.
Definition at line 5178 of file stdinhand.c.
Referenced by delegate_command().
Handle delegation of control.
Definition at line 5187 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Return static string describing what a connection is connected to.
Definition at line 5641 of file stdinhand.c.
Referenced by delegate_command().
Detach from a player. If that player wasn't /created and you were controlling the player, remove it (and then detach any observers as well).
If called for a global observer connection (where pconn->playing is nullptr) then it will correctly detach from observing mode.
Definition at line 3674 of file stdinhand.c.
Referenced by handle_stdin_input_real().
End the game immediately in a draw.
Definition at line 4751 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Handle explain command
Definition at line 1874 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Returns possible parameters for the fcdb command.
Definition at line 5993 of file stdinhand.c.
Referenced by fcdb_command().
Handle the freeciv database script module.
Definition at line 6003 of file stdinhand.c.
Referenced by handle_stdin_input_real().
|
static |
This special command to set the command access level is not included into cmdlevel_command because of its lower access level: it can be used to promote one's own connection to 'first come' cmdlevel if that isn't already taken.
Definition at line 1582 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Return a list of init scripts found on the data path. Caller should free. These are conventionally scripts that load rulesets (generally containing just a 'rulesetdir' command).
Definition at line 1247 of file stdinhand.c.
| bool handle_stdin_input | ( | struct connection * | caller, |
| char * | str | ||
| ) |
Main entry point for "command input". Version to be used with statically allocated 'str'
Definition at line 4419 of file stdinhand.c.
Referenced by check_vote(), and handle_chat_msg_req().
| bool handle_stdin_input_free | ( | struct connection * | caller, |
| char * | str | ||
| ) |
Entry point for "command input". Version that frees 'str' in the end.
Definition at line 4427 of file stdinhand.c.
Referenced by server_sniff_all_input().
|
static |
Handle "command input", which could really come from stdin on console, or from client chat command, or read from file with -r, etc. caller == nullptr means console, str is the input, which may optionally start with SERVER_COMMAND_PREFIX character.
If check is TRUE, then do nothing, just check syntax.
Definition at line 4446 of file stdinhand.c.
Referenced by handle_stdin_input(), handle_stdin_input_free(), handle_stdin_input_real(), and read_init_script_real().
Convert unified helparg index to string; see above.
Definition at line 6591 of file stdinhand.c.
Referenced by show_help().
/ignore command handler.
Definition at line 4069 of file stdinhand.c.
Referenced by handle_stdin_input_real().
|
static |
Check game.allow_take and fcdb if enabled for permission to take or observe a player.
NB: If this function returns FALSE, then callers expect that 'msg' will be filled in with a nullptr-terminated string containing the reason.
Definition at line 3192 of file stdinhand.c.
Referenced by observe_command(), and take_command().
Return whether first access level is already taken.
Definition at line 1397 of file stdinhand.c.
Referenced by firstlevel_command(), and notify_if_first_access_level_is_available().
|
static |
Are we operating under a restricted security regime? For now this does not do much.
Definition at line 187 of file stdinhand.c.
Referenced by connectmsg_command(), load_command(), lua_command(), read_init_script_real(), save_command(), scensave_command(), set_rulesetdir(), and write_command().
Kick command handler.
Definition at line 6337 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Returns possible parameters for the list command.
Definition at line 7108 of file stdinhand.c.
Referenced by show_list().
| bool load_command | ( | struct connection * | caller, |
| const char * | filename, | ||
| bool | check, | ||
| bool | cmdline_load | ||
| ) |
Loads a file, complete with access checks and error messages sent back to the caller on failure.
caller is the connection requesting the load, or nullptr for a command-line load. Error messages are sent back to the caller and an access check is done to make sure they are allowed to load.
filename is simply the name of the file to be loaded. This may be approximate; the function will look for appropriate suffixes and will check in the various directories to see if the file is found.
if check is set then only a test run is done and no actual loading is attempted.
The return value is true if the load succeeds, or would succeed; false if there's an error in the file or file name. Some errors in loading however could be unrecoverable (if the save game is legitimate but has inconsistencies) and would lead to a broken server afterwards.
Definition at line 3781 of file stdinhand.c.
Referenced by handle_stdin_input_real(), and srv_prepare().
Handle lock command
Definition at line 3132 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Find option index by name. Return index (>=0) on success, else returned
Definition at line 1718 of file stdinhand.c.
Referenced by explain_option(), show_settings(), and validate_setting_arg().
|
static |
Find option level number by name.
Definition at line 1692 of file stdinhand.c.
Referenced by lookup_option(), and show_settings().
Returns possible parameters for the reset command.
Definition at line 4986 of file stdinhand.c.
Referenced by lua_command().
|
static |
Evaluate a line of lua script or a lua script file.
Definition at line 4996 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Returns possible parameters for the mapimg command.
Definition at line 5680 of file stdinhand.c.
Referenced by mapimg_command().
Handle mapimg command
Definition at line 5690 of file stdinhand.c.
Referenced by handle_stdin_input_real().
|
static |
Whether the caller can use the specified command. caller == nullptr means console.
Definition at line 277 of file stdinhand.c.
Referenced by show_help_command_list().
|
static |
Whether the caller cannot use any commands at all. caller == nullptr means console.
Definition at line 290 of file stdinhand.c.
Referenced by handle_stdin_input_real(), and show_help().
Handle metaconnection command.
Definition at line 527 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Handle metapatches command.
Definition at line 585 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Handle metaserver command.
Definition at line 610 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Check if first access level is available and if it is, notify connections about it.
Definition at line 1425 of file stdinhand.c.
Referenced by lost_connection_to_client().
Observe another player. If we were already attached, detach (see connection_detach()). The console and those with ALLOW_HACK can use the two-argument command and force others to observe.
Definition at line 3334 of file stdinhand.c.
Referenced by handle_stdin_input_real().
|
static |
Start sending game info to metaserver.
Definition at line 500 of file stdinhand.c.
Referenced by metaconnection_command().
Returns possible parameters for the commands that take server options as parameters (CMD_EXPLAIN and CMD_SET).
Definition at line 1623 of file stdinhand.c.
Referenced by helparg_accessor(), and lookup_option().
Check the player name. Returns TRUE if the player name is valid else an error message is saved in 'buf'.
Definition at line 196 of file stdinhand.c.
Referenced by create_command_newcomer(), and create_command_pregame().
/playercolor command handler.
Definition at line 4193 of file stdinhand.c.
Referenced by handle_stdin_input_real().
/playernation command handler.
Definition at line 4278 of file stdinhand.c.
Referenced by handle_stdin_input_real().
|
static |
Definition at line 4405 of file stdinhand.c.
Referenced by handle_stdin_input_real().
|
static |
Main entry point for the read command.
Definition at line 1136 of file stdinhand.c.
Referenced by handle_stdin_input_real().
| bool read_init_script | ( | struct connection * | caller, |
| const char * | script_filename, | ||
| bool | from_cmdline, | ||
| bool | check | ||
| ) |
Main entry point for reading an init script.
Definition at line 1145 of file stdinhand.c.
Referenced by handle_ruleset_select(), and srv_main().
|
static |
Returns FALSE iff there was an error.
Security: We will look for a file with mandatory extension '.serv', and on public servers we will not look outside the data directories. As long as the user cannot create files with arbitrary names in the root of the data directories, this should ensure that we will not be tricked into loading non-approved content. The script is read with the permissions of the caller, so it will in any case not lead to elevated permissions unless there are other bugs.
Definition at line 1163 of file stdinhand.c.
Referenced by read_command(), read_init_script(), and reset_command().
Handle remove command.
Definition at line 1098 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Returns possible parameters for the reset command.
Definition at line 4825 of file stdinhand.c.
Referenced by reset_command().
|
static |
Reload the game settings from the ruleset and reload the init script if one was used.
Definition at line 4836 of file stdinhand.c.
Referenced by handle_stdin_input_real().
|
static |
Callback called from modpack ruleset cache iteration.
Definition at line 6865 of file stdinhand.c.
Referenced by show_rulesets().
For command "save foo"; Save the game, with filename=arg, provided server state is ok.
Definition at line 640 of file stdinhand.c.
Referenced by handle_stdin_input_real().
For command "scensave foo"; Save the game, with filename=arg, provided server state is ok.
Definition at line 658 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Set an AI level from the server prompt.
Definition at line 1985 of file stdinhand.c.
Referenced by split_player(), and srv_ready().
|
static |
Handle a user command to set an AI level.
Definition at line 1998 of file stdinhand.c.
Referenced by handle_stdin_input_real().
|
static |
Set ptarget's cmdlevel to level if caller is allowed to do so
Definition at line 1354 of file stdinhand.c.
Referenced by cmdlevel_command().
Handle set command
Definition at line 2951 of file stdinhand.c.
Referenced by handle_stdin_input_real().
| bool set_rulesetdir | ( | struct connection * | caller, |
| const char * | str, | ||
| bool | check, | ||
| int | read_recursion | ||
| ) |
Load rulesets from a given ruleset directory.
Security: There are some rudimentary checks in load_rulesets() to see if this directory really is a viable ruleset directory. For public servers, we check against directory redirection (is_safe_filename) and other bad stuff in the directory name, and will only use directories inside the data directories.
Definition at line 3968 of file stdinhand.c.
Referenced by handle_ruleset_select(), and handle_stdin_input_real().
Adjust default command level on game start.
Definition at line 1610 of file stdinhand.c.
Referenced by start_game().
Return the status of the setting (changeable, locked, fixed). caller == nullptr means console.
Definition at line 303 of file stdinhand.c.
Referenced by show_settings_one().
|
static |
Show a list of AI types supported
Definition at line 7044 of file stdinhand.c.
Referenced by show_list().
|
static |
Show a list of all players with the assigned color.
Definition at line 7059 of file stdinhand.c.
Referenced by show_list().
/show command: show settings and their values.
Definition at line 2132 of file stdinhand.c.
Referenced by handle_stdin_input_real().
|
static |
List connections; initially mainly for debugging
Definition at line 6673 of file stdinhand.c.
Referenced by show_list().
|
static |
List all delegations of the current game.
Definition at line 6699 of file stdinhand.c.
Referenced by show_list().
|
static |
Handle help command
Definition at line 6610 of file stdinhand.c.
Referenced by handle_stdin_input_real().
|
static |
Show the caller detailed help for the single COMMAND given by id. help_cmd is the command the player used.
Definition at line 6451 of file stdinhand.c.
Referenced by show_help().
|
static |
Show the caller list of COMMANDS. help_cmd is the command the player used.
Definition at line 6497 of file stdinhand.c.
Referenced by show_help().
|
static |
Show caller introductory help about the server. help_cmd is the command the player used.
Definition at line 6418 of file stdinhand.c.
Referenced by show_help().
|
static |
Show the caller detailed help for the single OPTION given by id. help_cmd is the command the player used. Only show option values for options which the caller can SEE.
Definition at line 1747 of file stdinhand.c.
Referenced by explain_option(), and show_help().
|
static |
Show the caller list of OPTIONS. help_cmd is the command the player used. Only show options which the caller can SEE.
Definition at line 1838 of file stdinhand.c.
Referenced by explain_option(), and show_help().
|
static |
|
static |
Show list of players or connections, or connection statistics.
Definition at line 7117 of file stdinhand.c.
Referenced by handle_stdin_input_real().
|
static |
Show a list of all map image definitions on the command line.
Definition at line 7022 of file stdinhand.c.
Referenced by mapimg_command(), and show_list().
|
static |
List nation sets in the current ruleset.
Definition at line 6953 of file stdinhand.c.
Referenced by show_list().
| void show_players | ( | struct connection * | caller | ) |
Show the list of the players of the game.
Definition at line 6765 of file stdinhand.c.
Referenced by show_list().
|
static |
Show changed settings and ruleset summary.
Definition at line 2107 of file stdinhand.c.
Referenced by read_init_script_real(), reset_command(), and set_rulesetdir().
|
static |
|
static |
List scenarios. We look both in the DATA_PATH and DATA_PATH/scenario
Definition at line 6927 of file stdinhand.c.
Referenced by show_list().
|
static |
Returns the serverid
Definition at line 629 of file stdinhand.c.
Referenced by handle_stdin_input_real().
|
static |
Print a summary of the settings and their values. Note that most values are at most 4 digits, except seeds, which we let overflow their columns, plus a sign character. Only show options which the caller can SEE.
Definition at line 2142 of file stdinhand.c.
Referenced by show_command(), and show_ruleset_info().
|
static |
Show one setting.
Each option value will be displayed as:
[OPTION_NAME_SPACE length for name] ## [value] ([min], [max])
where '##' is a combination of ' ', '!' or '+' followed by ' ', '*', or '=' with
Definition at line 2315 of file stdinhand.c.
Referenced by show_settings().
|
static |
Show a list of teams on the command line.
Definition at line 6992 of file stdinhand.c.
Referenced by show_list().
|
static |
List all running votes. Moved from /vote command.
Definition at line 2456 of file stdinhand.c.
Referenced by show_list(), and vote_command().
Send start command related message
Definition at line 6105 of file stdinhand.c.
Referenced by start_command().
| bool start_command | ( | struct connection * | caller, |
| bool | check, | ||
| bool | notify | ||
| ) |
Handle start command. Notify all players about errors if notify set.
Definition at line 6116 of file stdinhand.c.
Referenced by handle_observer_ready(), handle_player_ready(), and handle_stdin_input_real().
Deinitialize stuff related to this code module.
Definition at line 258 of file stdinhand.c.
Referenced by server_quit().
Initialize stuff related to this code module.
Definition at line 246 of file stdinhand.c.
Referenced by srv_prepare().
Concede the game. You still continue playing until all but one player or team remains un-conceded.
Definition at line 4776 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Take over a player. If a connection already has control of that player, disallow it.
If there are two arguments, treat the first as the connection name and the second as the player name (only hack and the console can do this). Otherwise, there should be one argument, that being the player that the caller wants to take.
Definition at line 3483 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Handle team command
Definition at line 2379 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Utility for 'kick_hash' tables.
Definition at line 6274 of file stdinhand.c.
Set timeout options.
Definition at line 1647 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Handle aitoggle command.
Definition at line 700 of file stdinhand.c.
Referenced by handle_stdin_input_real().
| void toggle_ai_player_direct | ( | struct connection * | caller, |
| struct player * | pplayer | ||
| ) |
Handle ai player ai toggling.
Definition at line 675 of file stdinhand.c.
Referenced by autotoggle_action(), connection_attach_real(), connection_detach(), srv_ready(), and toggle_ai_command().
/unignore command handler.
Definition at line 4104 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Handle unlock command
Definition at line 3160 of file stdinhand.c.
Referenced by handle_stdin_input_real().
|
static |
Helper to validate an argument referring to a server setting. Sends error message and returns nullptr on failure.
Definition at line 2916 of file stdinhand.c.
Referenced by default_command(), lock_command(), set_command(), and unlock_command().
|
static |
va_list version which allow embedded newlines, and each line is sent separately. 'prefix' is prepended to every line after the first line.
Definition at line 376 of file stdinhand.c.
Referenced by cmd_reply(), and cmd_reply_prefix().
Definition at line 2497 of file stdinhand.c.
Referenced by vote_command().
Make or participate in a vote.
Definition at line 2505 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Send a message to all players
Definition at line 1908 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Generate init script from settings currently in use
Definition at line 1315 of file stdinhand.c.
Referenced by handle_stdin_input_real().
Write current settings to new init script.
(Should this take a 'caller' argument for output? –dwp)
Definition at line 1257 of file stdinhand.c.
Referenced by write_command().
|
static |
Definition at line 101 of file stdinhand.c.
Referenced by access_level_for_next_connection(), cmdlevel_command(), notify_if_first_access_level_is_available(), set_running_game_access_level(), and write_init_script().
|
static |
Definition at line 102 of file stdinhand.c.
Referenced by access_level_for_next_connection(), cmdlevel_command(), firstlevel_command(), is_first_access_level_taken(), notify_if_first_access_level_is_available(), and write_init_script().
Definition at line 180 of file stdinhand.c.
Referenced by cmdlevel_command(), show_ais(), show_colors(), show_connections(), show_delegations(), show_help_command_list(), show_help_option_list(), show_ignore(), show_mapimg(), show_nationsets(), show_players(), show_ruleset_info(), show_rulesets(), show_scenarios(), show_settings(), and show_teams().
Definition at line 119 of file stdinhand.c.
Referenced by conn_is_kicked(), kick_command(), stdinhand_free(), and stdinhand_init().
Definition at line 120 of file stdinhand.c.
Referenced by conn_is_kicked(), kick_command(), stdinhand_free(), and stdinhand_init().
Definition at line 117 of file stdinhand.c.
Referenced by read_init_script_real(), and write_command().
Vote command argument definitions.
Definition at line 2491 of file stdinhand.c.
Referenced by vote_arg_accessor().