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

OpenTTD Source 14.0-RC3

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/network_game_info.h"
15 #include "network_type.h"
16
18 enum NetworkGameListStatus {
19 NGLS_OFFLINE,
20 NGLS_ONLINE,
21 NGLS_FULL,
22 NGLS_BANNED,
23 NGLS_TOO_OLD,
24 };
25
27 struct NetworkGameList {
28 NetworkGameList(const std::string &connection_string) : connection_string(connection_string) {}
29
30 NetworkGameInfo info = {};
31 std::string connection_string;
32 NetworkGameListStatus status = NGLS_OFFLINE;
33 bool manually = false;
34 bool refreshing = false;
35 int version = 0;
36 NetworkGameList *next = nullptr;
37 };
38
39 extern NetworkGameList *_network_game_list;
40 extern int _network_game_list_version;
41
42 NetworkGameList *NetworkGameListAddItem(const std::string &connection_string);
43 void NetworkGameListRemoveItem(NetworkGameList *remove);
44 void NetworkGameListRemoveExpired();
45
46 #endif /* NETWORK_GAMELIST_H */
NetworkGameList::connection_string
std::string connection_string
Address of the server.
Definition: network_gamelist.h:31
NetworkGameInfo
The game information that is sent from the server to the clients with extra information only required...
Definition: network_game_info.h:121
_network_game_list_version
int _network_game_list_version
Current version of all items in the list.
Definition: network_gamelist.cpp:24
NGLS_TOO_OLD
@ NGLS_TOO_OLD
Server is too old to query.
Definition: network_gamelist.h:23
address.h
NetworkGameListRemoveItem
void NetworkGameListRemoveItem(NetworkGameList *remove)
Remove an item from the gamelist linked list.
Definition: network_gamelist.cpp:64
NetworkGameListStatus
NetworkGameListStatus
The status a server can be in.
Definition: network_gamelist.h:18
NetworkGameList::manually
bool manually
True if the server was added manually.
Definition: network_gamelist.h:33
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:35
_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
NGLS_BANNED
@ NGLS_BANNED
You are banned from this server.
Definition: network_gamelist.h:22
NGLS_ONLINE
@ NGLS_ONLINE
Server is online.
Definition: network_gamelist.h:20
NetworkGameList
Structure with information shown in the game list (GUI)
Definition: network_gamelist.h:27
NGLS_OFFLINE
@ NGLS_OFFLINE
Server is offline (or cannot be queried).
Definition: network_gamelist.h:19
NetworkGameListRemoveExpired
void NetworkGameListRemoveExpired()
Remove all servers that have not recently been updated.
Definition: network_gamelist.cpp:92
NetworkGameList::next
NetworkGameList * next
Next pointer to make a linked game list.
Definition: network_gamelist.h:36
NetworkGameList::refreshing
bool refreshing
Whether this server is being queried.
Definition: network_gamelist.h:34
NetworkGameList::info
NetworkGameInfo info
The game information of this server.
Definition: network_gamelist.h:30
NGLS_FULL
@ NGLS_FULL
Server is full and cannot be queried.
Definition: network_gamelist.h:21
network_type.h
NetworkGameList::status
NetworkGameListStatus status
Stats of the server.
Definition: network_gamelist.h:32