OpenTTD Source  13.2.1
game_info.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6  */
7 
12 #include "../../stdafx.h"
13 #include "game_info.h"
14 #include "../../core/bitmath_func.hpp"
15 #include "../../company_base.h"
16 #include "../../date_func.h"
17 #include "../../debug.h"
18 #include "../../map_func.h"
19 #include "../../game/game.hpp"
20 #include "../../game/game_info.hpp"
21 #include "../../settings_type.h"
22 #include "../../string_func.h"
23 #include "../../rev.h"
24 #include "../network_func.h"
25 #include "../network.h"
26 #include "packet.h"
27 
28 #include "../../safeguards.h"
29 
30 
35 static const uint GITHASH_SUFFIX_LEN = 12;
36 
38 
43 std::string_view GetNetworkRevisionString()
44 {
45  static std::string network_revision;
46 
47  if (network_revision.empty()) {
48  network_revision = _openttd_revision;
49  if (_openttd_revision_tagged) {
50  /* 13.2.1 is a fix-release with only a single change in the Win32 video driver.
51  * As such, it is safe to call it 13.2 from a networking point of view. */
52  if (network_revision == "13.2.1") network_revision = "13.2";
53 
54  /* Tagged; do not mangle further, though ensure it's not too long. */
55  if (network_revision.size() >= NETWORK_REVISION_LENGTH) network_revision.resize(NETWORK_REVISION_LENGTH - 1);
56  } else {
57  /* Not tagged; add the githash suffix while ensuring the string does not become too long. */
58  assert(_openttd_revision_modified < 3);
59  std::string githash_suffix = fmt::format("-{}{}", "gum"[_openttd_revision_modified], _openttd_revision_hash);
60  if (githash_suffix.size() > GITHASH_SUFFIX_LEN) githash_suffix.resize(GITHASH_SUFFIX_LEN);
61 
62  /* Where did the hash start in the original string? Overwrite from that position, unless that would create a too long string. */
63  size_t hash_end = network_revision.find_last_of('-');
64  if (hash_end == std::string::npos) hash_end = network_revision.size();
65  if (hash_end + githash_suffix.size() >= NETWORK_REVISION_LENGTH) hash_end = NETWORK_REVISION_LENGTH - githash_suffix.size() - 1;
66 
67  /* Replace the git hash in revision string. */
68  network_revision.replace(hash_end, std::string::npos, githash_suffix);
69  }
70  assert(network_revision.size() < NETWORK_REVISION_LENGTH); // size does not include terminator, constant does, hence strictly less than
71  Debug(net, 3, "Network revision name: {}", network_revision);
72  }
73 
74  return network_revision;
75 }
76 
82 static std::string_view ExtractNetworkRevisionHash(std::string_view revision_string)
83 {
84  size_t index = revision_string.find_last_of('-');
85  if (index == std::string::npos) return {};
86  return revision_string.substr(index);
87 }
88 
94 bool IsNetworkCompatibleVersion(std::string_view other)
95 {
96  if (GetNetworkRevisionString() == other) return true;
97 
98  /* If this version is tagged, then the revision string must be a complete match,
99  * since there is no git hash suffix in it.
100  * This is needed to avoid situations like "1.9.0-beta1" comparing equal to "2.0.0-beta1". */
101  if (_openttd_revision_tagged) return false;
102 
103  std::string_view hash1 = ExtractNetworkRevisionHash(GetNetworkRevisionString());
104  std::string_view hash2 = ExtractNetworkRevisionHash(other);
105  return hash1 == hash2;
106 }
107 
112 {
113  /* Check if we are allowed on this server based on the revision-check. */
115  ngi.compatible = ngi.version_compatible;
116 
117  /* Check if we have all the GRFs on the client-system too. */
118  for (const GRFConfig *c = ngi.grfconfig; c != nullptr; c = c->next) {
119  if (c->status == GCS_NOT_FOUND) ngi.compatible = false;
120  }
121 }
122 
128 {
138 
141 }
142 
148 {
149  /* These variables are updated inside _network_game_info as if they are global variables:
150  * - clients_on
151  * - invite_code
152  * These don't need to be updated manually here.
153  */
155  _network_game_info.spectators_on = NetworkSpectatorCount();
157  return &_network_game_info;
158 }
159 
168 static void HandleIncomingNetworkGameInfoGRFConfig(GRFConfig *config, std::string name)
169 {
170  /* Find the matching GRF file */
171  const GRFConfig *f = FindGRFConfig(config->ident.grfid, FGCM_EXACT, config->ident.md5sum);
172  if (f == nullptr) {
173  AddGRFTextToList(config->name, name.empty() ? GetString(STR_CONFIG_ERROR_INVALID_GRF_UNKNOWN) : name);
174  config->status = GCS_NOT_FOUND;
175  } else {
176  config->filename = f->filename;
177  config->name = f->name;
178  config->info = f->info;
179  config->url = f->url;
180  }
181  SetBit(config->flags, GCF_COPY);
182 }
183 
189 void SerializeNetworkGameInfo(Packet *p, const NetworkServerGameInfo *info, bool send_newgrf_names)
190 {
192 
193  /*
194  * Please observe the order.
195  * The parts must be read in the same order as they are sent!
196  */
197 
198  /* Update the documentation in game_info.h on changes
199  * to the NetworkGameInfo wire-protocol! */
200 
201  /* NETWORK_GAME_INFO_VERSION = 6 */
202  p->Send_uint8(send_newgrf_names ? NST_GRFID_MD5_NAME : NST_GRFID_MD5);
203 
204  /* NETWORK_GAME_INFO_VERSION = 5 */
205  GameInfo *game_info = Game::GetInfo();
206  p->Send_uint32(game_info == nullptr ? -1 : (uint32)game_info->GetVersion());
207  p->Send_string(game_info == nullptr ? "" : game_info->GetName());
208 
209  /* NETWORK_GAME_INFO_VERSION = 4 */
210  {
211  /* Only send the GRF Identification (GRF_ID and MD5 checksum) of
212  * the GRFs that are needed, i.e. the ones that the server has
213  * selected in the NewGRF GUI and not the ones that are used due
214  * to the fact that they are in [newgrf-static] in openttd.cfg */
215  const GRFConfig *c;
216  uint count = 0;
217 
218  /* Count number of GRFs to send information about */
219  for (c = info->grfconfig; c != nullptr; c = c->next) {
220  if (!HasBit(c->flags, GCF_STATIC)) count++;
221  }
222  p->Send_uint8 (count); // Send number of GRFs
223 
224  /* Send actual GRF Identifications */
225  for (c = info->grfconfig; c != nullptr; c = c->next) {
226  if (HasBit(c->flags, GCF_STATIC)) continue;
227 
229  if (send_newgrf_names) p->Send_string(c->GetName());
230  }
231  }
232 
233  /* NETWORK_GAME_INFO_VERSION = 3 */
234  p->Send_uint32(info->game_date);
235  p->Send_uint32(info->start_date);
236 
237  /* NETWORK_GAME_INFO_VERSION = 2 */
238  p->Send_uint8 (info->companies_max);
239  p->Send_uint8 (info->companies_on);
240  p->Send_uint8 (info->clients_max); // Used to be max-spectators
241 
242  /* NETWORK_GAME_INFO_VERSION = 1 */
243  p->Send_string(info->server_name);
244  p->Send_string(info->server_revision);
245  p->Send_bool (info->use_password);
246  p->Send_uint8 (info->clients_max);
247  p->Send_uint8 (info->clients_on);
248  p->Send_uint8 (info->spectators_on);
249  p->Send_uint16(info->map_width);
250  p->Send_uint16(info->map_height);
251  p->Send_uint8 (info->landscape);
252  p->Send_bool (info->dedicated);
253 }
254 
261 {
262  static const Date MAX_DATE = ConvertYMDToDate(MAX_YEAR, 11, 31); // December is month 11
263 
264  byte game_info_version = p->Recv_uint8();
265  NewGRFSerializationType newgrf_serialisation = NST_GRFID_MD5;
266 
267  /*
268  * Please observe the order.
269  * The parts must be read in the same order as they are sent!
270  */
271 
272  /* Update the documentation in game_info.h on changes
273  * to the NetworkGameInfo wire-protocol! */
274 
275  switch (game_info_version) {
276  case 6:
277  newgrf_serialisation = (NewGRFSerializationType)p->Recv_uint8();
278  if (newgrf_serialisation >= NST_END) return;
279  FALLTHROUGH;
280 
281  case 5: {
282  info->gamescript_version = (int)p->Recv_uint32();
284  FALLTHROUGH;
285  }
286 
287  case 4: {
288  GRFConfig **dst = &info->grfconfig;
289  uint i;
290  uint num_grfs = p->Recv_uint8();
291 
292  /* Broken/bad data. It cannot have that many NewGRFs. */
293  if (num_grfs > NETWORK_MAX_GRF_COUNT) return;
294 
295  for (i = 0; i < num_grfs; i++) {
296  NamedGRFIdentifier grf;
297  switch (newgrf_serialisation) {
298  case NST_GRFID_MD5:
300  break;
301 
302  case NST_GRFID_MD5_NAME:
304  break;
305 
306  case NST_LOOKUP_ID: {
307  if (newgrf_lookup_table == nullptr) return;
308  auto it = newgrf_lookup_table->find(p->Recv_uint32());
309  if (it == newgrf_lookup_table->end()) return;
310  grf = it->second;
311  break;
312  }
313 
314  default:
315  NOT_REACHED();
316  }
317 
318  GRFConfig *c = new GRFConfig();
319  c->ident = grf.ident;
321 
322  /* Append GRFConfig to the list */
323  *dst = c;
324  dst = &c->next;
325  }
326  FALLTHROUGH;
327  }
328 
329  case 3:
330  info->game_date = Clamp(p->Recv_uint32(), 0, MAX_DATE);
331  info->start_date = Clamp(p->Recv_uint32(), 0, MAX_DATE);
332  FALLTHROUGH;
333 
334  case 2:
335  info->companies_max = p->Recv_uint8 ();
336  info->companies_on = p->Recv_uint8 ();
337  p->Recv_uint8(); // Used to contain max-spectators.
338  FALLTHROUGH;
339 
340  case 1:
343  if (game_info_version < 6) p->Recv_uint8 (); // Used to contain server-lang.
344  info->use_password = p->Recv_bool ();
345  info->clients_max = p->Recv_uint8 ();
346  info->clients_on = p->Recv_uint8 ();
347  info->spectators_on = p->Recv_uint8 ();
348  if (game_info_version < 3) { // 16 bits dates got scrapped and are read earlier
351  }
352  if (game_info_version < 6) while (p->Recv_uint8() != 0) {} // Used to contain the map-name.
353  info->map_width = p->Recv_uint16();
354  info->map_height = p->Recv_uint16();
355  info->landscape = p->Recv_uint8 ();
356  info->dedicated = p->Recv_bool ();
357 
358  if (info->landscape >= NUM_LANDSCAPE) info->landscape = 0;
359  }
360 }
361 
368 {
369  uint j;
370  p->Send_uint32(grf->grfid);
371  for (j = 0; j < sizeof(grf->md5sum); j++) {
372  p->Send_uint8(grf->md5sum[j]);
373  }
374 }
375 
382 {
383  uint j;
384  grf->grfid = p->Recv_uint32();
385  for (j = 0; j < sizeof(grf->md5sum); j++) {
386  grf->md5sum[j] = p->Recv_uint8();
387  }
388 }
389 
396 {
399 }
NST_END
@ NST_END
The end of the list (period).
Definition: game_info.h:87
SerializeNetworkGameInfo
void SerializeNetworkGameInfo(Packet *p, const NetworkServerGameInfo *info, bool send_newgrf_names)
Serializes the NetworkGameInfo struct to the packet.
Definition: game_info.cpp:189
NetworkServerGameInfo::gamescript_version
int gamescript_version
Version of the gamescript.
Definition: game_info.h:109
NetworkGameInfo
The game information that is sent from the server to the clients with extra information only required...
Definition: game_info.h:117
GRFConfig::info
GRFTextWrapper info
NOSAVE: GRF info (author, copyright, ...) (Action 0x08)
Definition: newgrf_config.h:167
NetworkServerGameInfo::gamescript_name
std::string gamescript_name
Name of the gamescript.
Definition: game_info.h:110
GITHASH_SUFFIX_LEN
static const uint GITHASH_SUFFIX_LEN
How many hex digits of the git hash to include in network revision string.
Definition: game_info.cpp:35
SerializeGRFIdentifier
void SerializeGRFIdentifier(Packet *p, const GRFIdentifier *grf)
Serializes the GRFIdentifier (GRF ID and MD5 checksum) to the packet.
Definition: game_info.cpp:367
FindGRFConfig
const GRFConfig * FindGRFConfig(uint32 grfid, FindGRFConfigMode mode, const uint8 *md5sum, uint32 desired_version)
Find a NewGRF in the scanned list.
Definition: newgrf_config.cpp:745
NetworkServerGameInfo::game_date
Date game_date
Current date.
Definition: game_info.h:96
GameCreationSettings::landscape
byte landscape
the landscape we're currently in
Definition: settings_type.h:328
NetworkSettings::max_clients
uint8 max_clients
maximum amount of clients
Definition: settings_type.h:301
NETWORK_NAME_LENGTH
static const uint NETWORK_NAME_LENGTH
The maximum length of the server name and map name, in bytes including '\0'.
Definition: config.h:55
NetworkServerGameInfo::server_revision
std::string server_revision
The version number the server is using (e.g.: 'r304' or 0.5.0)
Definition: game_info.h:100
Game::GetInfo
static class GameInfo * GetInfo()
Get the current GameInfo.
Definition: game.hpp:80
NST_LOOKUP_ID
@ NST_LOOKUP_ID
Unique ID into a lookup table that is sent before.
Definition: game_info.h:86
NST_GRFID_MD5
@ NST_GRFID_MD5
Unique GRF ID and MD5 checksum.
Definition: game_info.h:84
NetworkServerGameInfo::clients_max
byte clients_max
Max clients allowed on server.
Definition: game_info.h:104
DeserializeGRFIdentifier
void DeserializeGRFIdentifier(Packet *p, GRFIdentifier *grf)
Deserializes the GRFIdentifier (GRF ID and MD5 checksum) from the packet.
Definition: game_info.cpp:381
NamedGRFIdentifier::name
std::string name
The name of the NewGRF.
Definition: game_info.h:128
HasBit
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
Definition: bitmath_func.hpp:103
NetworkServerGameInfo
The game information that is sent from the server to the client.
Definition: game_info.h:93
GCS_NOT_FOUND
@ GCS_NOT_FOUND
GRF file was not found in the local cache.
Definition: newgrf_config.h:37
GetNetworkRevisionString
std::string_view GetNetworkRevisionString()
Get the network version string used by this build.
Definition: game_info.cpp:43
GRFConfig::ident
GRFIdentifier ident
grfid and md5sum to uniquely identify newgrfs
Definition: newgrf_config.h:163
_settings_client
ClientSettings _settings_client
The current settings for this game.
Definition: settings.cpp:53
GCF_COPY
@ GCF_COPY
The data is copied from a grf in _all_grfs.
Definition: newgrf_config.h:27
NamedGRFIdentifier::ident
GRFIdentifier ident
The unique identifier of the NewGRF.
Definition: game_info.h:127
GRFConfig::status
GRFStatus status
NOSAVE: GRFStatus, enum.
Definition: newgrf_config.h:174
_network_game_info
NetworkServerGameInfo _network_game_info
Information about our game.
Definition: game_info.cpp:37
Packet::Send_uint8
void Send_uint8(uint8 data)
Package a 8 bits integer in the packet.
Definition: packet.cpp:129
GRFIdentifier::md5sum
uint8 md5sum[16]
MD5 checksum of file to distinguish files with the same GRF ID (eg. newer version of GRF)
Definition: newgrf_config.h:85
NetworkGameInfo::version_compatible
bool version_compatible
Can we connect to this server or not? (based on server_revision)
Definition: game_info.h:118
GRFIdentifier::grfid
uint32 grfid
GRF ID (defined by Action 0x08)
Definition: newgrf_config.h:84
FillStaticNetworkServerGameInfo
void FillStaticNetworkServerGameInfo()
Fill a NetworkServerGameInfo structure with the static content, or things that are so static they can...
Definition: game_info.cpp:127
GameSettings::game_creation
GameCreationSettings game_creation
settings used during the creation of a game (map)
Definition: settings_type.h:587
Packet::Send_uint32
void Send_uint32(uint32 data)
Package a 32 bits integer in the packet.
Definition: packet.cpp:150
Packet::Recv_string
std::string Recv_string(size_t length, StringValidationSettings settings=SVS_REPLACE_WITH_QUESTION_MARK)
Reads characters (bytes) from the packet until it finds a '\0', or reaches a maximum of length charac...
Definition: packet.cpp:408
MapSizeX
static uint MapSizeX()
Get the size of the map along the X.
Definition: map_func.h:72
NETWORK_MAX_GRF_COUNT
static const uint NETWORK_MAX_GRF_COUNT
Maximum number of GRFs that can be sent.
Definition: config.h:95
GRFIdentifier
Basic data to distinguish a GRF.
Definition: newgrf_config.h:83
Packet::Recv_uint32
uint32 Recv_uint32()
Read a 32 bits integer from the packet.
Definition: packet.cpp:346
_date
Date _date
Current date in days (day counter)
Definition: date.cpp:28
GRFConfig
Information about GRF, used in the game and (part of it) in savegames.
Definition: newgrf_config.h:155
GRFConfig::flags
uint8 flags
NOSAVE: GCF_Flags, bitset.
Definition: newgrf_config.h:173
ConvertYMDToDate
Date ConvertYMDToDate(Year year, Month month, Day day)
Converts a tuple of Year, Month and Day to a Date.
Definition: date.cpp:149
Date
int32 Date
The type to store our dates in.
Definition: date_type.h:14
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:54
Packet::Send_uint16
void Send_uint16(uint16 data)
Package a 16 bits integer in the packet.
Definition: packet.cpp:139
NetworkServerGameInfo::companies_on
byte companies_on
How many started companies do we have.
Definition: game_info.h:105
MapSizeY
static uint MapSizeY()
Get the size of the map along the Y.
Definition: map_func.h:82
NetworkServerGameInfo::companies_max
byte companies_max
Max companies allowed on server.
Definition: game_info.h:106
NewGRFSerializationType
NewGRFSerializationType
The different types/ways a NewGRF can be serialized in the GameInfo since version 6.
Definition: game_info.h:83
_network_dedicated
bool _network_dedicated
are we a dedicated server?
Definition: network.cpp:61
Packet
Internal entity of a packet.
Definition: packet.h:44
NETWORK_REVISION_LENGTH
static const uint NETWORK_REVISION_LENGTH
The maximum length of the revision, in bytes including '\0'.
Definition: config.h:60
DeserializeNetworkGameInfo
void DeserializeNetworkGameInfo(Packet *p, NetworkGameInfo *info, const GameInfoNewGRFLookupTable *newgrf_lookup_table)
Deserializes the NetworkGameInfo struct from the packet.
Definition: game_info.cpp:260
NST_GRFID_MD5_NAME
@ NST_GRFID_MD5_NAME
Unique GRF ID, MD5 checksum and name.
Definition: game_info.h:85
GetCurrentNetworkServerGameInfo
const NetworkServerGameInfo * GetCurrentNetworkServerGameInfo()
Get the NetworkServerGameInfo structure with the latest information of the server.
Definition: game_info.cpp:147
IsNetworkCompatibleVersion
bool IsNetworkCompatibleVersion(std::string_view other)
Checks whether the given version string is compatible with our version.
Definition: game_info.cpp:94
Packet::Send_bool
void Send_bool(bool data)
Package a boolean in the packet.
Definition: packet.cpp:120
NetworkSettings::server_name
std::string server_name
name of the server
Definition: settings_type.h:288
Clamp
static T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
Definition: math_func.hpp:77
ScriptInfo::GetVersion
int GetVersion() const
Get the version of the script.
Definition: script_info.hpp:70
GRFConfig::name
GRFTextWrapper name
NOSAVE: GRF name (Action 0x08)
Definition: newgrf_config.h:166
Pool::PoolItem<&_company_pool >::GetNumItems
static size_t GetNumItems()
Returns number of valid items in the pool.
Definition: pool_type.hpp:367
NetworkServerGameInfo::map_width
uint16 map_width
Map width.
Definition: game_info.h:97
Packet::Recv_bool
bool Recv_bool()
Read a boolean from the packet.
Definition: packet.cpp:308
NetworkServerGameInfo::dedicated
bool dedicated
Is this a dedicated server?
Definition: game_info.h:101
packet.h
NetworkServerGameInfo::use_password
bool use_password
Is this server passworded?
Definition: game_info.h:102
NETWORK_GRF_NAME_LENGTH
static const uint NETWORK_GRF_NAME_LENGTH
Maximum length of the name of a GRF.
Definition: config.h:78
GRFConfig::next
struct GRFConfig * next
NOSAVE: Next item in the linked list.
Definition: newgrf_config.h:183
NetworkSettings::server_password
std::string server_password
password for joining this server
Definition: settings_type.h:289
GameInfo
All static information from an Game like name, version, etc.
Definition: game_info.hpp:16
game_info.h
GameCreationSettings::starting_year
Year starting_year
starting date
Definition: settings_type.h:313
GRFConfig::url
GRFTextWrapper url
NOSAVE: URL belonging to this GRF.
Definition: newgrf_config.h:168
Packet::Recv_uint8
uint8 Recv_uint8()
Read a 8 bits integer from the packet.
Definition: packet.cpp:317
NetworkServerGameInfo::spectators_on
byte spectators_on
How many spectators do we have?
Definition: game_info.h:107
CheckGameCompatibility
void CheckGameCompatibility(NetworkGameInfo &ngi)
Check if an game entry is compatible with our client.
Definition: game_info.cpp:111
_grfconfig
GRFConfig * _grfconfig
First item in list of current GRF set up.
Definition: newgrf_config.cpp:171
GameInfoNewGRFLookupTable
std::unordered_map< uint32, NamedGRFIdentifier > GameInfoNewGRFLookupTable
Lookup table for the GameInfo in case of NST_LOOKUP_ID.
Definition: game_info.h:131
Packet::Send_string
void Send_string(const std::string_view data)
Sends a string over the network.
Definition: packet.cpp:181
DeserializeGRFIdentifierWithName
void DeserializeGRFIdentifierWithName(Packet *p, NamedGRFIdentifier *grf)
Deserializes the NamedGRFIdentifier (GRF ID, MD5 checksum and name) from the packet.
Definition: game_info.cpp:395
Debug
#define Debug(name, level, format_string,...)
Ouptut a line of debugging information.
Definition: debug.h:37
SetBit
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
Definition: bitmath_func.hpp:121
ClientSettings::network
NetworkSettings network
settings related to the network
Definition: settings_type.h:605
NetworkServerGameInfo::start_date
Date start_date
When the game started.
Definition: game_info.h:95
NetworkServerGameInfo::landscape
byte landscape
The used landscape.
Definition: game_info.h:108
NetworkServerGameInfo::server_name
std::string server_name
Server name.
Definition: game_info.h:99
FGCM_EXACT
@ FGCM_EXACT
Only find Grfs matching md5sum.
Definition: newgrf_config.h:199
ScriptInfo::GetName
const char * GetName() const
Get the Name of the script.
Definition: script_info.hpp:55
NETWORK_GAME_INFO_VERSION
static const byte NETWORK_GAME_INFO_VERSION
What version of game-info do we use?
Definition: config.h:51
GRFConfig::filename
char * filename
Filename - either with or without full path.
Definition: newgrf_config.h:165
NetworkServerGameInfo::clients_on
byte clients_on
Current count of clients on server.
Definition: game_info.h:103
HandleIncomingNetworkGameInfoGRFConfig
static void HandleIncomingNetworkGameInfoGRFConfig(GRFConfig *config, std::string name)
Function that is called for every GRFConfig that is read when receiving a NetworkGameInfo.
Definition: game_info.cpp:168
NetworkServerGameInfo::grfconfig
GRFConfig * grfconfig
List of NewGRF files used.
Definition: game_info.h:94
NamedGRFIdentifier
Container to hold the GRF identifier (GRF ID + MD5 checksum) and the name associated with that NewGRF...
Definition: game_info.h:126
NetworkGameInfo::compatible
bool compatible
Can we connect to this server or not? (based on server_revision and grf_match.
Definition: game_info.h:119
AddGRFTextToList
static void AddGRFTextToList(GRFTextList &list, byte langid, const std::string &text_to_add)
Add a new text to a GRFText list.
Definition: newgrf_text.cpp:493
NetworkServerGameInfo::map_height
uint16 map_height
Map height.
Definition: game_info.h:98
GCF_STATIC
@ GCF_STATIC
GRF file is used statically (can be used in any MP game)
Definition: newgrf_config.h:25
Packet::Recv_uint16
uint16 Recv_uint16()
Read a 16 bits integer from the packet.
Definition: packet.cpp:331
DAYS_TILL_ORIGINAL_BASE_YEAR
#define DAYS_TILL_ORIGINAL_BASE_YEAR
The offset in days from the '_date == 0' till 'ConvertYMDToDate(ORIGINAL_BASE_YEAR,...
Definition: date_type.h:81
GRFConfig::GetName
const char * GetName() const
Get the name of this grf.
Definition: newgrf_config.cpp:105
NetworkSettings::max_companies
uint8 max_companies
maximum amount of companies
Definition: settings_type.h:300
ExtractNetworkRevisionHash
static std::string_view ExtractNetworkRevisionHash(std::string_view revision_string)
Extract the git hash from the revision string.
Definition: game_info.cpp:82
MAX_YEAR
static const Year MAX_YEAR
MAX_YEAR, nicely rounded value of the number of years that can be encoded in a single 32 bits date,...
Definition: date_type.h:95