OpenTTD Source: src/network/network_gamelist.h Source File

OpenTTD Source 12.0-beta1

network_gamelist.h
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
10 #ifndef NETWORK_GAMELIST_H
11 #define NETWORK_GAMELIST_H
12
13 #include "core/address.h"
14 #include "core/game_info.h"
15 #include "network_type.h"
16
18 struct NetworkGameList {
19 NetworkGameList(const std::string &connection_string) : connection_string(connection_string) {}
20
21 NetworkGameInfo info = {};
22 std::string connection_string;
23 bool online = false;
24 bool manually = false;
25 uint8 retries = 0;
26 int version = 0;
27 NetworkGameList *next = nullptr;
28 };
29
30 extern NetworkGameList *_network_game_list;
31 extern int _network_game_list_version;
32
33 NetworkGameList *NetworkGameListAddItem(const std::string &connection_string);
34 void NetworkGameListRemoveItem(NetworkGameList *remove);
35 void NetworkGameListRemoveExpired();
36
37 #endif /* NETWORK_GAMELIST_H */
NetworkGameList::connection_string
std::string connection_string
Address of the server.
Definition: network_gamelist.h:22
NetworkGameInfo
The game information that is sent from the server to the clients with extra information only required...
Definition: game_info.h:117
_network_game_list_version
int _network_game_list_version
Current version of all items in the list.
Definition: network_gamelist.cpp:24
address.h
NetworkGameListRemoveItem
void NetworkGameListRemoveItem(NetworkGameList *remove)
Remove an item from the gamelist linked list.
Definition: network_gamelist.cpp:63
NetworkGameList::manually
bool manually
True if the server was added manually.
Definition: network_gamelist.h:24
NetworkGameList::version
int version
Used to see which servers are no longer available on the Game Coordinator and can be removed.
Definition: network_gamelist.h:26
_network_game_list
NetworkGameList * _network_game_list
Game list of this client.
Definition: network_gamelist.cpp:23
NetworkGameListAddItem
NetworkGameList * NetworkGameListAddItem(const std::string &connection_string)
Add a new item to the linked gamelist.
Definition: network_gamelist.cpp:32
NetworkGameList::retries
uint8 retries
Number of retries (to stop requerying)
Definition: network_gamelist.h:25
game_info.h
NetworkGameList
Structure with information shown in the game list (GUI)
Definition: network_gamelist.h:18
NetworkGameListRemoveExpired
void NetworkGameListRemoveExpired()
Remove all servers that have not recently been updated.
Definition: network_gamelist.cpp:91
NetworkGameList::next
NetworkGameList * next
Next pointer to make a linked game list.
Definition: network_gamelist.h:27
NetworkGameList::info
NetworkGameInfo info
The game information of this server.
Definition: network_gamelist.h:21
NetworkGameList::online
bool online
False if the server did not respond (default status)
Definition: network_gamelist.h:23
network_type.h