19#ifndef HEADER_SERVER_HPP
20#define HEADER_SERVER_HPP
27#include "race/race_manager.hpp"
54 std::string m_server_owner_lower_case_name;
56 std::string m_lower_case_player_names;
65 uint32_t m_server_owner;
83 unsigned m_server_mode;
87 bool m_password_protected;
91 core::stringw m_server_owner_name;
99 bool m_supports_encrytion;
103 bool m_ipv6_connection;
105 bool m_reconnect_when_quit_lobby;
107 std::vector<std::tuple<
108 int, core::stringw, double,
float
111 std::string m_current_track;
113 std::string m_country_code;
118 Server(
unsigned server_id,
const irr::core::stringw &name,
119 int max_players,
int current_players,
unsigned difficulty,
121 bool password_protected,
bool game_started,
122 const std::string& current_track =
"");
151 unsigned getServerMode()
const {
return m_server_mode; }
155 bool isPasswordProtected()
const {
return m_password_protected; }
157 const core::stringw& getServerOwnerName()
const
158 {
return m_server_owner_name; }
160 const std::string& getServerOwnerLowerCaseName()
const
161 {
return m_server_owner_lower_case_name; }
163 float getDistance()
const {
return m_distance; }
165 bool supportsEncryption()
const {
return m_supports_encrytion; }
167 bool isOfficial()
const {
return m_official; }
169 bool isGameStarted()
const {
return m_game_started; }
171 const std::vector<std::tuple<int, core::stringw, double, float> >&
172 getPlayers()
const {
return m_players; }
174 void setServerId(
unsigned id) { m_server_id = id; }
178 void setSupportsEncryption(
bool val) { m_supports_encrytion = val; }
180 bool searchByName(
const std::string& lower_case_word);
182 Track* getCurrentTrack()
const;
184 const std::string& getCountryCode()
const {
return m_country_code; }
186 void setIPV6Connection(
bool val)
189 m_ipv6_connection =
false;
191 m_ipv6_connection = val;
194 bool useIPV6Connection()
const {
return m_ipv6_connection; }
205 virtual void saveServer()
const {}
207 void setIsPasswordProtected(
bool password_protected) { m_password_protected = password_protected; }
209 bool reconnectWhenQuitLobby()
const {
return m_reconnect_when_quit_lobby; }
211 void setReconnectWhenQuitLobby(
bool val)
212 { m_reconnect_when_quit_lobby = val; }
214 std::string getBookmarkKey()
const;
216 const int getCurrentAI()
const {
return m_current_ai; }
223 bool password_protected =
false)
224 :
Server(0, name, 0, 0, 0, 0, ipv4, password_protected,
false) {}
226 virtual void saveServer()
const;
Difficulty
Game difficulty.
Definition: race_manager.hpp:230
Definition: server.hpp:44
const int getCurrentPlayers() const
Returns the number of currently connected players.
Definition: server.hpp:149
int m_current_players
The number of players currently on the server.
Definition: server.hpp:71
int m_max_players
The maximum number of players that the server supports.
Definition: server.hpp:68
const irr::core::stringw & getName() const
Returns the name of the server.
Definition: server.hpp:135
const uint32_t getServerOwner() const
Returns the user id in STK addon server of the server owner (WAN).
Definition: server.hpp:141
const uint32_t getServerId() const
Returns the ID of this server.
Definition: server.hpp:138
const std::string & getLowerCaseName() const
Returns the lower case name of the server.
Definition: server.hpp:132
const int getMaxPlayers() const
Returns the maximum number of players allowed on this server.
Definition: server.hpp:146
irr::core::stringw m_name
The server name to be displayed.
Definition: server.hpp:49
std::unique_ptr< SocketAddress > m_address
The public ip address and port of this server.
Definition: server.hpp:76
const SocketAddress & getAddress() const
Returns IPv4 address and port of this server.
Definition: server.hpp:127
std::string m_lower_case_name
Name in lower case for comparisons.
Definition: server.hpp:52
uint16_t m_private_port
This is the private port of the server.
Definition: server.hpp:81
std::unique_ptr< SocketAddress > m_ipv6_address
We need to use full socket address structure instead of string to hold it, because for local link add...
Definition: server.hpp:62
Describes a IPv4 or IPv6 address in sockaddr_in(6) format, suitable in using with sendto.
Definition: socket_address.hpp:47
Definition: track.hpp:114
Definition: server.hpp:220
utility class used to parse XML files
Definition: xml_node.hpp:48
Declares the general types that are used by the network.