![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <fc_config.h>#include <cstdarg>#include <cstdio>#include <cstdlib>#include <cstring>#include <QCoreApplication>#include <QRegularExpression>#include <readline/readline.h>#include "astring.h"#include "bitvector.h"#include "fciconv.h"#include "fcintl.h"#include "log.h"#include "rand.h"#include "registry.h"#include "section_file.h"#include "shared.h"#include "support.h"#include "timing.h"#include "featured_text.h"#include "game.h"#include "map.h"#include "mapimg.h"#include "packets.h"#include "player.h"#include "research.h"#include "rgbcolor.h"#include "style.h"#include "unitlist.h"#include "version.h"#include "aiiface.h"#include "commands.h"#include "connecthand.h"#include "diplhand.h"#include "gamehand.h"#include "maphand.h"#include "meta.h"#include "notify.h"#include "plrhand.h"#include "ruleset.h"#include "sanitycheck.h"#include "settings.h"#include "srv_log.h"#include "srv_main.h"#include "techtools.h"#include "voting.h"#include "savemain.h"#include "script_fcdb.h"#include "script_server.h"#include "difficulty.h"#include "stdinhand.h"#include <set>#include <string>#include "specenum_gen.h"Go to the source code of this file.
Macros | |
| #define | OPTION_NAME_SPACE 25 |
| #define | REG_EXP "\\s+(?=([^\"]*\"[^\"]*\")*[^\"]*$)" |
| #define | LOOKUP_OPTION_NO_RESULT (-1) |
| #define | LOOKUP_OPTION_AMBIGUOUS (-2) |
| #define | LOOKUP_OPTION_LEVEL_NAME (-3) |
| #define | LOOKUP_OPTION_RULESETDIR (-4) |
| #define | cmd_reply_show(string) cmd_reply(called_as, caller, C_COMMENT, "%s", string) |
| #define | SPECENUM_NAME reset_args |
| Additional 'help' arguments. More... | |
| #define | SPECENUM_VALUE0 RESET_GAME |
| #define | SPECENUM_VALUE0NAME "game" |
| #define | SPECENUM_VALUE1 RESET_RULESET |
| #define | SPECENUM_VALUE1NAME "ruleset" |
| #define | SPECENUM_VALUE2 RESET_SCRIPT |
| #define | SPECENUM_VALUE2NAME "script" |
| #define | SPECENUM_VALUE3 RESET_DEFAULT |
| #define | SPECENUM_VALUE3NAME "default" |
| #define | SPECENUM_NAME lua_args |
| Additional 'help' arguments. More... | |
| #define | SPECENUM_VALUE0 LUA_CMD |
| #define | SPECENUM_VALUE0NAME "cmd" |
| #define | SPECENUM_VALUE1 LUA_FILE |
| #define | SPECENUM_VALUE1NAME "file" |
| #define | SPECENUM_VALUE2 LUA_UNSAFE_CMD |
| #define | SPECENUM_VALUE2NAME "unsafe-cmd" |
| #define | SPECENUM_VALUE3 LUA_UNSAFE_FILE |
| #define | SPECENUM_VALUE3NAME "unsafe-file" |
| #define | SPECENUM_NAME delegate_args |
| Additional 'help' arguments. More... | |
| #define | SPECENUM_VALUE0 DELEGATE_CANCEL |
| #define | SPECENUM_VALUE0NAME "cancel" |
| #define | SPECENUM_VALUE1 DELEGATE_RESTORE |
| #define | SPECENUM_VALUE1NAME "restore" |
| #define | SPECENUM_VALUE2 DELEGATE_SHOW |
| #define | SPECENUM_VALUE2NAME "show" |
| #define | SPECENUM_VALUE3 DELEGATE_TAKE |
| #define | SPECENUM_VALUE3NAME "take" |
| #define | SPECENUM_VALUE4 DELEGATE_TO |
| #define | SPECENUM_VALUE4NAME "to" |
| #define | SPECENUM_NAME mapimg_args |
| Additional 'help' arguments. More... | |
| #define | SPECENUM_VALUE0 MAPIMG_COLORTEST |
| #define | SPECENUM_VALUE0NAME "colortest" |
| #define | SPECENUM_VALUE1 MAPIMG_CREATE |
| #define | SPECENUM_VALUE1NAME "create" |
| #define | SPECENUM_VALUE2 MAPIMG_DEFINE |
| #define | SPECENUM_VALUE2NAME "define" |
| #define | SPECENUM_VALUE3 MAPIMG_DELETE |
| #define | SPECENUM_VALUE3NAME "delete" |
| #define | SPECENUM_VALUE4 MAPIMG_SHOW |
| #define | SPECENUM_VALUE4NAME "show" |
| #define | SPECENUM_COUNT MAPIMG_COUNT |
| #define | SPECENUM_NAME fcdb_args |
| Additional 'help' arguments. More... | |
| #define | SPECENUM_VALUE0 FCDB_RELOAD |
| #define | SPECENUM_VALUE0NAME "reload" |
| #define | SPECENUM_VALUE1 FCDB_LUA |
| #define | SPECENUM_VALUE1NAME "lua" |
| #define | SPECENUM_COUNT FCDB_COUNT |
| #define | SPECENUM_NAME help_general_args |
| Additional 'help' arguments. More... | |
| #define | SPECENUM_VALUE0 HELP_GENERAL_COMMANDS |
| #define | SPECENUM_VALUE0NAME "commands" |
| #define | SPECENUM_VALUE1 HELP_GENERAL_OPTIONS |
| #define | SPECENUM_VALUE1NAME "options" |
| #define | SPECENUM_COUNT HELP_GENERAL_COUNT |
| #define | HELP_ARG_NUM (CMD_NUM + HELP_GENERAL_COUNT + settings_number()) |
| #define | SPECENUM_NAME list_args |
| Additional 'help' arguments. More... | |
| #define | SPECENUM_VALUE0 LIST_COLORS |
| #define | SPECENUM_VALUE0NAME "colors" |
| #define | SPECENUM_VALUE1 LIST_CONNECTIONS |
| #define | SPECENUM_VALUE1NAME "connections" |
| #define | SPECENUM_VALUE2 LIST_DELEGATIONS |
| #define | SPECENUM_VALUE2NAME "delegations" |
| #define | SPECENUM_VALUE3 LIST_IGNORE |
| #define | SPECENUM_VALUE3NAME "ignored users" |
| #define | SPECENUM_VALUE4 LIST_MAPIMG |
| #define | SPECENUM_VALUE4NAME "map image definitions" |
| #define | SPECENUM_VALUE5 LIST_PLAYERS |
| #define | SPECENUM_VALUE5NAME "players" |
| #define | SPECENUM_VALUE6 LIST_RULESETS |
| #define | SPECENUM_VALUE6NAME "rulesets" |
| #define | SPECENUM_VALUE7 LIST_SCENARIOS |
| #define | SPECENUM_VALUE7NAME "scenarios" |
| #define | SPECENUM_VALUE8 LIST_NATIONSETS |
| #define | SPECENUM_VALUE8NAME "nationsets" |
| #define | SPECENUM_VALUE9 LIST_TEAMS |
| #define | SPECENUM_VALUE9NAME "teams" |
| #define | SPECENUM_VALUE10 LIST_VOTES |
| #define | SPECENUM_VALUE10NAME "votes" |
Typedefs | |
| typedef QHash< QString, time_t > | kickhash |
Functions | |
| static bool | cut_client_connection (struct connection *caller, char *name, bool check) |
| Handle cut command. More... | |
| static bool | show_help (struct connection *caller, char *arg) |
| Handle help command. More... | |
| static bool | show_list (struct connection *caller, char *arg) |
| Show list of players or connections, or connection statistics. More... | |
| static void | show_colors (struct connection *caller) |
| Show a list of all players with the assigned color. More... | |
| static bool | set_ai_level_named (struct connection *caller, const char *name, const char *level_name, bool check) |
| Handle a user command to set an AI level. More... | |
| static bool | set_ai_level (struct connection *caller, const char *name, enum ai_level level, bool check) |
| Set AI level. More... | |
| static bool | away_command (struct connection *caller, bool check) |
| Set user to away mode. More... | |
| static bool | set_rulesetdir (struct connection *caller, char *str, bool check, int read_recursion) |
| Load rulesets from a given ruleset directory. More... | |
| static bool | show_command (struct connection *caller, char *str, bool check) |
| /show command: show settings and their values. More... | |
| static bool | show_settings (struct connection *caller, enum command_id called_as, char *str, bool check) |
| Print a summary of the settings and their values. More... | |
| static void | show_settings_one (struct connection *caller, enum command_id cmd, struct setting *pset) |
| Show one setting. More... | |
| static void | show_ruleset_info (struct connection *caller, enum command_id cmd, bool check, int read_recursion) |
| Show changed settings and ruleset summary. More... | |
| static void | show_mapimg (struct connection *caller, enum command_id cmd) |
| Show a list of all map image definitions on the command line. More... | |
| static bool | set_command (struct connection *caller, char *str, bool check) |
| Handle set command. More... | |
| static bool | create_command (struct connection *caller, const char *str, bool check) |
| Creates a named AI player. More... | |
| static bool | end_command (struct connection *caller, char *str, bool check) |
| End the game immediately in a draw. More... | |
| static bool | surrender_command (struct connection *caller, char *str, bool check) |
| Concede the game. More... | |
| static bool | handle_stdin_input_real (struct connection *caller, char *str, bool check, int read_recursion) |
| Handle "command input", which could really come from stdin on console, or from client chat command, or read from file with -r, etc. More... | |
| static bool | read_init_script_real (struct connection *caller, const char *script_filename, bool from_cmdline, bool check, int read_recursion) |
| Returns FALSE iff there was an error. More... | |
| static bool | reset_command (struct connection *caller, char *arg, bool check, int read_recursion) |
| Reload the game settings from the ruleset and reload the init script if one was used. More... | |
| static bool | default_command (struct connection *caller, char *arg, bool check) |
| Set a setting to its default value. More... | |
| static bool | lua_command (struct connection *caller, char *arg, bool check, int read_recursion) |
| Evaluate a line of lua script or a lua script file. More... | |
| static bool | kick_command (struct connection *caller, char *name, bool check) |
| Kick command handler. More... | |
| static bool | delegate_command (struct connection *caller, char *arg, bool check) |
| Handle delegation of control. More... | |
| static QString | delegate_player_str (struct player *pplayer, bool observer) |
| Return static string describing what a connection is connected to. More... | |
| static bool | aicmd_command (struct connection *caller, char *arg, bool check) |
| Execute a command in the context of the AI of the player. More... | |
| static bool | fcdb_command (struct connection *caller, char *arg, bool check) |
| Handle the freeciv database script module. More... | |
| static const char * | fcdb_accessor (int i) |
| Returns possible parameters for the fcdb command. More... | |
| static char | setting_status (struct connection *caller, const struct setting *pset) |
| Return the status of the setting (changeable, locked, fixed). More... | |
| static bool | player_name_check (const char *name, char *buf, size_t buflen) |
| Check the player name. More... | |
| static bool | playercolor_command (struct connection *caller, char *str, bool check) |
| /playercolor command handler. More... | |
| static bool | playernation_command (struct connection *caller, char *str, bool check) |
| /playernation command handler. More... | |
| static bool | mapimg_command (struct connection *caller, char *arg, bool check) |
| Handle mapimg command. More... | |
| static const char * | mapimg_accessor (int i) |
| Returns possible parameters for the mapimg command. More... | |
| static void | show_delegations (struct connection *caller) |
| List all delegations of the current game. More... | |
| static void | remove_quotes (QStringList &str) |
| static bool | is_restricted (struct connection *caller) |
| Are we operating under a restricted security regime? For now this does not do much. More... | |
| static enum command_id | command_named (const char *token, bool accept_ambiguity) |
| Convert a named command into an id. More... | |
| void | stdinhand_init () |
| Initialize stuff related to this code module. More... | |
| void | stdinhand_turn () |
| Update stuff every turn that is related to this code module. More... | |
| void | stdinhand_free () |
| Deinitialize stuff related to this code module. More... | |
| static bool | may_use (struct connection *caller, enum command_id cmd) |
| Whether the caller can use the specified command. More... | |
| static bool | may_use_nothing (struct connection *caller) |
| Whether the caller cannot use any commands at all. More... | |
| static void | cmd_reply_line (enum command_id cmd, struct connection *caller, enum rfc_status rfc_status, const char *prefix, const char *line) |
| feedback related to server commands caller == nullptr means console. More... | |
| static void | vcmd_reply_prefix (enum command_id cmd, struct connection *caller, enum rfc_status rfc_status, const char *prefix, const char *format, va_list ap) |
| va_list version which allow embedded newlines, and each line is sent separately. More... | |
| static void | cmd_reply_prefix (enum command_id cmd, struct connection *caller, enum rfc_status rfc_status, const char *prefix, const char *format,...) fc__attribute((__format__(__printf__ |
| var-args version of above duplicate declaration required for attribute to work... More... | |
| static void static void | cmd_reply_prefix (enum command_id cmd, struct connection *caller, enum rfc_status rfc_status, const char *prefix, const char *format,...) |
| 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 More... | |
| static void | cmd_reply_no_such_player (enum command_id cmd, struct connection *caller, const char *name, enum m_pre_result match_result) |
| Command specific argument parsing has detected that player argument is invalid. More... | |
| static void | cmd_reply_no_such_conn (enum command_id cmd, struct connection *caller, const char *name, enum m_pre_result match_result) |
| Command specific argument parsing has detected that connection argument is invalid. More... | |
| static void | open_metaserver_connection (struct connection *caller, bool persistent) |
| Start sending game info to metaserver. More... | |
| static void | close_metaserver_connection (struct connection *caller) |
| Stop sending game info to metaserver. More... | |
| static bool | metaconnection_command (struct connection *caller, char *arg, bool check) |
| Handle metaconnection command. More... | |
| static bool | metapatches_command (struct connection *caller, char *arg, bool check) |
| Handle metapatches command. More... | |
| static bool | metamessage_command (struct connection *caller, char *arg, bool check) |
| Handle metamessage command. More... | |
| static bool | metaserver_command (struct connection *caller, char *arg, bool check) |
| Handle metaserver command. More... | |
| static bool | show_serverid (struct connection *caller, char *arg) |
| Returns the serverid. More... | |
| static bool | save_command (struct connection *caller, char *arg, bool check) |
| For command "save foo"; Save the game, with filename=arg, provided server state is ok. More... | |
| static bool | scensave_command (struct connection *caller, char *arg, bool check) |
| For command "scensave foo"; Save the game, with filename=arg, provided server state is ok. More... | |
| void | toggle_ai_player_direct (struct connection *caller, struct player *pplayer) |
| Handle ai player ai toggling. More... | |
| static bool | toggle_ai_command (struct connection *caller, char *arg, bool check) |
| Handle aitoggle command. More... | |
| 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: More... | |
| 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. More... | |
| static bool | remove_player_command (struct connection *caller, char *arg, bool check) |
| Handle remove command. More... | |
| static bool | read_command (struct connection *caller, char *arg, bool check, int read_recursion) |
| Main entry point for the read command. More... | |
| bool | read_init_script (struct connection *caller, const char *script_filename, bool from_cmdline, bool check) |
| Main entry point for reading an init script. More... | |
| QVector< QString > * | get_init_script_choices () |
| Return a list of init scripts found on the data path. More... | |
| static void | write_init_script (char *script_filename) |
| Write current settings to new init script. More... | |
| static bool | write_command (struct connection *caller, char *arg, bool check) |
| Generate init script from settings currently in use. More... | |
| static bool | set_cmdlevel (struct connection *caller, struct connection *ptarget, enum cmdlevel level) |
| Set ptarget's cmdlevel to level if caller is allowed to do so. More... | |
| static bool | a_connection_exists () |
| Returns true if there is at least one established connection. More... | |
| static bool | is_first_access_level_taken () |
| Return whether first access level is already taken. More... | |
| enum cmdlevel | access_level_for_next_connection () |
| Return access level for next connection. More... | |
| void | notify_if_first_access_level_is_available () |
| Check if first access level is available and if it is, notify connections about it. More... | |
| static bool | cmdlevel_command (struct connection *caller, char *str, bool check) |
| Change command access level for individual player, or all, or new. More... | |
| static bool | firstlevel_command (struct connection *caller, bool check) |
| 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. More... | |
| void | set_running_game_access_level () |
| Adjust default command level on game start. More... | |
| static const char * | optname_accessor (int i) |
| Returns possible parameters for the commands that take server options as parameters (CMD_EXPLAIN and CMD_SET). More... | |
| static const char * | olvlname_accessor (int i) |
| Returns possible parameters for the /show command. More... | |
| static bool | timeout_show_command (struct connection *caller, char *str, bool check) |
| Show the current timeout, time left before TC, etc. More... | |
| static bool | timeout_set_command (struct connection *caller, char *str, bool check, command_id self, bool add) |
| Sets the timeout for the current turn. More... | |
| static bool | timeout_command (struct connection *caller, char *str, bool check) |
| Set timeout options. More... | |
| static enum sset_level | lookup_option_level (const char *name) |
| Find option level number by name. More... | |
| static int | lookup_option (const char *name) |
| Find option index by name. More... | |
| static void | show_help_option (struct connection *caller, enum command_id help_cmd, int id) |
| Show the caller detailed help for the single OPTION given by id. More... | |
| static void | show_help_option_list (struct connection *caller, enum command_id help_cmd) |
| Show the caller list of OPTIONS. More... | |
| static bool | explain_option (struct connection *caller, char *str, bool check) |
| Handle explain command. More... | |
| static bool | wall (char *str, bool check) |
| Send a message to all players. More... | |
| static bool | connectmsg_command (struct connection *caller, char *str, bool check) |
| Set message to send to all new connections. More... | |
| static enum command_id | cmd_of_level (enum ai_level level) |
| Translate an AI level back to its CMD_* value. More... | |
| void | set_ai_level_direct (struct player *pplayer, enum ai_level level) |
| Set an AI level from the server prompt. More... | |
| static bool | team_command (struct connection *caller, char *str, bool check) |
| Handle team command. More... | |
| static void | show_votes (struct connection *caller) |
| List all running votes. More... | |
| static const char * | vote_arg_accessor (int i) |
| static bool | vote_command (struct connection *caller, char *str, bool check) |
| Make or participate in a vote. More... | |
| static bool | cancelvote_command (struct connection *caller, char *arg, bool check) |
| Cancel a vote... More... | |
| static bool | debug_command (struct connection *caller, char *str, bool check) |
| Turn on selective debugging. More... | |
| static struct setting * | validate_setting_arg (enum command_id cmd, struct connection *caller, char *arg) |
| Helper to validate an argument referring to a server setting. More... | |
| static bool | is_allowed_to_take (struct connection *requester, struct connection *taker, struct player *pplayer, bool will_obs, char *msg, size_t msg_len) |
| Check game.allow_take and fcdb if enabled for permission to take or observe a player. More... | |
| static bool | observe_command (struct connection *caller, char *str, bool check) |
| Observe another player. More... | |
| static bool | take_command (struct connection *caller, char *str, bool check) |
| Take over a player. More... | |
| static bool | detach_command (struct connection *caller, char *str, bool check) |
| Detach from a player. More... | |
| 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. More... | |
| static bool | ignore_command (struct connection *caller, char *str, bool check) |
| /ignore command handler. More... | |
| static bool | unignore_command (struct connection *caller, char *str, bool check) |
| /unignore command handler. More... | |
| static bool | quit_game (struct connection *caller, bool check) |
| Handle quit command. More... | |
| bool | should_quit () |
| Returns whether the server should exit after a command. More... | |
| bool | handle_stdin_input (struct connection *caller, char *str) |
| Main entry point for "command input". More... | |
| static const char * | reset_accessor (int i) |
| Returns possible parameters for the reset command. More... | |
| static const char * | lua_accessor (int i) |
| Returns possible parameters for the reset command. More... | |
| static const char * | delegate_accessor (int i) |
| Returns possible parameters for the 'delegate' command. More... | |
| static void | start_cmd_reply (struct connection *caller, bool notify, const char *msg) |
| Send start command related message. More... | |
| bool | start_command (struct connection *caller, bool check, bool notify) |
| Handle start command. More... | |
| bool | conn_is_kicked (struct connection *pconn, int *time_remaining) |
| Returns FALSE if the connection isn't kicked and can connect the server normally. More... | |
| static void | show_help_intro (struct connection *caller, enum command_id help_cmd) |
| Show caller introductory help about the server. More... | |
| static void | show_help_command (struct connection *caller, enum command_id help_cmd, enum command_id id) |
| Show the caller detailed help for the single COMMAND given by id. More... | |
| static void | show_help_command_list (struct connection *caller, enum command_id help_cmd) |
| Show the caller list of COMMANDS. More... | |
| static void | cmd_reply_matches (enum command_id cmd, struct connection *caller, m_pre_accessor_fn_t accessor_fn, int *matches, int num_matches) |
| Send a reply to the caller listing the matched names from an ambiguous prefix. More... | |
| static const char * | helparg_accessor (int i) |
| Convert unified helparg index to string; see above. More... | |
| static void | show_connections (struct connection *caller) |
| List connections; initially mainly for debugging. More... | |
| static bool | show_ignore (struct connection *caller) |
| Show the ignore list of the. More... | |
| void | show_players (struct connection *caller) |
| Show the list of the players of the game. More... | |
| static void | show_rulesets (struct connection *caller) |
| List rulesets (strictly, .serv init script files that conventionally accompany rulesets). More... | |
| static void | show_scenarios (struct connection *caller) |
| List scenarios. More... | |
| static void | show_nationsets (struct connection *caller) |
| List nation sets in the current ruleset. More... | |
| static void | show_teams (struct connection *caller) |
| Show a list of teams on the command line. More... | |
| static const char * | list_accessor (int i) |
| Returns possible parameters for the list command. More... | |
| static char * | generic_generator (const char *text, int state, int num, const char *(*index2str)(int)) |
| A generalised generator function: text and state are "standard" parameters to a readline generator function; num is number of possible completions, or -1 if this is not known and index2str should be iterated until it returns nullptr; index2str is a function which returns each possible completion string by index (it may return nullptr). More... | |
| static char * | command_generator (const char *text, int state) |
| The valid commands at the root of the prompt. More... | |
| static char * | option_generator (const char *text, int state) |
| The valid arguments to "set" and "explain". More... | |
| static char * | olevel_generator (const char *text, int state) |
| The valid arguments to "show". More... | |
| static const char * | option_value_accessor (int idx) |
| static char * | option_value_generator (const char *text, int state) |
| The valid arguments to "set OPT", where OPT is the enumerated or bitwise option previously defined by completion_option. More... | |
| static const char * | playername_accessor (int idx) |
| Access player name. More... | |
| static char * | player_generator (const char *text, int state) |
| The valid playername arguments. More... | |
| static const char * | connection_name_accessor (int idx) |
| Access connection user name, from game.all_connections. More... | |
| static char * | connection_generator (const char *text, int state) |
| The valid connection user name arguments. More... | |
| static const char * | cmdlevel_arg1_accessor (int idx) |
| Extra accessor function since cmdlevel_name() takes enum argument, not int. More... | |
| static char * | cmdlevel_arg1_generator (const char *text, int state) |
| The valid first argument to "cmdlevel". More... | |
| static const char * | cmdlevel_arg2_accessor (int idx) |
| Accessor for the second argument to "cmdlevel": "first" or "new" or a connection name. More... | |
| static char * | cmdlevel_arg2_generator (const char *text, int state) |
| The valid arguments for the second argument to "cmdlevel". More... | |
| static const char * | aitype_accessor (int idx) |
| Accessor for the second argument to "create": ai type name. More... | |
| static char * | aitype_generator (const char *text, int state) |
| The valid arguments for the second argument to "create". More... | |
| static char * | reset_generator (const char *text, int state) |
| The valid arguments for the argument to "reset". More... | |
| static char * | vote_generator (const char *text, int state) |
| The valid arguments for the argument to "vote". More... | |
| static char * | delegate_generator (const char *text, int state) |
| The valid arguments for the first argument to "delegate". More... | |
| static char * | mapimg_generator (const char *text, int state) |
| The valid arguments for the first argument to "mapimg". More... | |
| static char * | fcdb_generator (const char *text, int state) |
| The valid arguments for the argument to "fcdb". More... | |
| static char * | lua_generator (const char *text, int state) |
| The valid arguments for the argument to "lua". More... | |
| static char * | help_generator (const char *text, int state) |
| The valid first arguments to "help". More... | |
| static char * | list_generator (const char *text, int state) |
| The valid first arguments to "list". More... | |
| static bool | contains_token_before_start (int start, int token, const char *arg, bool allow_fluff) |
| Generalised version of contains_str_before_start, which searches the N'th token in rl_line_buffer (0=first). More... | |
| static bool | contains_str_before_start (int start, const char *cmd, bool allow_fluff) |
| Returns whether the text between the start of rl_line_buffer and the start position is of the form [non-alpha]*cmd[non-alpha]* allow_fluff changes the regexp to [non-alpha]*cmd[non-alpha]. More... | |
| static bool | is_command (int start) |
| Return whether we are completing command name. More... | |
| static int | num_tokens (int start) |
| Number of tokens in rl_line_buffer before start. More... | |
| static bool | is_player (int start) |
| Return whether we are completing player name argument. More... | |
| static bool | is_connection (int start) |
| Return whether we are completing connection name argument. More... | |
| static bool | is_cmdlevel_arg2 (int start) |
| Return whether we are completing cmdlevel command argument 2. More... | |
| static bool | is_cmdlevel_arg1 (int start) |
| Return whether we are completing cmdlevel command argument. More... | |
| static bool | is_server_option (int start) |
| Returns TRUE if the readline buffer string matches a server option at the given position. More... | |
| static bool | is_option_level (int start) |
| Returns true if the readline buffer string matches an option level or an option at the given position. More... | |
| static bool | is_enum_option_value (int start, int *opt_p) |
| Returns TRUE if the readline buffer string is such that we expect an enumerated value at the given position. More... | |
| static bool | is_filename (int start) |
| Return whether we are completing filename. More... | |
| static bool | is_create_arg2 (int start) |
| Return whether we are completing second argument for create command. More... | |
| static bool | is_reset (int start) |
| Return whether we are completing argument for reset command. More... | |
| static bool | is_vote (int start) |
| Return whether we are completing argument for vote command. More... | |
| static bool | is_delegate_arg1 (int start) |
| Return whether we are completing first argument for delegate command. More... | |
| static bool | is_mapimg (int start) |
| Return whether we are completing first argument for mapimg command. More... | |
| static bool | is_fcdb (int start) |
| Return whether we are completing argument for fcdb command. More... | |
| static bool | is_lua (int start) |
| Return whether we are completing argument for lua command. More... | |
| static bool | is_help (int start) |
| Return whether we are completing help command argument. More... | |
| static bool | is_list (int start) |
| Return whether we are completing list command argument. More... | |
| char ** | freeciv_completion (const char *text, int start, int end) |
| Attempt to complete on the contents of TEXT. More... | |
Variables | |
| static enum cmdlevel | default_access_level = ALLOW_BASIC |
| static enum cmdlevel | first_access_level = ALLOW_BASIC |
| static const char | horiz_line [] |
| static const char *const | vote_args [] = {"yes", "no", "abstain", nullptr} |
| Vote command argument definitions. More... | |
| static int | completion_option |
| Accessor for values of the enum/bitwise option defined by 'completion_option'. More... | |
| static const int | player_cmd [] |
| Commands that may be followed by a player name. More... | |
| static const int | connection_cmd [] = {CMD_CUT, CMD_KICK, -1} |
| Commands that may be followed by a connection name. More... | |
| static const int | server_option_cmd [] |
| Commands that may be followed by a server option name. More... | |
| static const int | option_level_cmd [] = {CMD_SHOW, -1} |
| Commands that may be followed by an option level or server option. More... | |
| static const int | filename_cmd [] |
| Commands that may be followed by a filename. More... | |
| #define HELP_ARG_NUM (CMD_NUM + HELP_GENERAL_COUNT + settings_number()) |
Definition at line 6572 of file stdinhand.cpp.
| #define LOOKUP_OPTION_AMBIGUOUS (-2) |
Definition at line 1772 of file stdinhand.cpp.
| #define LOOKUP_OPTION_LEVEL_NAME (-3) |
Definition at line 1773 of file stdinhand.cpp.
| #define LOOKUP_OPTION_NO_RESULT (-1) |
Definition at line 1771 of file stdinhand.cpp.
| #define LOOKUP_OPTION_RULESETDIR (-4) |
Definition at line 1774 of file stdinhand.cpp.
| #define OPTION_NAME_SPACE 25 |
Definition at line 86 of file stdinhand.cpp.
| #define REG_EXP "\\s+(?=([^\"]*\"[^\"]*\")*[^\"]*$)" |
Definition at line 87 of file stdinhand.cpp.
| #define SPECENUM_COUNT MAPIMG_COUNT |
Definition at line 6563 of file stdinhand.cpp.
| #define SPECENUM_COUNT FCDB_COUNT |
Definition at line 6563 of file stdinhand.cpp.
| #define SPECENUM_COUNT HELP_GENERAL_COUNT |
Definition at line 6563 of file stdinhand.cpp.
| #define SPECENUM_NAME reset_args |
| #define SPECENUM_NAME lua_args |
| #define SPECENUM_NAME delegate_args |
| #define SPECENUM_NAME mapimg_args |
| #define SPECENUM_NAME fcdb_args |
| #define SPECENUM_NAME help_general_args |
| #define SPECENUM_NAME list_args |
| #define SPECENUM_VALUE0 RESET_GAME |
Definition at line 7021 of file stdinhand.cpp.
| #define SPECENUM_VALUE0 LUA_CMD |
Definition at line 7021 of file stdinhand.cpp.
| #define SPECENUM_VALUE0 DELEGATE_CANCEL |
Definition at line 7021 of file stdinhand.cpp.
| #define SPECENUM_VALUE0 MAPIMG_COLORTEST |
Definition at line 7021 of file stdinhand.cpp.
| #define SPECENUM_VALUE0 FCDB_RELOAD |
Definition at line 7021 of file stdinhand.cpp.
| #define SPECENUM_VALUE0 HELP_GENERAL_COMMANDS |
Definition at line 7021 of file stdinhand.cpp.
| #define SPECENUM_VALUE0 LIST_COLORS |
Definition at line 7021 of file stdinhand.cpp.
| #define SPECENUM_VALUE0NAME "game" |
Definition at line 7022 of file stdinhand.cpp.
| #define SPECENUM_VALUE0NAME "cmd" |
Definition at line 7022 of file stdinhand.cpp.
| #define SPECENUM_VALUE0NAME "cancel" |
Definition at line 7022 of file stdinhand.cpp.
| #define SPECENUM_VALUE0NAME "colortest" |
Definition at line 7022 of file stdinhand.cpp.
| #define SPECENUM_VALUE0NAME "reload" |
Definition at line 7022 of file stdinhand.cpp.
| #define SPECENUM_VALUE0NAME "commands" |
Definition at line 7022 of file stdinhand.cpp.
| #define SPECENUM_VALUE0NAME "colors" |
Definition at line 7022 of file stdinhand.cpp.
| #define SPECENUM_VALUE1 RESET_RULESET |
Definition at line 7023 of file stdinhand.cpp.
| #define SPECENUM_VALUE1 LUA_FILE |
Definition at line 7023 of file stdinhand.cpp.
| #define SPECENUM_VALUE1 DELEGATE_RESTORE |
Definition at line 7023 of file stdinhand.cpp.
| #define SPECENUM_VALUE1 MAPIMG_CREATE |
Definition at line 7023 of file stdinhand.cpp.
| #define SPECENUM_VALUE1 FCDB_LUA |
Definition at line 7023 of file stdinhand.cpp.
| #define SPECENUM_VALUE1 HELP_GENERAL_OPTIONS |
Definition at line 7023 of file stdinhand.cpp.
| #define SPECENUM_VALUE1 LIST_CONNECTIONS |
Definition at line 7023 of file stdinhand.cpp.
| #define SPECENUM_VALUE10 LIST_VOTES |
Definition at line 7041 of file stdinhand.cpp.
| #define SPECENUM_VALUE10NAME "votes" |
Definition at line 7042 of file stdinhand.cpp.
| #define SPECENUM_VALUE1NAME "ruleset" |
Definition at line 7024 of file stdinhand.cpp.
| #define SPECENUM_VALUE1NAME "file" |
Definition at line 7024 of file stdinhand.cpp.
| #define SPECENUM_VALUE1NAME "restore" |
Definition at line 7024 of file stdinhand.cpp.
| #define SPECENUM_VALUE1NAME "create" |
Definition at line 7024 of file stdinhand.cpp.
| #define SPECENUM_VALUE1NAME "lua" |
Definition at line 7024 of file stdinhand.cpp.
| #define SPECENUM_VALUE1NAME "options" |
Definition at line 7024 of file stdinhand.cpp.
| #define SPECENUM_VALUE1NAME "connections" |
Definition at line 7024 of file stdinhand.cpp.
| #define SPECENUM_VALUE2 RESET_SCRIPT |
Definition at line 7025 of file stdinhand.cpp.
| #define SPECENUM_VALUE2 LUA_UNSAFE_CMD |
Definition at line 7025 of file stdinhand.cpp.
| #define SPECENUM_VALUE2 DELEGATE_SHOW |
Definition at line 7025 of file stdinhand.cpp.
| #define SPECENUM_VALUE2 MAPIMG_DEFINE |
Definition at line 7025 of file stdinhand.cpp.
| #define SPECENUM_VALUE2 LIST_DELEGATIONS |
Definition at line 7025 of file stdinhand.cpp.
| #define SPECENUM_VALUE2NAME "script" |
Definition at line 7026 of file stdinhand.cpp.
| #define SPECENUM_VALUE2NAME "unsafe-cmd" |
Definition at line 7026 of file stdinhand.cpp.
| #define SPECENUM_VALUE2NAME "show" |
Definition at line 7026 of file stdinhand.cpp.
| #define SPECENUM_VALUE2NAME "define" |
Definition at line 7026 of file stdinhand.cpp.
| #define SPECENUM_VALUE2NAME "delegations" |
Definition at line 7026 of file stdinhand.cpp.
| #define SPECENUM_VALUE3 RESET_DEFAULT |
Definition at line 7027 of file stdinhand.cpp.
| #define SPECENUM_VALUE3 LUA_UNSAFE_FILE |
Definition at line 7027 of file stdinhand.cpp.
| #define SPECENUM_VALUE3 DELEGATE_TAKE |
Definition at line 7027 of file stdinhand.cpp.
| #define SPECENUM_VALUE3 MAPIMG_DELETE |
Definition at line 7027 of file stdinhand.cpp.
| #define SPECENUM_VALUE3 LIST_IGNORE |
Definition at line 7027 of file stdinhand.cpp.
| #define SPECENUM_VALUE3NAME "default" |
Definition at line 7028 of file stdinhand.cpp.
| #define SPECENUM_VALUE3NAME "unsafe-file" |
Definition at line 7028 of file stdinhand.cpp.
| #define SPECENUM_VALUE3NAME "take" |
Definition at line 7028 of file stdinhand.cpp.
| #define SPECENUM_VALUE3NAME "delete" |
Definition at line 7028 of file stdinhand.cpp.
| #define SPECENUM_VALUE3NAME "ignored users" |
Definition at line 7028 of file stdinhand.cpp.
| #define SPECENUM_VALUE4 DELEGATE_TO |
Definition at line 7029 of file stdinhand.cpp.
| #define SPECENUM_VALUE4 MAPIMG_SHOW |
Definition at line 7029 of file stdinhand.cpp.
| #define SPECENUM_VALUE4 LIST_MAPIMG |
Definition at line 7029 of file stdinhand.cpp.
| #define SPECENUM_VALUE4NAME "to" |
Definition at line 7030 of file stdinhand.cpp.
| #define SPECENUM_VALUE4NAME "show" |
Definition at line 7030 of file stdinhand.cpp.
| #define SPECENUM_VALUE4NAME "map image definitions" |
Definition at line 7030 of file stdinhand.cpp.
| #define SPECENUM_VALUE5 LIST_PLAYERS |
Definition at line 7031 of file stdinhand.cpp.
| #define SPECENUM_VALUE5NAME "players" |
Definition at line 7032 of file stdinhand.cpp.
| #define SPECENUM_VALUE6 LIST_RULESETS |
Definition at line 7033 of file stdinhand.cpp.
| #define SPECENUM_VALUE6NAME "rulesets" |
Definition at line 7034 of file stdinhand.cpp.
| #define SPECENUM_VALUE7 LIST_SCENARIOS |
Definition at line 7035 of file stdinhand.cpp.
| #define SPECENUM_VALUE7NAME "scenarios" |
Definition at line 7036 of file stdinhand.cpp.
| #define SPECENUM_VALUE8 LIST_NATIONSETS |
Definition at line 7037 of file stdinhand.cpp.
| #define SPECENUM_VALUE8NAME "nationsets" |
Definition at line 7038 of file stdinhand.cpp.
| #define SPECENUM_VALUE9 LIST_TEAMS |
Definition at line 7039 of file stdinhand.cpp.
| #define SPECENUM_VALUE9NAME "teams" |
Definition at line 7040 of file stdinhand.cpp.
| typedef QHash<QString, time_t> kickhash |
Definition at line 91 of file stdinhand.cpp.
|
static |
Returns true if there is at least one established connection.
Definition at line 1345 of file stdinhand.cpp.
| enum cmdlevel access_level_for_next_connection | ( | ) |
Return access level for next connection.
Definition at line 1353 of file stdinhand.cpp.
Referenced by server_make_connection().
|
static |
Execute a command in the context of the AI of the player.
Definition at line 5937 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Accessor for the second argument to "create": ai type name.
Definition at line 7310 of file stdinhand.cpp.
Referenced by aitype_generator().
|
static |
The valid arguments for the second argument to "create".
Definition at line 7318 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Set user to away mode.
Definition at line 2135 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Cancel a vote...
/cancelvote (vote number)|all.
Definition at line 2667 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Stop sending game info to metaserver.
Definition at line 489 of file stdinhand.cpp.
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 1984 of file stdinhand.cpp.
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 393 of file stdinhand.cpp.
Referenced by aicmd_command(), away_command(), cancelvote_command(), close_metaserver_connection(), cmd_of_level(), cmd_reply_matches(), cmd_reply_no_such_conn(), cmd_reply_no_such_player(), cmdlevel_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(), lookup_option_level(), lua_command(), mapimg_command(), metaconnection_command(), metamessage_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(), save_command(), scensave_command(), script_fcdb_cmd_reply(), script_server_cmd_reply(), set_ai_level(), set_ai_level_direct(), set_cmdlevel(), set_command(), set_rulesetdir(), 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_set_command(), timeout_show_command(), toggle_ai_player_direct(), unignore_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 304 of file stdinhand.cpp.
Referenced by vcmd_reply_prefix().
|
static |
Send a reply to the caller listing the matched names from an ambiguous prefix.
Definition at line 6522 of file stdinhand.cpp.
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 441 of file stdinhand.cpp.
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 406 of file stdinhand.cpp.
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 380 of file stdinhand.cpp.
|
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().
|
static |
Extra accessor function since cmdlevel_name() takes enum argument, not int.
Definition at line 7271 of file stdinhand.cpp.
Referenced by cmdlevel_arg1_generator().
|
static |
The valid first argument to "cmdlevel".
Definition at line 7279 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Accessor for the second argument to "cmdlevel": "first" or "new" or a connection name.
Definition at line 7289 of file stdinhand.cpp.
Referenced by cmdlevel_arg2_generator().
|
static |
The valid arguments for the second argument to "cmdlevel".
Definition at line 7299 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Change command access level for individual player, or all, or new.
Definition at line 1396 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
The valid commands at the root of the prompt.
Definition at line 7175 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
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 180 of file stdinhand.cpp.
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 6280 of file stdinhand.cpp.
Referenced by handle_login_request().
|
static |
The valid connection user name arguments.
Definition at line 7261 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Access connection user name, from game.all_connections.
Definition at line 7253 of file stdinhand.cpp.
Referenced by cmdlevel_arg2_accessor(), and connection_generator().
|
static |
Set message to send to all new connections.
Definition at line 1984 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Returns whether the text between the start of rl_line_buffer and the start position is of the form [non-alpha]*cmd[non-alpha]* allow_fluff changes the regexp to [non-alpha]*cmd[non-alpha].
Definition at line 7445 of file stdinhand.cpp.
Referenced by is_cmdlevel_arg1(), is_cmdlevel_arg2(), is_command(), is_connection(), is_create_arg2(), is_delegate_arg1(), is_enum_option_value(), is_fcdb(), is_filename(), is_help(), is_list(), is_lua(), is_mapimg(), is_option_level(), is_player(), is_reset(), is_server_option(), and is_vote().
|
static |
Generalised version of contains_str_before_start, which searches the N'th token in rl_line_buffer (0=first).
Definition at line 7395 of file stdinhand.cpp.
Referenced by contains_str_before_start(), and is_enum_option_value().
|
static |
Creates a named AI player.
The function can be called before the start of the game (see creat_command_pregame()) and for a running game (see creat_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.cpp.
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 724 of file stdinhand.cpp.
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 724 of file stdinhand.cpp.
Referenced by api_edit_create_player(), and create_command().
|
static |
Handle cut command.
Definition at line 6248 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Turn on selective debugging.
Definition at line 2761 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Set a setting to its default value.
Definition at line 4963 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Returns possible parameters for the 'delegate' command.
Definition at line 5198 of file stdinhand.cpp.
Referenced by delegate_command(), and delegate_generator().
|
static |
Handle delegation of control.
Definition at line 5207 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
The valid arguments for the first argument to "delegate".
Definition at line 7344 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Return static string describing what a connection is connected to.
Definition at line 5662 of file stdinhand.cpp.
Referenced by delegate_command().
|
static |
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 3676 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
End the game immediately in a draw.
Definition at line 4771 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Handle explain command.
Definition at line 1939 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Returns possible parameters for the fcdb command.
Definition at line 6011 of file stdinhand.cpp.
Referenced by fcdb_command(), and fcdb_generator().
|
static |
Handle the freeciv database script module.
Definition at line 6020 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
The valid arguments for the argument to "fcdb".
Definition at line 7362 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
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 1542 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
| char** freeciv_completion | ( | const char * | text, |
| int | start, | ||
| int | end | ||
| ) |
Attempt to complete on the contents of TEXT.
START and END bound the region of rl_line_buffer that contains the word to complete. TEXT is the word to complete. We can use the entire contents of rl_line_buffer in case we want to do some simple parsing. Return the array of matches, or nullptr if there aren't any.
Definition at line 7767 of file stdinhand.cpp.
Referenced by freeciv::server::init_interactive().
|
static |
A generalised generator function: text and state are "standard" parameters to a readline generator function; num is number of possible completions, or -1 if this is not known and index2str should be iterated until it returns nullptr; index2str is a function which returns each possible completion string by index (it may return nullptr).
Definition at line 7134 of file stdinhand.cpp.
Referenced by aitype_generator(), cmdlevel_arg1_generator(), cmdlevel_arg2_generator(), command_generator(), connection_generator(), delegate_generator(), fcdb_generator(), help_generator(), list_generator(), lua_generator(), mapimg_generator(), olevel_generator(), option_generator(), option_value_generator(), player_generator(), reset_generator(), and vote_generator().
| QVector<QString>* get_init_script_choices | ( | ) |
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 1218 of file stdinhand.cpp.
Referenced by send_ruleset_choices(), and show_rulesets().
| bool handle_stdin_input | ( | struct connection * | caller, |
| char * | str | ||
| ) |
Main entry point for "command input".
Definition at line 4445 of file stdinhand.cpp.
Referenced by check_vote(), handle_chat_msg_req(), and freeciv::server::input_on_stdin().
|
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 4458 of file stdinhand.cpp.
Referenced by handle_stdin_input(), and read_init_script_real().
|
static |
The valid first arguments to "help".
Definition at line 7378 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Convert unified helparg index to string; see above.
Definition at line 6577 of file stdinhand.cpp.
Referenced by help_generator(), and show_help().
|
static |
/ignore command handler.
Definition at line 4079 of file stdinhand.cpp.
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 3210 of file stdinhand.cpp.
Referenced by observe_command(), and take_command().
|
static |
Return whether we are completing cmdlevel command argument.
Definition at line 7564 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Return whether we are completing cmdlevel command argument 2.
Definition at line 7554 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Return whether we are completing command name.
This can be either command itself, or argument to 'help'.
Definition at line 7455 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Return whether we are completing connection name argument.
Definition at line 7536 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Return whether we are completing second argument for create command.
Definition at line 7681 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Return whether we are completing first argument for delegate command.
Definition at line 7709 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Returns TRUE if the readline buffer string is such that we expect an enumerated value at the given position.
The option for which values should be completed is written to opt_p.
Definition at line 7627 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Return whether we are completing argument for fcdb command.
Definition at line 7727 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Return whether we are completing filename.
Definition at line 7663 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Return whether first access level is already taken.
Definition at line 1353 of file stdinhand.cpp.
Referenced by firstlevel_command(), and notify_if_first_access_level_is_available().
|
static |
Return whether we are completing help command argument.
Definition at line 7745 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Return whether we are completing list command argument.
Definition at line 7754 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Return whether we are completing argument for lua command.
Definition at line 7736 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Return whether we are completing first argument for mapimg command.
Definition at line 7718 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Returns true if the readline buffer string matches an option level or an option at the given position.
Definition at line 7607 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Return whether we are completing player name argument.
Definition at line 7513 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Return whether we are completing argument for reset command.
Definition at line 7691 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Are we operating under a restricted security regime? For now this does not do much.
Definition at line 171 of file stdinhand.cpp.
Referenced by cmd_of_level(), load_command(), lua_command(), read_init_script_real(), save_command(), scensave_command(), set_rulesetdir(), and write_command().
|
static |
Returns TRUE if the readline buffer string matches a server option at the given position.
Definition at line 7583 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Return whether we are completing argument for vote command.
Definition at line 7700 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Kick command handler.
Definition at line 6329 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Returns possible parameters for the list command.
Definition at line 7048 of file stdinhand.cpp.
Referenced by list_generator(), and show_list().
|
static |
The valid first arguments to "list".
Definition at line 7386 of file stdinhand.cpp.
Referenced by freeciv_completion().
| 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 3780 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Find option index by name.
Return index (>=0) on success, else returned
Definition at line 1783 of file stdinhand.cpp.
Referenced by explain_option(), show_settings(), and validate_setting_arg().
|
static |
Find option level number by name.
Definition at line 1713 of file stdinhand.cpp.
Referenced by lookup_option(), and show_settings().
|
static |
Returns possible parameters for the reset command.
Definition at line 5007 of file stdinhand.cpp.
Referenced by lua_command(), and lua_generator().
|
static |
Evaluate a line of lua script or a lua script file.
Definition at line 5016 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
The valid arguments for the argument to "lua".
Definition at line 7370 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Returns possible parameters for the mapimg command.
Definition at line 5701 of file stdinhand.cpp.
Referenced by mapimg_command(), and mapimg_generator().
|
static |
Handle mapimg command.
Definition at line 5710 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
The valid arguments for the first argument to "mapimg".
Definition at line 7353 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Whether the caller can use the specified command.
caller == nullptr means console.
Definition at line 254 of file stdinhand.cpp.
Referenced by show_help_command_list().
|
static |
Whether the caller cannot use any commands at all.
caller == nullptr means console.
Definition at line 266 of file stdinhand.cpp.
Referenced by handle_stdin_input_real(), and show_help().
|
static |
Handle metaconnection command.
Definition at line 502 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Handle metamessage command.
Definition at line 580 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Handle metapatches command.
Definition at line 554 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Handle metaserver command.
Definition at line 612 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
| void notify_if_first_access_level_is_available | ( | ) |
Check if first access level is available and if it is, notify connections about it.
Definition at line 1382 of file stdinhand.cpp.
Referenced by lost_connection_to_client().
|
static |
Number of tokens in rl_line_buffer before start.
Definition at line 7478 of file stdinhand.cpp.
Referenced by is_cmdlevel_arg2(), and is_create_arg2().
|
static |
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 3351 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
The valid arguments to "show".
Definition at line 7191 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Returns possible parameters for the /show command.
Definition at line 1591 of file stdinhand.cpp.
Referenced by olevel_generator().
|
static |
Start sending game info to metaserver.
Definition at line 475 of file stdinhand.cpp.
Referenced by metaconnection_command().
|
static |
The valid arguments to "set" and "explain".
Definition at line 7183 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Definition at line 7202 of file stdinhand.cpp.
Referenced by option_value_generator().
|
static |
The valid arguments to "set OPT", where OPT is the enumerated or bitwise option previously defined by completion_option.
Definition at line 7222 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Returns possible parameters for the commands that take server options as parameters (CMD_EXPLAIN and CMD_SET).
Definition at line 1583 of file stdinhand.cpp.
Referenced by helparg_accessor(), lookup_option(), olvlname_accessor(), and option_generator().
|
static |
The valid playername arguments.
Definition at line 7244 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Check the player name.
Returns TRUE if the player name is valid else an error message is saved in 'buf'.
Definition at line 180 of file stdinhand.cpp.
|
static |
/playercolor command handler.
Definition at line 4204 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Access player name.
Definition at line 7230 of file stdinhand.cpp.
Referenced by player_generator().
|
static |
/playernation command handler.
Definition at line 4294 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Handle quit command.
Definition at line 4427 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Main entry point for the read command.
Definition at line 1105 of file stdinhand.cpp.
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 1114 of file stdinhand.cpp.
Referenced by freeciv::server::prepare_game().
|
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 1132 of file stdinhand.cpp.
Referenced by read_command(), read_init_script(), and reset_command().
|
static |
Handle remove command.
Definition at line 1067 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Definition at line 160 of file stdinhand.cpp.
Referenced by aicmd_command(), debug_command(), delegate_command(), detach_command(), fcdb_command(), lua_command(), mapimg_command(), observe_command(), playercolor_command(), playernation_command(), set_command(), take_command(), team_command(), and vote_command().
|
static |
Returns possible parameters for the reset command.
Definition at line 4845 of file stdinhand.cpp.
Referenced by reset_command(), and reset_generator().
|
static |
Reload the game settings from the ruleset and reload the init script if one was used.
Definition at line 4855 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
The valid arguments for the argument to "reset".
Definition at line 7327 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
For command "save foo"; Save the game, with filename=arg, provided server state is ok.
Definition at line 642 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
For command "scensave foo"; Save the game, with filename=arg, provided server state is ok.
Definition at line 659 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
| void set_ai_level_direct | ( | struct player * | pplayer, |
| enum ai_level | level | ||
| ) |
Set an AI level from the server prompt.
Definition at line 2056 of file stdinhand.cpp.
Referenced by split_player(), and srv_ready().
|
static |
Handle a user command to set an AI level.
Definition at line 2068 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Set ptarget's cmdlevel to level if caller is allowed to do so.
Definition at line 1312 of file stdinhand.cpp.
Referenced by cmdlevel_command().
|
static |
Handle set command.
Definition at line 3022 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
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 3993 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
| void set_running_game_access_level | ( | ) |
Adjust default command level on game start.
Definition at line 1570 of file stdinhand.cpp.
Referenced by start_game().
|
static |
Return the status of the setting (changeable, locked, fixed).
caller == nullptr means console.
Definition at line 278 of file stdinhand.cpp.
Referenced by show_settings_one().
| bool should_quit | ( | ) |
Returns whether the server should exit after a command.
Definition at line 4440 of file stdinhand.cpp.
|
static |
Show a list of all players with the assigned color.
Definition at line 6999 of file stdinhand.cpp.
Referenced by show_list().
|
static |
/show command: show settings and their values.
Definition at line 2203 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
List connections; initially mainly for debugging.
Definition at line 6657 of file stdinhand.cpp.
Referenced by show_list().
|
static |
List all delegations of the current game.
Definition at line 6690 of file stdinhand.cpp.
Referenced by show_list().
|
static |
Handle help command.
Definition at line 6595 of file stdinhand.cpp.
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 6439 of file stdinhand.cpp.
Referenced by show_help().
|
static |
Show the caller list of COMMANDS.
help_cmd is the command the player used.
Definition at line 6483 of file stdinhand.cpp.
Referenced by show_help().
|
static |
Show caller introductory help about the server.
help_cmd is the command the player used.
Definition at line 6406 of file stdinhand.cpp.
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 1812 of file stdinhand.cpp.
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 1898 of file stdinhand.cpp.
Referenced by explain_option(), and show_help().
|
static |
Show the ignore list of the.
Definition at line 6726 of file stdinhand.cpp.
Referenced by show_list().
|
static |
Show list of players or connections, or connection statistics.
Definition at line 7057 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Show a list of all map image definitions on the command line.
Definition at line 6978 of file stdinhand.cpp.
Referenced by mapimg_command(), and show_list().
|
static |
List nation sets in the current ruleset.
Definition at line 6906 of file stdinhand.cpp.
Referenced by show_list().
| void show_players | ( | struct connection * | caller | ) |
Show the list of the players of the game.
Definition at line 6758 of file stdinhand.cpp.
Referenced by show_list().
|
static |
Show changed settings and ruleset summary.
Definition at line 2176 of file stdinhand.cpp.
Referenced by read_init_script_real(), reset_command(), and set_rulesetdir().
|
static |
List rulesets (strictly, .serv init script files that conventionally accompany rulesets).
Definition at line 6860 of file stdinhand.cpp.
Referenced by show_list().
|
static |
List scenarios.
We look both in the DATA_PATH and DATA_PATH/scenario
Definition at line 6882 of file stdinhand.cpp.
Referenced by show_list().
|
static |
Returns the serverid.
Definition at line 630 of file stdinhand.cpp.
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 2213 of file stdinhand.cpp.
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 2388 of file stdinhand.cpp.
Referenced by show_settings().
|
static |
Show a list of teams on the command line.
Definition at line 6945 of file stdinhand.cpp.
Referenced by show_list().
|
static |
List all running votes.
Moved from /vote command.
Definition at line 2522 of file stdinhand.cpp.
Referenced by show_list(), and vote_command().
|
static |
Send start command related message.
Definition at line 6109 of file stdinhand.cpp.
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 6121 of file stdinhand.cpp.
Referenced by handle_observer_ready(), handle_player_ready(), and handle_stdin_input_real().
| void stdinhand_free | ( | ) |
Deinitialize stuff related to this code module.
Definition at line 244 of file stdinhand.cpp.
Referenced by server_quit().
| void stdinhand_init | ( | ) |
Initialize stuff related to this code module.
Definition at line 231 of file stdinhand.cpp.
| void stdinhand_turn | ( | ) |
Update stuff every turn that is related to this code module.
Run this on turn end.
Definition at line 237 of file stdinhand.cpp.
Referenced by end_turn().
|
static |
Concede the game.
You still continue playing until all but one player or team remains un-conceded.
Definition at line 4796 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
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 3491 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Handle team command.
Definition at line 2449 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Set timeout options.
Definition at line 1713 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Sets the timeout for the current turn.
If "add", add more time; else, replace the timeout.
Definition at line 1649 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Show the current timeout, time left before TC, etc.
Definition at line 1605 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Handle aitoggle command.
Definition at line 700 of file stdinhand.cpp.
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 676 of file stdinhand.cpp.
Referenced by autotoggle_action(), connection_attach_real(), connection_detach(), srv_ready(), and toggle_ai_command().
|
static |
/unignore command handler.
Definition at line 4113 of file stdinhand.cpp.
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 2986 of file stdinhand.cpp.
Referenced by default_command(), and set_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 353 of file stdinhand.cpp.
Referenced by cmd_reply(), and cmd_reply_prefix().
|
static |
Definition at line 2560 of file stdinhand.cpp.
Referenced by vote_command(), and vote_generator().
|
static |
Make or participate in a vote.
Definition at line 2565 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
The valid arguments for the argument to "vote".
Definition at line 7336 of file stdinhand.cpp.
Referenced by freeciv_completion().
|
static |
Send a message to all players.
Definition at line 1972 of file stdinhand.cpp.
Referenced by handle_stdin_input_real(), and freeciv::layer_city::reset_ruleset().
|
static |
Generate init script from settings currently in use.
Definition at line 1296 of file stdinhand.cpp.
Referenced by handle_stdin_input_real().
|
static |
Write current settings to new init script.
(Should this take a 'caller' argument for output? –dwp)
Definition at line 1228 of file stdinhand.cpp.
Referenced by write_command().
|
static |
Accessor for values of the enum/bitwise option defined by 'completion_option'.
Definition at line 7201 of file stdinhand.cpp.
Referenced by freeciv_completion(), and option_value_accessor().
Commands that may be followed by a connection name.
Definition at line 7531 of file stdinhand.cpp.
Referenced by is_connection().
|
static |
Definition at line 1 of file stdinhand.cpp.
Referenced by cmdlevel_command(), notify_if_first_access_level_is_available(), set_running_game_access_level(), and write_init_script().
|
static |
Commands that may be followed by a filename.
Definition at line 7657 of file stdinhand.cpp.
Referenced by is_filename().
|
static |
Definition at line 1 of file stdinhand.cpp.
Referenced by access_level_for_next_connection(), cmdlevel_command(), firstlevel_command(), notify_if_first_access_level_is_available(), and write_init_script().
|
static |
Definition at line 153 of file stdinhand.cpp.
Referenced by cmdlevel_command(), 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().
|
static |
Commands that may be followed by an option level or server option.
Definition at line 7601 of file stdinhand.cpp.
Referenced by is_option_level().
|
static |
Commands that may be followed by a player name.
Definition at line 7502 of file stdinhand.cpp.
Referenced by is_player().
|
static |
Commands that may be followed by a server option name.
CMD_SHOW is handled by option_level_cmd, which is for both option levels and server options
Definition at line 7576 of file stdinhand.cpp.
Referenced by is_server_option().
|
static |
Vote command argument definitions.
Definition at line 2559 of file stdinhand.cpp.
Referenced by vote_arg_accessor().