OpenTTD Source  20241108-master-g80f628063a
network_gamelist.h File Reference

Handling of the list of games. More...

#include "core/address.h"
#include "core/network_game_info.h"
#include "network_type.h"

Go to the source code of this file.

Data Structures

struct  NetworkGameList
 Structure with information shown in the game list (GUI) More...
 

Enumerations

enum  NetworkGameListStatus {
  NGLS_OFFLINE , NGLS_ONLINE , NGLS_FULL , NGLS_BANNED ,
  NGLS_TOO_OLD
}
 The status a server can be in. More...
 

Functions

NetworkGameListNetworkGameListAddItem (const std::string &connection_string)
 Add a new item to the linked gamelist. More...
 
void NetworkGameListRemoveItem (NetworkGameList *remove)
 Remove an item from the gamelist linked list. More...
 
void NetworkGameListRemoveExpired ()
 Remove all servers that have not recently been updated. More...
 

Variables

NetworkGameList_network_game_list
 Game list of this client.
 
int _network_game_list_version
 Current version of all items in the list.
 

Detailed Description

Handling of the list of games.

Definition in file network_gamelist.h.

Enumeration Type Documentation

◆ NetworkGameListStatus

The status a server can be in.

Enumerator
NGLS_OFFLINE 

Server is offline (or cannot be queried).

NGLS_ONLINE 

Server is online.

NGLS_FULL 

Server is full and cannot be queried.

NGLS_BANNED 

You are banned from this server.

NGLS_TOO_OLD 

Server is too old to query.

Definition at line 18 of file network_gamelist.h.

Function Documentation

◆ NetworkGameListAddItem()

◆ NetworkGameListRemoveExpired()

void NetworkGameListRemoveExpired ( )

Remove all servers that have not recently been updated.

Call this after you received all the servers from the Game Coordinator, so the ones that are no longer listed are removed.

Definition at line 92 of file network_gamelist.cpp.

References _network_game_list, _network_game_list_version, ClearGRFConfigList(), NetworkServerGameInfo::grfconfig, NetworkGameList::info, NetworkGameList::next, and UpdateNetworkGameWindow().

Referenced by ClientNetworkCoordinatorSocketHandler::Receive_GC_LISTING().

◆ NetworkGameListRemoveItem()

void NetworkGameListRemoveItem ( NetworkGameList remove)

Remove an item from the gamelist linked list.

Parameters
removepointer to the item to be removed

Definition at line 64 of file network_gamelist.cpp.

References _network_game_list, ClearGRFConfigList(), NetworkServerGameInfo::grfconfig, NetworkGameList::info, and NetworkGameList::next.