Freeciv21
Develop your civilization from humble roots to a global empire
stdinhand.h
Go to the documentation of this file.
1 /*__ ___ ***************************************
2 / \ / \ Copyright (c) 1996-2020 Freeciv21 and Freeciv
3 \_ \ / __/ contributors. This file is part of Freeciv21.
4  _\ \ / /__ Freeciv21 is free software: you can redistribute it
5  \___ \____/ __/ and/or modify it under the terms of the GNU General
6  \_ _/ Public License as published by the Free Software
7  | @ @ \_ Foundation, either version 3 of the License,
8  | or (at your option) any later version.
9  _/ /\ You should have received a copy of the GNU
10  /o) (o/\ \_ General Public License along with Freeciv21.
11  \_____/ / If not, see https://www.gnu.org/licenses/.
12  \____/ ********************************************************/
13 #pragma once
14 
15 #include <QString>
16 #include <QVector>
17 // common
18 #include "chat.h" // SERVER_COMMAND_PREFIX
19 #include "connection.h" // enum cmdlevel
20 #include "fc_types.h"
21 
22 // server
23 #include "commands.h"
24 #include "console.h"
25 
26 void stdinhand_init();
27 void stdinhand_turn();
28 void stdinhand_free();
29 
30 void cmd_reply(enum command_id cmd, struct connection *caller,
31  enum rfc_status rfc_status, const char *format, ...)
32  fc__attribute((__format__(__printf__, 4, 5)));
33 
34 bool handle_stdin_input(struct connection *caller, char *str);
35 void set_ai_level_direct(struct player *pplayer, enum ai_level level);
36 bool read_init_script(struct connection *caller, const char *script_filename,
37  bool from_cmdline, bool check);
39 void show_players(struct connection *caller);
40 
41 enum rfc_status create_command_newcomer(const char *name, const char *ai,
42  bool check,
43  struct nation_type *pnation,
44  struct player **newplayer, char *buf,
45  size_t buflen);
46 enum rfc_status create_command_pregame(const char *name, const char *ai,
47  bool check, struct player **newplayer,
48  char *buf, size_t buflen);
49 
50 bool load_command(struct connection *caller, const char *filename,
51  bool check, bool cmdline_load);
52 bool start_command(struct connection *caller, bool check, bool notify);
53 
54 void toggle_ai_player_direct(struct connection *caller,
55  struct player *pplayer);
56 
57 // for sernet.c in initing a new connection
58 enum cmdlevel access_level_for_next_connection();
59 
61 
62 bool conn_is_kicked(struct connection *pconn, int *time_remaining);
63 
65 
66 char **freeciv_completion(const char *text, int start, int end);
67 
68 bool should_quit();
Definition: shared.h:24
command_id
Definition: commands.h:33
rfc_status
Definition: console.h:36
const char * name
Definition: inputfile.cpp:118
struct setting_list * level[OLEVELS_NUM]
Definition: settings.cpp:167
void notify_if_first_access_level_is_available()
Check if first access level is available and if it is, notify connections about it.
Definition: stdinhand.cpp:1382
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: stdinhand.cpp:6280
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:
Definition: stdinhand.cpp:780
void cmd_reply(enum command_id cmd, struct connection *caller, enum rfc_status rfc_status, const char *format,...) fc__attribute((__format__(__printf__
char ** freeciv_completion(const char *text, int start, int end)
Attempt to complete on the contents of TEXT.
Definition: stdinhand.cpp:7767
void show_players(struct connection *caller)
Show the list of the players of the game.
Definition: stdinhand.cpp:6758
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: stdinhand.cpp:946
void stdinhand_turn()
Update stuff every turn that is related to this code module.
Definition: stdinhand.cpp:237
void stdinhand_init()
Initialize stuff related to this code module.
Definition: stdinhand.cpp:231
void set_ai_level_direct(struct player *pplayer, enum ai_level level)
Set an AI level from the server prompt.
Definition: stdinhand.cpp:2056
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: stdinhand.cpp:1114
enum cmdlevel access_level_for_next_connection()
Return access level for next connection.
Definition: stdinhand.cpp:1368
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.
Definition: stdinhand.cpp:3780
bool start_command(struct connection *caller, bool check, bool notify)
Handle start command.
Definition: stdinhand.cpp:6121
QVector< QString > * get_init_script_choices()
Return a list of init scripts found on the data path.
Definition: stdinhand.cpp:1218
bool should_quit()
Returns whether the server should exit after a command.
Definition: stdinhand.cpp:4440
void stdinhand_free()
Deinitialize stuff related to this code module.
Definition: stdinhand.cpp:244
void bool handle_stdin_input(struct connection *caller, char *str)
Main entry point for "command input".
Definition: stdinhand.cpp:4445
void toggle_ai_player_direct(struct connection *caller, struct player *pplayer)
Handle ai player ai toggling.
Definition: stdinhand.cpp:676
void set_running_game_access_level()
Adjust default command level on game start.
Definition: stdinhand.cpp:1570
Definition: player.h:231
int fc__attribute((nonnull(1, 3)))