![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <QString>#include <QVector>#include "chat.h"#include "connection.h"#include "fc_types.h"#include "commands.h"#include "console.h"
Include dependency graph for stdinhand.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Functions | |
| 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... | |
| void | cmd_reply (enum command_id cmd, struct connection *caller, enum rfc_status rfc_status, const char *format,...) fc__attribute((__format__(__printf__ |
| void bool | handle_stdin_input (struct connection *caller, char *str) |
| Main entry point for "command input". More... | |
| void | set_ai_level_direct (struct player *pplayer, enum ai_level level) |
| Set an AI level from the server prompt. 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... | |
| void | show_players (struct connection *caller) |
| Show the list of the players of the game. 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... | |
| 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... | |
| bool | start_command (struct connection *caller, bool check, bool notify) |
| Handle start command. More... | |
| void | toggle_ai_player_direct (struct connection *caller, struct player *pplayer) |
| Handle ai player ai toggling. 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... | |
| 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... | |
| void | set_running_game_access_level () |
| Adjust default command level on game start. More... | |
| char ** | freeciv_completion (const char *text, int start, int end) |
| Attempt to complete on the contents of TEXT. More... | |
| bool | should_quit () |
| Returns whether the server should exit after a command. More... | |
| 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().
| void cmd_reply | ( | enum command_id | cmd, |
| struct connection * | caller, | ||
| enum rfc_status | rfc_status, | ||
| const char * | format, | ||
| ... | |||
| ) |
| 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().
| 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().
| 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().
| 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().
| void 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().
| 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().
| 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().
| 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().
| 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().
| 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().
| bool should_quit | ( | ) |
Returns whether the server should exit after a command.
Definition at line 4440 of file stdinhand.cpp.
| 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().
| 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().
| 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().