Freeciv21
Develop your civilization from humble roots to a global empire
connectdlg_common.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool client_start_server (const QString &user_name)
 Forks a server if it can. More...
 
void client_kill_server (bool force)
 Kills the server if the client has started it. More...
 
bool is_server_running ()
 The general chain of events: More...
 
bool can_client_access_hack ()
 Returns TRUE if the client has hack access. More...
 
void send_client_wants_hack (const char *filename)
 If the client is capable of 'wanting hack', then the server will send the client a filename in the packet_join_game_reply packet. More...
 
void send_save_game (const char *filename)
 Send server command to save game. More...
 
void set_ruleset (const char *ruleset)
 Called by the GUI code when the user sets the ruleset. More...
 

Function Documentation

◆ can_client_access_hack()

bool can_client_access_hack ( )

Returns TRUE if the client has hack access.

Definition at line 136 of file connectdlg_common.cpp.

Referenced by mr_menu::nonunit_sensitivity(), and page_pregame::update_buttons().

◆ client_kill_server()

void client_kill_server ( bool  force)

Kills the server if the client has started it.

If the 'force' parameter is unset, we just do a /quit. If it's set, then we'll send a signal to the server to kill it (use this when the socket is disconnected already).

Definition at line 145 of file connectdlg_common.cpp.

Referenced by client_conn_close_callback(), client_start_server(), disconnect_from_server(), emergency_exit(), and handle_single_want_hack_reply().

◆ client_start_server()

bool client_start_server ( const QString &  user_name)

Forks a server if it can.

Returns FALSE if we find we couldn't start the server.

Definition at line 179 of file connectdlg_common.cpp.

Referenced by client_start_server_and_set_page(), client_state(), fc_client::start_from_file(), fc_client::start_new_game(), and fc_client::start_tutorial().

◆ is_server_running()

bool is_server_running ( )

The general chain of events:

Two distinct paths are taken depending on the choice of mode:

if the user selects the multi- player mode, then a packet_req_join_game packet is sent to the server. It is either successful or not. The end.

If the user selects a single- player mode (either a new game or a save game) then:

  1. the packet_req_join_game is sent.
  2. on receipt, if we can join, then a challenge packet is sent to the server, so we can get hack level control.
  3. if we can't get hack, then we get dumped to multi- player mode. If we can, then: a. for a new game, we send a series of packet_generic_message packets with commands to start the game. b. for a saved game, we send the load command with a packet_generic_message, then we send a PACKET_PLAYER_LIST_REQUEST. the response to this request will tell us if the game was loaded or not. if not, then we send another load command. if so, then we send a series of packet_generic_message packets with commands to start the game. Tests if the client has started the server.

Definition at line 125 of file connectdlg_common.cpp.

Referenced by mr_menu::back_to_menu(), client_kill_server(), fc_client::current_page(), handle_server_join_reply(), handle_single_want_hack_reply(), chat_widget::set_chat_visible(), fc_client::start_from_file(), fc_client::start_new_game(), and chat_widget::update_widgets().

◆ send_client_wants_hack()

void send_client_wants_hack ( const char *  filename)

If the client is capable of 'wanting hack', then the server will send the client a filename in the packet_join_game_reply packet.

This function creates the file with a suitably random string in it and then sends the string to the server. If the server can open and read the string, then the client is given hack access.

Definition at line 319 of file connectdlg_common.cpp.

Referenced by handle_server_join_reply().

◆ send_save_game()

void send_save_game ( const char *  filename)

Send server command to save game.

Definition at line 386 of file connectdlg_common.cpp.

Referenced by mr_menu::save_game(), and mr_menu::save_game_as().

◆ set_ruleset()

void set_ruleset ( const char *  ruleset)

Called by the GUI code when the user sets the ruleset.

The ruleset passed in here should match one of the strings given to set_rulesets().

Definition at line 419 of file connectdlg_common.cpp.

Referenced by pregame_options::ruleset_change().