OpenTTD Source 20241224-master-gf74b0cf984
|
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 | |
NetworkGameList * | NetworkGameListAddItem (const std::string &connection_string) |
Add a new item to the linked gamelist. | |
void | NetworkGameListRemoveItem (NetworkGameList *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 | |
NetworkGameList * | _network_game_list = nullptr |
Game list of this client. | |
int | _network_game_list_version = 0 |
Current version of all items in the list. | |
This file handles the GameList Also, it handles the request to a server for data about the server.
Definition in file network_gamelist.cpp.
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 118 of file network_gamelist.cpp.
References _network_game_list, FGCM_EXACT, GRFConfig::filename, FindGRFConfig(), GCF_COPY, GCS_NOT_FOUND, GCS_UNKNOWN, HasBit(), GRFConfig::info, InvalidateWindowClassesData(), GRFConfig::name, NetworkGameList::next, and WC_NETWORK_WINDOW.
Referenced by DoScanNewGRFFiles().
NetworkGameList * NetworkGameListAddItem | ( | const std::string & | connection_string | ) |
Add a new item to the linked gamelist.
If the IP and Port match return the existing item instead of adding it again
connection_string | the address of the to-be added item |
Definition at line 32 of file network_gamelist.cpp.
References _network_game_list, _network_game_list_version, ServerAddress::connection_string, NetworkGameList::connection_string, NetworkServerGameInfo::gamescript_version, NetworkGameList::info, NETWORK_DEFAULT_PORT, NetworkGameList::next, ServerAddress::Parse(), UpdateNetworkGameWindow(), and NetworkGameList::version.
Referenced by QueryNetworkGameSocketHandler::CloseConnection(), NetworkAddServer(), NetworkQueryServer(), TCPQueryConnecter::OnFailure(), ClientNetworkCoordinatorSocketHandler::Receive_GC_ERROR(), ClientNetworkCoordinatorSocketHandler::Receive_GC_LISTING(), QueryNetworkGameSocketHandler::Receive_SERVER_BANNED(), QueryNetworkGameSocketHandler::Receive_SERVER_ERROR(), QueryNetworkGameSocketHandler::Receive_SERVER_FULL(), and QueryNetworkGameSocketHandler::Receive_SERVER_GAME_INFO().
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().
void NetworkGameListRemoveItem | ( | NetworkGameList * | remove | ) |
Remove an item from the gamelist linked list.
remove | pointer to the item to be removed |
Definition at line 64 of file network_gamelist.cpp.
References _network_game_list, ClearGRFConfigList(), NetworkServerGameInfo::grfconfig, NetworkGameList::info, NetworkGameList::next, and UpdateNetworkGameWindow().
Referenced by NetworkGameWindow::OnKeyPress().
NetworkGameList* _network_game_list = nullptr |
Game list of this client.
Definition at line 23 of file network_gamelist.cpp.
Referenced by NetworkGameWindow::BuildGUINetworkGameList(), NetworkAfterNewGRFScan(), NetworkGameListAddItem(), NetworkGameListRemoveExpired(), and NetworkGameListRemoveItem().
int _network_game_list_version = 0 |
Current version of all items in the list.
Definition at line 24 of file network_gamelist.cpp.
Referenced by ClientNetworkCoordinatorSocketHandler::GetListing(), NetworkGameListAddItem(), NetworkGameListRemoveExpired(), and ClientNetworkCoordinatorSocketHandler::Receive_GC_LISTING().