OpenTTD Source  12.0-beta2
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  /* Tagged; do not mangle further, though ensure it's not too long. */
51  if (network_revision.size() >= NETWORK_REVISION_LENGTH) network_revision.resize(NETWORK_REVISION_LENGTH - 1);
52  } else {
53  /* Not tagged; add the githash suffix while ensuring the string does not become too long. */
54  assert(_openttd_revision_modified < 3);
55  std::string githash_suffix = fmt::format("-{}{}", "gum"[_openttd_revision_modified], _openttd_revision_hash);
56  if (githash_suffix.size() > GITHASH_SUFFIX_LEN) githash_suffix.resize(GITHASH_SUFFIX_LEN);
57 
58  /* Where did the hash start in the original string? Overwrite from that position, unless that would create a too long string. */
59  size_t hash_end = network_revision.find_last_of('-');
60  if (hash_end == std::string::npos) hash_end = network_revision.size();
61  if (hash_end + githash_suffix.size() >= NETWORK_REVISION_LENGTH) hash_end = NETWORK_REVISION_LENGTH - githash_suffix.size() - 1;
62 
63  /* Replace the git hash in revision string. */
64  network_revision.replace(hash_end, std::string::npos, githash_suffix);
65  }
66  assert(network_revision.size() < NETWORK_REVISION_LENGTH); // size does not include terminator, constant does, hence strictly less than
67  Debug(net, 3, "Network revision name: {}", network_revision);
68  }
69 
70  return network_revision;
71 }
72 
78 static std::string_view ExtractNetworkRevisionHash(std::string_view revision_string)
79 {
80  size_t index = revision_string.find_last_of('-');
81  if (index == std::string::npos) return {};
82  return revision_string.substr(index);
83 }
84 
90 bool IsNetworkCompatibleVersion(std::string_view other)
91 {
92  if (GetNetworkRevisionString() == other) return true;
93 
94  /* If this version is tagged, then the revision string must be a complete match,
95  * since there is no git hash suffix in it.
96  * This is needed to avoid situations like "1.9.0-beta1" comparing equal to "2.0.0-beta1". */
97  if (_openttd_revision_tagged) return false;
98 
99  std::string_view hash1 = ExtractNetworkRevisionHash(GetNetworkRevisionString());
100  std::string_view hash2 = ExtractNetworkRevisionHash(other);
101  return hash1 == hash2;
102 }
103 
108 {
109  /* Check if we are allowed on this server based on the revision-check. */
111  ngi.compatible = ngi.version_compatible;
112 
113  /* Check if we have all the GRFs on the client-system too. */
114  for (const GRFConfig *c = ngi.grfconfig; c != nullptr; c = c->next) {
115  if (c->status == GCS_NOT_FOUND) ngi.compatible = false;
116  }
117 }
118 
124 {
134 
137 }
138 
144 {
145  /* These variables are updated inside _network_game_info as if they are global variables:
146  * - clients_on
147  * - invite_code
148  * These don't need to be updated manually here.
149  */
151  _network_game_info.spectators_on = NetworkSpectatorCount();
153  return &_network_game_info;
154 }
155 
164 static void HandleIncomingNetworkGameInfoGRFConfig(GRFConfig *config, std::string name)
165 {
166  /* Find the matching GRF file */
167  const GRFConfig *f = FindGRFConfig(config->ident.grfid, FGCM_EXACT, config->ident.md5sum);
168  if (f == nullptr) {
169  AddGRFTextToList(config->name, name.empty() ? GetString(STR_CONFIG_ERROR_INVALID_GRF_UNKNOWN) : name);
170  config->status = GCS_NOT_FOUND;
171  } else {
172  config->filename = f->filename;
173  config->name = f->name;
174  config->info = f->info;
175  config->url = f->url;
176  }
177  SetBit(config->flags, GCF_COPY);
178 }
179 
185 void SerializeNetworkGameInfo(Packet *p, const NetworkServerGameInfo *info, bool send_newgrf_names)
186 {
188 
189  /*
190  * Please observe the order.
191  * The parts must be read in the same order as they are sent!
192  */
193 
194  /* Update the documentation in game_info.h on changes
195  * to the NetworkGameInfo wire-protocol! */
196 
197  /* NETWORK_GAME_INFO_VERSION = 6 */
198  p->Send_uint8(send_newgrf_names ? NST_GRFID_MD5_NAME : NST_GRFID_MD5);
199 
200  /* NETWORK_GAME_INFO_VERSION = 5 */
201  GameInfo *game_info = Game::GetInfo();
202  p->Send_uint32(game_info == nullptr ? -1 : (uint32)game_info->GetVersion());
203  p->Send_string(game_info == nullptr ? "" : game_info->GetName());
204 
205  /* NETWORK_GAME_INFO_VERSION = 4 */
206  {
207  /* Only send the GRF Identification (GRF_ID and MD5 checksum) of
208  * the GRFs that are needed, i.e. the ones that the server has
209  * selected in the NewGRF GUI and not the ones that are used due
210  * to the fact that they are in [newgrf-static] in openttd.cfg */
211  const GRFConfig *c;
212  uint count = 0;
213 
214  /* Count number of GRFs to send information about */
215  for (c = info->grfconfig; c != nullptr; c = c->next) {
216  if (!HasBit(c->flags, GCF_STATIC)) count++;
217  }
218  p->Send_uint8 (count); // Send number of GRFs
219 
220  /* Send actual GRF Identifications */
221  for (c = info->grfconfig; c != nullptr; c = c->next) {
222  if (HasBit(c->flags, GCF_STATIC)) continue;
223 
225  if (send_newgrf_names) p->Send_string(c->GetName());
226  }
227  }
228 
229  /* NETWORK_GAME_INFO_VERSION = 3 */
230  p->Send_uint32(info->game_date);
231  p->Send_uint32(info->start_date);
232 
233  /* NETWORK_GAME_INFO_VERSION = 2 */
234  p->Send_uint8 (info->companies_max);
235  p->Send_uint8 (info->companies_on);
236  p->Send_uint8 (info->clients_max); // Used to be max-spectators
237 
238  /* NETWORK_GAME_INFO_VERSION = 1 */
239  p->Send_string(info->server_name);
240  p->Send_string(info->server_revision);
241  p->Send_bool (info->use_password);
242  p->Send_uint8 (info->clients_max);
243  p->Send_uint8 (info->clients_on);
244  p->Send_uint8 (info->spectators_on);
245  p->Send_uint16(info->map_width);
246  p->Send_uint16(info->map_height);
247  p->Send_uint8 (info->landscape);
248  p->Send_bool (info->dedicated);
249 }
250 
257 {
258  static const Date MAX_DATE = ConvertYMDToDate(MAX_YEAR, 11, 31); // December is month 11
259 
260  byte game_info_version = p->Recv_uint8();
261  NewGRFSerializationType newgrf_serialisation = NST_GRFID_MD5;
262 
263  /*
264  * Please observe the order.
265  * The parts must be read in the same order as they are sent!
266  */
267 
268  /* Update the documentation in game_info.h on changes
269  * to the NetworkGameInfo wire-protocol! */
270 
271  switch (game_info_version) {
272  case 6:
273  newgrf_serialisation = (NewGRFSerializationType)p->Recv_uint8();
274  if (newgrf_serialisation >= NST_END) return;
275  FALLTHROUGH;
276 
277  case 5: {
278  info->gamescript_version = (int)p->Recv_uint32();
280  FALLTHROUGH;
281  }
282 
283  case 4: {
284  GRFConfig **dst = &info->grfconfig;
285  uint i;
286  uint num_grfs = p->Recv_uint8();
287 
288  /* Broken/bad data. It cannot have that many NewGRFs. */
289  if (num_grfs > NETWORK_MAX_GRF_COUNT) return;
290 
291  for (i = 0; i < num_grfs; i++) {
292  NamedGRFIdentifier grf;
293  switch (newgrf_serialisation) {
294  case NST_GRFID_MD5:
296  break;
297 
298  case NST_GRFID_MD5_NAME:
300  break;
301 
302  case NST_LOOKUP_ID: {
303  if (newgrf_lookup_table == nullptr) return;
304  auto it = newgrf_lookup_table->find(p->Recv_uint32());
305  if (it == newgrf_lookup_table->end()) return;
306  grf = it->second;
307  break;
308  }
309 
310  default:
311  NOT_REACHED();
312  }
313 
314  GRFConfig *c = new GRFConfig();
315  c->ident = grf.ident;
317 
318  /* Append GRFConfig to the list */
319  *dst = c;
320  dst = &c->next;
321  }
322  FALLTHROUGH;
323  }
324 
325  case 3:
326  info->game_date = Clamp(p->Recv_uint32(), 0, MAX_DATE);
327  info->start_date = Clamp(p->Recv_uint32(), 0, MAX_DATE);
328  FALLTHROUGH;
329 
330  case 2:
331  info->companies_max = p->Recv_uint8 ();
332  info->companies_on = p->Recv_uint8 ();
333  p->Recv_uint8(); // Used to contain max-spectators.
334  FALLTHROUGH;
335 
336  case 1:
339  if (game_info_version < 6) p->Recv_uint8 (); // Used to contain server-lang.
340  info->use_password = p->Recv_bool ();
341  info->clients_max = p->Recv_uint8 ();
342  info->clients_on = p->Recv_uint8 ();
343  info->spectators_on = p->Recv_uint8 ();
344  if (game_info_version < 3) { // 16 bits dates got scrapped and are read earlier
347  }
348  if (game_info_version < 6) while (p->Recv_uint8() != 0) {} // Used to contain the map-name.
349  info->map_width = p->Recv_uint16();
350  info->map_height = p->Recv_uint16();
351  info->landscape = p->Recv_uint8 ();
352  info->dedicated = p->Recv_bool ();
353 
354  if (info->landscape >= NUM_LANDSCAPE) info->landscape = 0;
355  }
356 }
357 
364 {
365  uint j;
366  p->Send_uint32(grf->grfid);
367  for (j = 0; j < sizeof(grf->md5sum); j++) {
368  p->Send_uint8(grf->md5sum[j]);
369  }
370 }
371 
378 {
379  uint j;
380  grf->grfid = p->Recv_uint32();
381  for (j = 0; j < sizeof(grf->md5sum); j++) {
382  grf->md5sum[j] = p->Recv_uint8();
383  }
384 }
385 
392 {
395 }
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:185
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:363
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:736
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:320
NetworkSettings::max_clients
uint8 max_clients
maximum amount of clients
Definition: settings_type.h:293
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:377
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:52
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:123
GameSettings::game_creation
GameCreationSettings game_creation
settings used during the creation of a game (map)
Definition: settings_type.h:576
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:380
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:335
_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:53
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:59
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:256
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:143
IsNetworkCompatibleVersion
bool IsNetworkCompatibleVersion(std::string_view other)
Checks whether the given version string is compatible with our version.
Definition: game_info.cpp:90
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:279
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:297
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:280
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:305
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:306
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:107
_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:391
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:594
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
ScriptInfo::name
const char * name
Full name of the script.
Definition: script_info.hpp:156
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:164
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:320
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:292
ExtractNetworkRevisionHash
static std::string_view ExtractNetworkRevisionHash(std::string_view revision_string)
Extract the git hash from the revision string.
Definition: game_info.cpp:78
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