OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
13 #include "../stdafx.h"
15 #include "../window_func.h"
21 #include "../safeguards.h"
45 if (ins_item ==
nullptr)
break;
49 if (item !=
nullptr) {
52 memset(&item->
info, 0,
sizeof(item->
info));
58 if (item->
manually) NetworkRebuildHostList();
77 strcmp(hostname,
"0.0.0.0") == 0 ||
78 strcmp(hostname,
"::") == 0) {
86 if (item->
address == address)
return item;
90 item = CallocT<NetworkGameList>(1);
94 if (prev_item ==
nullptr) {
97 prev_item->
next = item;
99 DEBUG(net, 4,
"[gamelist] added server to list");
114 if (remove == item) {
115 if (prev_item ==
nullptr) {
126 DEBUG(net, 4,
"[gamelist] removed server from list");
127 NetworkRebuildHostList();
144 static uint8 requery_cnt = 0;
154 uint8 retries = item->retries;
168 item->info.compatible = item->info.version_compatible;
170 for (
GRFConfig *c = item->
info.grfconfig; c !=
nullptr; c = c->next) {
182 item->info.compatible =
false;
GRFTextWrapper info
NOSAVE: GRF info (author, copyright, ...) (Action 0x08)
static void NetworkGameListHandleDelayedInsert()
Perform the delayed (thread safe) insertion into the game list.
const GRFConfig * FindGRFConfig(uint32 grfid, FindGRFConfigMode mode, const uint8 *md5sum, uint32 desired_version)
Find a NewGRF in the scanned list.
void ClearGRFConfigList(GRFConfig **config)
Clear a GRF Config list, freeing all nodes.
NetworkGameList * NetworkGameListAddItem(NetworkAddress address)
Add a new item to the linked gamelist.
static const uint REFRESH_GAMEINFO_X_REQUERIES
Refresh the game info itself after REFRESH_GAMEINFO_X_REQUERIES * REQUERY_EVERY_X_GAMELOOPS game loop...
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
char hostname[NETWORK_HOSTNAME_LENGTH]
Hostname of the server (if any)
@ GCS_NOT_FOUND
GRF file was not found in the local cache.
@ GCF_COPY
The data is copied from a grf in _all_grfs.
void UpdateNetworkGameWindow()
Update the network new window because a new server is found on the network.
NetworkAddress address
The connection info of the game server.
void NetworkAfterNewGRFScan()
Rebuild the GRFConfig's of the servers in the game list as we did a rescan and might have found new N...
NetworkGameList * _network_game_list
Game list of this client.
void NetworkUDPQueryServer(NetworkAddress address, bool manually)
Query a specific server.
Information about GRF, used in the game and (part of it) in savegames.
#define DEBUG(name, level,...)
Output a line of debugging information.
const char * GetHostname()
Get the hostname; in case it wasn't given the IPv4 dotted representation is given.
bool manually
True if the server was added manually.
static const uint REQUERY_EVERY_X_GAMELOOPS
How often do we requery in time?
static bool StrEmpty(const char *s)
Check if a string buffer is empty.
char server_name[NETWORK_NAME_LENGTH]
Server name.
@ GCS_UNKNOWN
The status of this grf file is unknown.
Wrapper for (un)resolved network addresses; there's no reason to transform a numeric IP to a string a...
GRFTextWrapper name
NOSAVE: GRF name (Action 0x08)
@ WC_NETWORK_WINDOW
Network window; Window numbers:
void InvalidateWindowClassesData(WindowClass cls, int data, bool gui_scope)
Mark window data of all windows of a given class as invalid (in need of re-computing) Note that by de...
Structure with information shown in the game list (GUI)
void NetworkGameListRequery()
Requeries the (game) servers we have not gotten a reply from.
NetworkGameList * next
Next pointer to make a linked game list.
static const uint MAX_GAME_LIST_REQUERY_COUNT
How often do we requery in number of times per server?
@ FGCM_EXACT
Only find Grfs matching md5sum.
char * filename
Filename - either with or without full path.
NetworkGameInfo info
The game information of this server.
GRFTextWrapper FindUnknownGRFName(uint32 grfid, uint8 *md5sum, bool create)
Finds the name of a NewGRF in the list of names for unknown GRFs.
char * strecpy(char *dst, const char *src, const char *last)
Copies characters from one buffer to another.
static void free(const void *ptr)
Version of the standard free that accepts const pointers.
GRFConfig * grfconfig
List of NewGRF files used.
static std::atomic< NetworkGameList * > _network_game_delayed_insertion_list(nullptr)
The games to insert when the GUI thread has time for us.
void NetworkGameListRemoveItem(NetworkGameList *remove)
Remove an item from the gamelist linked list.
bool online
False if the server did not respond (default status)
#define lastof(x)
Get the last element of an fixed size array.
void NetworkGameListAddItemDelayed(NetworkGameList *item)
Add a new item to the linked gamelist, but do it delayed in the next tick or so to prevent race condi...