summaryrefslogtreecommitdiff
path: root/src/network/core/game_info.h
diff options
context:
space:
mode:
authorrubidium42 <rubidium@openttd.org>2021-05-05 19:15:37 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-05-05 21:01:23 +0200
commit72bd62fd705c495d90f08adc964ff8d7f84c6cc1 (patch)
tree300f3f5066f48624e1f56dc5418d68612c690bf9 /src/network/core/game_info.h
parent24e7cb494738a8e0117dbd8c4a148a9ee532e129 (diff)
downloadopenttd-72bd62fd705c495d90f08adc964ff8d7f84c6cc1.tar.xz
Codechange: [Network] Use a single NetworkServerGameInfo object at server side and serialize that for the clients
Diffstat (limited to 'src/network/core/game_info.h')
-rw-r--r--src/network/core/game_info.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/network/core/game_info.h b/src/network/core/game_info.h
index 324c6ea4a..10f922f31 100644
--- a/src/network/core/game_info.h
+++ b/src/network/core/game_info.h
@@ -57,17 +57,9 @@
*/
/**
- * The game information that is not generated on-the-fly and has to
- * be sent to the clients.
+ * The game information that is sent from the server to the client.
*/
struct NetworkServerGameInfo {
- byte clients_on; ///< Current count of clients on server
-};
-
-/**
- * The game information that is sent from the server to the clients.
- */
-struct NetworkGameInfo : NetworkServerGameInfo {
GRFConfig *grfconfig; ///< List of NewGRF files used
Date start_date; ///< When the game started
Date game_date; ///< Current date
@@ -76,16 +68,24 @@ struct NetworkGameInfo : NetworkServerGameInfo {
char server_name[NETWORK_NAME_LENGTH]; ///< Server name
char server_revision[NETWORK_REVISION_LENGTH]; ///< The version number the server is using (e.g.: 'r304' or 0.5.0)
bool dedicated; ///< Is this a dedicated server?
- bool version_compatible; ///< Can we connect to this server or not? (based on server_revision)
- bool compatible; ///< Can we connect to this server or not? (based on server_revision _and_ grf_match
bool use_password; ///< Is this server passworded?
- byte game_info_version; ///< Version of the game info
+ byte clients_on; ///< Current count of clients on server
byte clients_max; ///< Max clients allowed on server
byte companies_on; ///< How many started companies do we have
byte companies_max; ///< Max companies allowed on server
byte spectators_on; ///< How many spectators do we have?
byte spectators_max; ///< Max spectators allowed on server
- byte map_set; ///< Graphical set
+ byte landscape; ///< The used landscape
+};
+
+/**
+ * The game information that is sent from the server to the clients
+ * with extra information only required at the client side.
+ */
+struct NetworkGameInfo : NetworkServerGameInfo {
+ bool version_compatible; ///< Can we connect to this server or not? (based on server_revision)
+ bool compatible; ///< Can we connect to this server or not? (based on server_revision _and_ grf_match
+ byte game_info_version; ///< Version of the game info
};
extern NetworkServerGameInfo _network_game_info;
@@ -94,12 +94,12 @@ const char *GetNetworkRevisionString();
bool IsNetworkCompatibleVersion(const char *other);
void CheckGameCompatibility(NetworkGameInfo &ngi);
-void FillNetworkGameInfo(NetworkGameInfo &ngi);
+const NetworkServerGameInfo *GetCurrentNetworkServerGameInfo();
void DeserializeGRFIdentifier(Packet *p, GRFIdentifier *grf);
void SerializeGRFIdentifier(Packet *p, const GRFIdentifier *grf);
void DeserializeNetworkGameInfo(Packet *p, NetworkGameInfo *info);
-void SerializeNetworkGameInfo(Packet *p, const NetworkGameInfo *info);
+void SerializeNetworkGameInfo(Packet *p, const NetworkServerGameInfo *info);
#endif /* NETWORK_CORE_GAME_INFO_H */