![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
A Freeciv21 server. More...
#include <server.h>
Inheritance diagram for freeciv::server:
Collaboration diagram for freeciv::server:Public Member Functions | |
| server () | |
| Creates a server. More... | |
| ~server () override | |
| Shut down a server. More... | |
| bool | is_ready () const |
| Checks if the server is ready for the event loop to start. More... | |
Private Slots | |
| void | error_on_socket () |
| Called when there was an error on a socket. More... | |
| void | input_on_socket () |
| Called when there's something to read on a socket. More... | |
| void | accept_local_connections () |
| Server accepts connections over local socket: Low level socket stuff, and basic-initialize the connection struct. More... | |
| void | accept_tcp_connections () |
| Server accepts connections from client: Low level socket stuff, and basic-initialize the connection struct. More... | |
| void | send_pings () |
| Sends pings to clients if needed. More... | |
| bool | prepare_game () |
| Prepares for a new game. More... | |
| void | begin_turn () |
| Do everything needed to start a new turn on top of calling begin_turn. More... | |
| void | begin_phase () |
| Do everything needed to start a new phase on top of calling begin_phase. More... | |
| void | end_phase () |
| Do everything needed to end a phase on top of calling end_phase. More... | |
| void | end_turn () |
| Do everything needed to end a turn on top of calling end_turn. More... | |
| void | update_game_state () |
| Checks if the game state has changed and take action if appropriate. More... | |
| bool | shut_game_down () |
| Shuts a game down when all players have left. More... | |
| void | quit_idle () |
| Quit because we're idle (ie no one was connected in the last srvarg.quitidle seconds). More... | |
| void | pulse () |
| Called every second. More... | |
| void | input_on_stdin () |
| Called when there's something to read on stdin. More... | |
Private Member Functions | |
| void | init_interactive () |
| Initializes interactive handling of stdin with libreadline. More... | |
Private Attributes | |
| bool | m_ready = false |
| bool | m_interactive = false |
| QObject * | m_stdin_notifier = nullptr |
| socket_server | m_server = socket_server() |
| civtimer * | m_eot_timer = nullptr |
| civtimer * | m_between_turns_timer = nullptr |
| bool | m_is_new_turn {false} |
| bool | m_need_send_pending_events {false} |
| bool | m_skip_mapimg {false} |
| int | m_save_counter = 0 |
| bool | m_someone_ever_connected = false |
| QTimer * | m_quitidle_timer = nullptr |
| QTimer * | m_pulse_timer = nullptr |
|
explicit |
Creates a server.
It starts working as soon as there is an event loop.
Definition at line 269 of file server.cpp.
|
override |
Shut down a server.
Definition at line 361 of file server.cpp.
|
privateslot |
Server accepts connections over local socket: Low level socket stuff, and basic-initialize the connection struct.
Definition at line 437 of file server.cpp.
Referenced by server().
|
privateslot |
Server accepts connections from client: Low level socket stuff, and basic-initialize the connection struct.
Definition at line 474 of file server.cpp.
Referenced by server().
|
privateslot |
Do everything needed to start a new phase on top of calling begin_phase.
Definition at line 790 of file server.cpp.
Referenced by begin_turn(), and end_phase().
|
privateslot |
Do everything needed to start a new turn on top of calling begin_turn.
Definition at line 775 of file server.cpp.
Referenced by end_turn(), and update_game_state().
|
privateslot |
Do everything needed to end a phase on top of calling end_phase.
Definition at line 867 of file server.cpp.
Referenced by update_game_state().
|
privateslot |
Do everything needed to end a turn on top of calling end_turn.
Definition at line 910 of file server.cpp.
Referenced by end_phase().
|
privateslot |
Called when there was an error on a socket.
Definition at line 600 of file server.cpp.
Referenced by accept_local_connections(), and accept_tcp_connections().
|
private |
Initializes interactive handling of stdin with libreadline.
Definition at line 406 of file server.cpp.
Referenced by server().
|
privateslot |
Called when there's something to read on a socket.
Definition at line 629 of file server.cpp.
Referenced by accept_local_connections(), and accept_tcp_connections().
|
privateslot |
Called when there's something to read on stdin.
Definition at line 704 of file server.cpp.
Referenced by server().
| bool server::is_ready | ( | ) | const |
Checks if the server is ready for the event loop to start.
In practice, this is only false if opening the port failed.
Definition at line 431 of file server.cpp.
|
privateslot |
Prepares for a new game.
Definition at line 739 of file server.cpp.
Referenced by server(), and update_game_state().
|
privateslot |
|
privateslot |
Quit because we're idle (ie no one was connected in the last srvarg.quitidle seconds).
Definition at line 1072 of file server.cpp.
Referenced by update_game_state().
|
privateslot |
|
privateslot |
Shuts a game down when all players have left.
Returns whether a new game should be started.
Definition at line 1043 of file server.cpp.
Referenced by update_game_state().
|
privateslot |
Checks if the game state has changed and take action if appropriate.
Definition at line 964 of file server.cpp.
Referenced by begin_phase(), end_turn(), error_on_socket(), input_on_socket(), input_on_stdin(), prepare_game(), pulse(), and quit_idle().
|
private |
Definition at line 126 of file server.h.
Referenced by begin_phase(), end_phase(), end_turn(), and ~server().
|
private |
Definition at line 126 of file server.h.
Referenced by begin_phase(), end_phase(), end_turn(), server(), update_game_state(), and ~server().
|
private |
Definition at line 121 of file server.h.
Referenced by input_on_stdin(), server(), and ~server().
|
private |
Definition at line 128 of file server.h.
Referenced by begin_phase(), begin_turn(), and update_game_state().
|
private |
Definition at line 128 of file server.h.
Referenced by begin_phase(), and update_game_state().
|
private |
|
private |
Definition at line 133 of file server.h.
Referenced by accept_local_connections(), accept_tcp_connections(), quit_idle(), and update_game_state().
|
private |
Definition at line 119 of file server.h.
Referenced by is_ready(), and server().
|
private |
Definition at line 130 of file server.h.
Referenced by begin_phase(), and update_game_state().
|
private |
Definition at line 124 of file server.h.
Referenced by accept_local_connections(), accept_tcp_connections(), and server().
|
private |
Definition at line 129 of file server.h.
Referenced by begin_phase(), and update_game_state().
|
private |
Definition at line 132 of file server.h.
Referenced by accept_local_connections(), accept_tcp_connections(), and update_game_state().
|
private |
Definition at line 122 of file server.h.
Referenced by input_on_stdin(), server(), and ~server().