OpenTTD Source 20250505-master-ga46b885640
network_gamelist.cpp File Reference

This file handles the GameList Also, it handles the request to a server for data about the server. More...

#include "../stdafx.h"
#include "../debug.h"
#include "../window_func.h"
#include "network_internal.h"
#include "network_udp.h"
#include "network_gamelist.h"
#include <atomic>
#include "../safeguards.h"

Go to the source code of this file.

Functions

NetworkGameNetworkGameListAddItem (std::string_view connection_string)
 Add a new item to the linked gamelist.
 
void NetworkGameListRemoveItem (NetworkGame *remove)
 Remove an item from the gamelist linked list.
 
void NetworkGameListRemoveExpired ()
 Remove all servers that have not recently been updated.
 
void NetworkAfterNewGRFScan ()
 Rebuild the GRFConfig's of the servers in the game list as we did a rescan and might have found new NewGRFs.
 

Variables

std::vector< std::unique_ptr< NetworkGame > > _network_game_list
 Game list of this client.
 
int _network_game_list_version = 0
 Current version of all items in the list.
 

Detailed Description

This file handles the GameList Also, it handles the request to a server for data about the server.

Definition in file network_gamelist.cpp.

Function Documentation

◆ NetworkAfterNewGRFScan()

void NetworkAfterNewGRFScan ( )

Rebuild the GRFConfig's of the servers in the game list as we did a rescan and might have found new NewGRFs.

Definition at line 82 of file network_gamelist.cpp.

References _network_game_list, Copy, FGCM_EXACT, GRFConfig::filename, FindGRFConfig(), GCS_NOT_FOUND, GCS_UNKNOWN, GRFConfig::info, InvalidateWindowClassesData(), GRFConfig::name, and WC_NETWORK_WINDOW.

Referenced by DoScanNewGRFFiles().

◆ 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 70 of file network_gamelist.cpp.

References _network_game_list, _network_game_list_version, and UpdateNetworkGameWindow().

Referenced by ClientNetworkCoordinatorSocketHandler::Receive_GC_LISTING().

◆ NetworkGameListRemoveItem()

void NetworkGameListRemoveItem ( NetworkGame remove)

Remove an item from the gamelist linked list.

Parameters
removepointer to the item to be removed

Definition at line 54 of file network_gamelist.cpp.

References _network_game_list, and UpdateNetworkGameWindow().

Referenced by NetworkGameWindow::OnKeyPress().

Variable Documentation

◆ _network_game_list

std::vector<std::unique_ptr<NetworkGame> > _network_game_list

◆ _network_game_list_version

int _network_game_list_version = 0