OpenTTD Source  14.0-beta3
network_game_info.cpp
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 "network_game_info.h"
14 #include "../../core/bitmath_func.hpp"
15 #include "../../company_base.h"
16 #include "../../timer/timer_game_calendar.h"
17 #include "../../timer/timer_game_tick.h"
18 #include "../../debug.h"
19 #include "../../map_func.h"
20 #include "../../game/game.hpp"
21 #include "../../game/game_info.hpp"
22 #include "../../settings_type.h"
23 #include "../../string_func.h"
24 #include "../../rev.h"
25 #include "../network_func.h"
26 #include "../network.h"
27 #include "packet.h"
28 
29 #include "../../safeguards.h"
30 
31 
36 static const uint GITHASH_SUFFIX_LEN = 12;
37 
38 NetworkServerGameInfo _network_game_info;
39 
44 std::string_view GetNetworkRevisionString()
45 {
46  static std::string network_revision;
47 
48  if (network_revision.empty()) {
49  network_revision = _openttd_revision;
50  if (_openttd_revision_tagged) {
51  /* Tagged; do not mangle further, though ensure it's not too long. */
52  if (network_revision.size() >= NETWORK_REVISION_LENGTH) network_revision.resize(NETWORK_REVISION_LENGTH - 1);
53  } else {
54  /* Not tagged; add the githash suffix while ensuring the string does not become too long. */
55  assert(_openttd_revision_modified < 3);
56  std::string githash_suffix = fmt::format("-{}{}", "gum"[_openttd_revision_modified], _openttd_revision_hash);
57  if (githash_suffix.size() > GITHASH_SUFFIX_LEN) githash_suffix.resize(GITHASH_SUFFIX_LEN);
58 
59  /* Where did the hash start in the original string? Overwrite from that position, unless that would create a too long string. */
60  size_t hash_end = network_revision.find_last_of('-');
61  if (hash_end == std::string::npos) hash_end = network_revision.size();
62  if (hash_end + githash_suffix.size() >= NETWORK_REVISION_LENGTH) hash_end = NETWORK_REVISION_LENGTH - githash_suffix.size() - 1;
63 
64  /* Replace the git hash in revision string. */
65  network_revision.replace(hash_end, std::string::npos, githash_suffix);
66  }
67  assert(network_revision.size() < NETWORK_REVISION_LENGTH); // size does not include terminator, constant does, hence strictly less than
68  Debug(net, 3, "Network revision name: {}", network_revision);
69  }
70 
71  return network_revision;
72 }
73 
79 static std::string_view ExtractNetworkRevisionHash(std::string_view revision_string)
80 {
81  size_t index = revision_string.find_last_of('-');
82  if (index == std::string::npos) return {};
83  return revision_string.substr(index);
84 }
85 
91 bool IsNetworkCompatibleVersion(std::string_view other)
92 {
93  if (GetNetworkRevisionString() == other) return true;
94 
95  /* If this version is tagged, then the revision string must be a complete match,
96  * since there is no git hash suffix in it.
97  * This is needed to avoid situations like "1.9.0-beta1" comparing equal to "2.0.0-beta1". */
98  if (_openttd_revision_tagged) return false;
99 
100  std::string_view hash1 = ExtractNetworkRevisionHash(GetNetworkRevisionString());
101  std::string_view hash2 = ExtractNetworkRevisionHash(other);
102  return hash1 == hash2;
103 }
104 
108 void CheckGameCompatibility(NetworkGameInfo &ngi)
109 {
110  /* Check if we are allowed on this server based on the revision-check. */
111  ngi.version_compatible = IsNetworkCompatibleVersion(ngi.server_revision);
112  ngi.compatible = ngi.version_compatible;
113 
114  /* Check if we have all the GRFs on the client-system too. */
115  for (const GRFConfig *c = ngi.grfconfig; c != nullptr; c = c->next) {
116  if (c->status == GCS_NOT_FOUND) ngi.compatible = false;
117  }
118 }
119 
124 void FillStaticNetworkServerGameInfo()
125 {
126  _network_game_info.use_password = !_settings_client.network.server_password.empty();
128  _network_game_info.clients_max = _settings_client.network.max_clients;
130  _network_game_info.map_width = Map::SizeX();
131  _network_game_info.map_height = Map::SizeY();
132  _network_game_info.landscape = _settings_game.game_creation.landscape;
133  _network_game_info.dedicated = _network_dedicated;
134  _network_game_info.grfconfig = _grfconfig;
135 
136  _network_game_info.server_name = _settings_client.network.server_name;
137  _network_game_info.server_revision = GetNetworkRevisionString();
138 }
139 
144 const NetworkServerGameInfo &GetCurrentNetworkServerGameInfo()
145 {
146  /* These variables are updated inside _network_game_info as if they are global variables:
147  * - clients_on
148  * - invite_code
149  * These don't need to be updated manually here.
150  */
151  _network_game_info.companies_on = (byte)Company::GetNumItems();
152  _network_game_info.spectators_on = NetworkSpectatorCount();
153  _network_game_info.calendar_date = TimerGameCalendar::date;
154  _network_game_info.ticks_playing = TimerGameTick::counter;
155  return _network_game_info;
156 }
157 
166 static void HandleIncomingNetworkGameInfoGRFConfig(GRFConfig *config, std::string name)
167 {
168  /* Find the matching GRF file */
169  const GRFConfig *f = FindGRFConfig(config->ident.grfid, FGCM_EXACT, &config->ident.md5sum);
170  if (f == nullptr) {
171  AddGRFTextToList(config->name, name.empty() ? GetString(STR_CONFIG_ERROR_INVALID_GRF_UNKNOWN) : name);
172  config->status = GCS_NOT_FOUND;
173  } else {
174  config->filename = f->filename;
175  config->name = f->name;
176  config->info = f->info;
177  config->url = f->url;
178  }
179  SetBit(config->flags, GCF_COPY);
180 }
181 
187 void SerializeNetworkGameInfo(Packet &p, const NetworkServerGameInfo &info, bool send_newgrf_names)
188 {
190 
191  /*
192  * Please observe the order.
193  * The parts must be read in the same order as they are sent!
194  */
195 
196  /* Update the documentation in game_info.h on changes
197  * to the NetworkGameInfo wire-protocol! */
198 
199  /* NETWORK_GAME_INFO_VERSION = 7 */
200  p.Send_uint64(info.ticks_playing);
201 
202  /* NETWORK_GAME_INFO_VERSION = 6 */
203  p.Send_uint8(send_newgrf_names ? NST_GRFID_MD5_NAME : NST_GRFID_MD5);
204 
205  /* NETWORK_GAME_INFO_VERSION = 5 */
206  GameInfo *game_info = Game::GetInfo();
207  p.Send_uint32(game_info == nullptr ? -1 : (uint32_t)game_info->GetVersion());
208  p.Send_string(game_info == nullptr ? "" : game_info->GetName());
209 
210  /* NETWORK_GAME_INFO_VERSION = 4 */
211  {
212  /* Only send the GRF Identification (GRF_ID and MD5 checksum) of
213  * the GRFs that are needed, i.e. the ones that the server has
214  * selected in the NewGRF GUI and not the ones that are used due
215  * to the fact that they are in [newgrf-static] in openttd.cfg */
216  const GRFConfig *c;
217  uint count = 0;
218 
219  /* Count number of GRFs to send information about */
220  for (c = info.grfconfig; c != nullptr; c = c->next) {
221  if (!HasBit(c->flags, GCF_STATIC)) count++;
222  }
223  p.Send_uint8 (count); // Send number of GRFs
224 
225  /* Send actual GRF Identifications */
226  for (c = info.grfconfig; c != nullptr; c = c->next) {
227  if (HasBit(c->flags, GCF_STATIC)) continue;
228 
229  SerializeGRFIdentifier(p, c->ident);
230  if (send_newgrf_names) p.Send_string(c->GetName());
231  }
232  }
233 
234  /* NETWORK_GAME_INFO_VERSION = 3 */
235  p.Send_uint32(info.calendar_date.base());
236  p.Send_uint32(info.calendar_start.base());
237 
238  /* NETWORK_GAME_INFO_VERSION = 2 */
239  p.Send_uint8 (info.companies_max);
240  p.Send_uint8 (info.companies_on);
241  p.Send_uint8 (info.clients_max); // Used to be max-spectators
242 
243  /* NETWORK_GAME_INFO_VERSION = 1 */
244  p.Send_string(info.server_name);
246  p.Send_bool (info.use_password);
247  p.Send_uint8 (info.clients_max);
248  p.Send_uint8 (info.clients_on);
249  p.Send_uint8 (info.spectators_on);
250  p.Send_uint16(info.map_width);
251  p.Send_uint16(info.map_height);
252  p.Send_uint8 (info.landscape);
253  p.Send_bool (info.dedicated);
254 }
255 
261 void DeserializeNetworkGameInfo(Packet &p, NetworkGameInfo &info, const GameInfoNewGRFLookupTable *newgrf_lookup_table)
262 {
263  byte game_info_version = p.Recv_uint8();
264  NewGRFSerializationType newgrf_serialisation = NST_GRFID_MD5;
265 
266  /*
267  * Please observe the order.
268  * The parts must be read in the same order as they are sent!
269  */
270 
271  /* Update the documentation in game_info.h on changes
272  * to the NetworkGameInfo wire-protocol! */
273 
274  switch (game_info_version) {
275  case 7:
276  info.ticks_playing = p.Recv_uint64();
277  [[fallthrough]];
278 
279  case 6:
280  newgrf_serialisation = (NewGRFSerializationType)p.Recv_uint8();
281  if (newgrf_serialisation >= NST_END) return;
282  [[fallthrough]];
283 
284  case 5: {
285  info.gamescript_version = (int)p.Recv_uint32();
287  [[fallthrough]];
288  }
289 
290  case 4: {
291  /* Ensure that the maximum number of NewGRFs and the field in the network
292  * protocol are matched to eachother. If that is not the case anymore a
293  * check must be added to ensure the received data is still valid. */
294  static_assert(std::numeric_limits<uint8_t>::max() == NETWORK_MAX_GRF_COUNT);
295  uint num_grfs = p.Recv_uint8();
296 
297  GRFConfig **dst = &info.grfconfig;
298  for (uint i = 0; i < num_grfs; i++) {
299  NamedGRFIdentifier grf;
300  switch (newgrf_serialisation) {
301  case NST_GRFID_MD5:
302  DeserializeGRFIdentifier(p, grf.ident);
303  break;
304 
305  case NST_GRFID_MD5_NAME:
306  DeserializeGRFIdentifierWithName(p, grf);
307  break;
308 
309  case NST_LOOKUP_ID: {
310  if (newgrf_lookup_table == nullptr) return;
311  auto it = newgrf_lookup_table->find(p.Recv_uint32());
312  if (it == newgrf_lookup_table->end()) return;
313  grf = it->second;
314  break;
315  }
316 
317  default:
318  NOT_REACHED();
319  }
320 
321  GRFConfig *c = new GRFConfig();
322  c->ident = grf.ident;
323  HandleIncomingNetworkGameInfoGRFConfig(c, grf.name);
324 
325  /* Append GRFConfig to the list */
326  *dst = c;
327  dst = &c->next;
328  }
329  [[fallthrough]];
330  }
331 
332  case 3:
333  info.calendar_date = Clamp(p.Recv_uint32(), 0, CalendarTime::MAX_DATE.base());
335  [[fallthrough]];
336 
337  case 2:
338  info.companies_max = p.Recv_uint8 ();
339  info.companies_on = p.Recv_uint8 ();
340  p.Recv_uint8(); // Used to contain max-spectators.
341  [[fallthrough]];
342 
343  case 1:
346  if (game_info_version < 6) p.Recv_uint8 (); // Used to contain server-lang.
347  info.use_password = p.Recv_bool ();
348  info.clients_max = p.Recv_uint8 ();
349  info.clients_on = p.Recv_uint8 ();
350  info.spectators_on = p.Recv_uint8 ();
351  if (game_info_version < 3) { // 16 bits dates got scrapped and are read earlier
354  }
355  if (game_info_version < 6) while (p.Recv_uint8() != 0) {} // Used to contain the map-name.
356  info.map_width = p.Recv_uint16();
357  info.map_height = p.Recv_uint16();
358  info.landscape = p.Recv_uint8 ();
359  info.dedicated = p.Recv_bool ();
360 
361  if (info.landscape >= NUM_LANDSCAPE) info.landscape = 0;
362  }
363 
364  /* For older servers, estimate the ticks running based on the calendar date. */
365  if (game_info_version < 7) {
366  info.ticks_playing = static_cast<uint64_t>(std::max(0, info.calendar_date.base() - info.calendar_start.base())) * Ticks::DAY_TICKS;
367  }
368 }
369 
375 void SerializeGRFIdentifier(Packet &p, const GRFIdentifier &grf)
376 {
377  p.Send_uint32(grf.grfid);
378  for (size_t j = 0; j < grf.md5sum.size(); j++) {
379  p.Send_uint8(grf.md5sum[j]);
380  }
381 }
382 
388 void DeserializeGRFIdentifier(Packet &p, GRFIdentifier &grf)
389 {
390  grf.grfid = p.Recv_uint32();
391  for (size_t j = 0; j < grf.md5sum.size(); j++) {
392  grf.md5sum[j] = p.Recv_uint8();
393  }
394 }
395 
401 void DeserializeGRFIdentifierWithName(Packet &p, NamedGRFIdentifier &grf)
402 {
403  DeserializeGRFIdentifier(p, grf.ident);
405 }
Packet::Recv_uint64
uint64_t Recv_uint64()
Read a 64 bits integer from the packet.
Definition: packet.cpp:338
NetworkServerGameInfo::gamescript_version
int gamescript_version
Version of the gamescript.
Definition: network_game_info.h:113
NetworkGameInfo
The game information that is sent from the server to the clients with extra information only required...
Definition: network_game_info.h:121
GRFConfig::info
GRFTextWrapper info
NOSAVE: GRF info (author, copyright, ...) (Action 0x08)
Definition: newgrf_config.h:158
Packet::Send_uint64
void Send_uint64(uint64_t data)
Package a 64 bits integer in the packet.
Definition: packet.cpp:138
NetworkServerGameInfo::gamescript_name
std::string gamescript_name
Name of the gamescript.
Definition: network_game_info.h:114
SetBit
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
Definition: bitmath_func.hpp:121
TimerGameTick::counter
static TickCounter counter
Monotonic counter, in ticks, since start of game.
Definition: timer_game_tick.h:33
TimerGameConst< struct Calendar >::DAYS_TILL_ORIGINAL_BASE_YEAR
static constexpr TimerGame< struct Calendar >::Date DAYS_TILL_ORIGINAL_BASE_YEAR
The date of the first day of the original base year.
Definition: timer_game_common.h:184
GameCreationSettings::landscape
byte landscape
the landscape we're currently in
Definition: settings_type.h:356
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:53
NetworkServerGameInfo::server_revision
std::string server_revision
The version number the server is using (e.g.: 'r304' or 0.5.0)
Definition: network_game_info.h:104
Game::GetInfo
static class GameInfo * GetInfo()
Get the current GameInfo.
Definition: game.hpp:76
NetworkServerGameInfo::clients_max
byte clients_max
Max clients allowed on server.
Definition: network_game_info.h:108
NamedGRFIdentifier::name
std::string name
The name of the NewGRF.
Definition: network_game_info.h:132
GRFConfig::filename
std::string filename
Filename - either with or without full path.
Definition: newgrf_config.h:156
NetworkServerGameInfo
The game information that is sent from the server to the client.
Definition: network_game_info.h:96
GCS_NOT_FOUND
@ GCS_NOT_FOUND
GRF file was not found in the local cache.
Definition: newgrf_config.h:37
GRFConfig::ident
GRFIdentifier ident
grfid and md5sum to uniquely identify newgrfs
Definition: newgrf_config.h:154
_settings_client
ClientSettings _settings_client
The current settings for this game.
Definition: settings.cpp:54
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: network_game_info.h:131
GRFConfig::status
GRFStatus status
NOSAVE: GRFStatus, enum.
Definition: newgrf_config.h:165
NetworkGameInfo::version_compatible
bool version_compatible
Can we connect to this server or not? (based on server_revision)
Definition: network_game_info.h:122
Debug
#define Debug(category, level, format_string,...)
Ouptut a line of debugging information.
Definition: debug.h:37
GameSettings::game_creation
GameCreationSettings game_creation
settings used during the creation of a game (map)
Definition: settings_type.h:619
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:383
TimerGameConst< struct Calendar >::MAX_DATE
static constexpr TimerGame< struct Calendar >::Date MAX_DATE
The date of the last day of the max year.
Definition: timer_game_common.h:187
NETWORK_MAX_GRF_COUNT
static const uint NETWORK_MAX_GRF_COUNT
Maximum number of GRFs that can be sent.
Definition: config.h:92
GRFIdentifier
Basic data to distinguish a GRF.
Definition: newgrf_config.h:83
Packet::Send_uint32
void Send_uint32(uint32_t data)
Package a 32 bits integer in the packet.
Definition: packet.cpp:125
Packet::Send_uint8
void Send_uint8(uint8_t data)
Package a 8 bits integer in the packet.
Definition: packet.cpp:104
GRFConfig
Information about GRF, used in the game and (part of it) in savegames.
Definition: newgrf_config.h:147
NetworkServerGameInfo::map_height
uint16_t map_height
Map height.
Definition: network_game_info.h:102
Packet::Recv_uint32
uint32_t Recv_uint32()
Read a 32 bits integer from the packet.
Definition: packet.cpp:321
GRFIdentifier::md5sum
MD5Hash md5sum
MD5 checksum of file to distinguish files with the same GRF ID (eg. newer version of GRF)
Definition: newgrf_config.h:85
TimerGameCalendar::ConvertYMDToDate
static Date ConvertYMDToDate(Year year, Month month, Day day)
Converts a tuple of Year, Month and Day to a Date.
Definition: timer_game_calendar.cpp:55
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:55
ScriptInfo::GetName
const std::string & GetName() const
Get the Name of the script.
Definition: script_info.hpp:46
GameCreationSettings::starting_year
TimerGameCalendar::Year starting_year
starting date
Definition: settings_type.h:341
NetworkServerGameInfo::companies_on
byte companies_on
How many started companies do we have.
Definition: network_game_info.h:109
NetworkServerGameInfo::companies_max
byte companies_max
Max companies allowed on server.
Definition: network_game_info.h:110
_network_dedicated
bool _network_dedicated
are we a dedicated server?
Definition: network.cpp:62
Packet
Internal entity of a packet.
Definition: packet.h:42
NETWORK_REVISION_LENGTH
static const uint NETWORK_REVISION_LENGTH
The maximum length of the revision, in bytes including '\0'.
Definition: config.h:58
Packet::Send_bool
void Send_bool(bool data)
Package a boolean in the packet.
Definition: packet.cpp:95
Map::SizeX
static debug_inline uint SizeX()
Get the size of the map along the X.
Definition: map_func.h:270
NetworkSettings::server_name
std::string server_name
name of the server
Definition: settings_type.h:314
GRFConfig::flags
uint8_t flags
NOSAVE: GCF_Flags, bitset.
Definition: newgrf_config.h:164
ScriptInfo::GetVersion
int GetVersion() const
Get the version of the script.
Definition: script_info.hpp:61
GRFConfig::name
GRFTextWrapper name
NOSAVE: GRF name (Action 0x08)
Definition: newgrf_config.h:157
Pool::PoolItem<&_company_pool >::GetNumItems
static size_t GetNumItems()
Returns number of valid items in the pool.
Definition: pool_type.hpp:365
Packet::Recv_bool
bool Recv_bool()
Read a boolean from the packet.
Definition: packet.cpp:283
NetworkServerGameInfo::dedicated
bool dedicated
Is this a dedicated server?
Definition: network_game_info.h:105
packet.h
NetworkServerGameInfo::use_password
bool use_password
Is this server passworded?
Definition: network_game_info.h:106
NETWORK_GRF_NAME_LENGTH
static const uint NETWORK_GRF_NAME_LENGTH
Maximum length of the name of a GRF.
Definition: config.h:75
GRFConfig::next
struct GRFConfig * next
NOSAVE: Next item in the linked list.
Definition: newgrf_config.h:174
NetworkServerGameInfo::calendar_date
TimerGameCalendar::Date calendar_date
Current calendar date.
Definition: network_game_info.h:99
NetworkSettings::max_clients
uint8_t max_clients
maximum amount of clients
Definition: settings_type.h:327
GetString
std::string GetString(StringID string)
Resolve the given StringID into a std::string with all the associated DParam lookups and formatting.
Definition: strings.cpp:327
NetworkSettings::server_password
std::string server_password
password for joining this server
Definition: settings_type.h:315
NetworkSettings::max_companies
uint8_t max_companies
maximum amount of companies
Definition: settings_type.h:326
NetworkServerGameInfo::map_width
uint16_t map_width
Map width.
Definition: network_game_info.h:101
GameInfo
All static information from an Game like name, version, etc.
Definition: game_info.hpp:16
GRFConfig::url
GRFTextWrapper url
NOSAVE: URL belonging to this GRF.
Definition: newgrf_config.h:159
NetworkServerGameInfo::spectators_on
byte spectators_on
How many spectators do we have?
Definition: network_game_info.h:111
_grfconfig
GRFConfig * _grfconfig
First item in list of current GRF set up.
Definition: newgrf_config.cpp:164
Packet::Send_string
void Send_string(const std::string_view data)
Sends a string over the network.
Definition: packet.cpp:156
ClientSettings::network
NetworkSettings network
settings related to the network
Definition: settings_type.h:637
GRFIdentifier::grfid
uint32_t grfid
GRF ID (defined by Action 0x08)
Definition: newgrf_config.h:84
TimerGameCalendar::date
static Date date
Current date in days (day counter).
Definition: timer_game_calendar.h:34
NetworkServerGameInfo::landscape
byte landscape
The used landscape.
Definition: network_game_info.h:112
Ticks::DAY_TICKS
static constexpr TimerGameTick::Ticks DAY_TICKS
1 day is 74 ticks; TimerGameCalendar::date_fract used to be uint16_t and incremented by 885.
Definition: timer_game_tick.h:48
NetworkServerGameInfo::server_name
std::string server_name
Server name.
Definition: network_game_info.h:103
FGCM_EXACT
@ FGCM_EXACT
Only find Grfs matching md5sum.
Definition: newgrf_config.h:192
Clamp
constexpr T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
Definition: math_func.hpp:79
Packet::Recv_uint16
uint16_t Recv_uint16()
Read a 16 bits integer from the packet.
Definition: packet.cpp:306
NETWORK_GAME_INFO_VERSION
static const byte NETWORK_GAME_INFO_VERSION
What version of game-info do we use?
Definition: config.h:49
NetworkServerGameInfo::clients_on
byte clients_on
Current count of clients on server.
Definition: network_game_info.h:107
FindGRFConfig
const GRFConfig * FindGRFConfig(uint32_t grfid, FindGRFConfigMode mode, const MD5Hash *md5sum, uint32_t desired_version)
Find a NewGRF in the scanned list.
Definition: newgrf_config.cpp:690
NetworkServerGameInfo::grfconfig
GRFConfig * grfconfig
List of NewGRF files used.
Definition: network_game_info.h:97
NetworkServerGameInfo::calendar_start
TimerGameCalendar::Date calendar_start
When the game started.
Definition: network_game_info.h:98
NamedGRFIdentifier
Container to hold the GRF identifier (GRF ID + MD5 checksum) and the name associated with that NewGRF...
Definition: network_game_info.h:130
NetworkGameInfo::compatible
bool compatible
Can we connect to this server or not? (based on server_revision and grf_match.
Definition: network_game_info.h:123
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:485
Packet::Send_uint16
void Send_uint16(uint16_t data)
Package a 16 bits integer in the packet.
Definition: packet.cpp:114
Packet::Recv_uint8
uint8_t Recv_uint8()
Read a 8 bits integer from the packet.
Definition: packet.cpp:292
GCF_STATIC
@ GCF_STATIC
GRF file is used statically (can be used in any MP game)
Definition: newgrf_config.h:25
Map::SizeY
static uint SizeY()
Get the size of the map along the Y.
Definition: map_func.h:279
GRFConfig::GetName
const char * GetName() const
Get the name of this grf.
Definition: newgrf_config.cpp:98
NetworkServerGameInfo::ticks_playing
TimerGameTick::TickCounter ticks_playing
Amount of ticks the game has been running unpaused.
Definition: network_game_info.h:100
HasBit
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
Definition: bitmath_func.hpp:103