OpenTTD Source 20241224-master-gf74b0cf984
network.h File Reference

Basic functions/variables used all over the place. More...

Go to the source code of this file.

Functions

void NetworkStartUp ()
 This tries to launch the network for a given OS.
 
void NetworkShutDown ()
 This shuts the network down.
 
void NetworkDrawChatMessage ()
 Draw the chat message-box.
 
bool HasClients ()
 Return whether there is any client connected or trying to connect at all.
 

Variables

bool _networking
 are we in networking mode?
 
bool _network_server
 network-server is active
 
bool _network_available
 is network mode available?
 
bool _network_dedicated
 are we a dedicated server?
 
bool _is_network_server
 Does this client wants to be a network-server?
 

Detailed Description

Basic functions/variables used all over the place.

Definition in file network.h.

Function Documentation

◆ HasClients()

bool HasClients ( )

Return whether there is any client connected or trying to connect at all.

Returns
whether we have any client activity

Definition at line 97 of file network.cpp.

◆ NetworkDrawChatMessage()

◆ NetworkShutDown()

void NetworkShutDown ( )

This shuts the network down.

Definition at line 1301 of file network.cpp.

References _network_available, Debug, NetworkCoreShutdown(), NetworkDisconnect(), NetworkHTTPUninitialize(), and NetworkUDPClose().

Referenced by ShutdownGame().

◆ NetworkStartUp()

void NetworkStartUp ( )

This tries to launch the network for a given OS.

Definition at line 1283 of file network.cpp.

References _broadcast_list, _network_available, _network_dedicated, Debug, NetworkCoreInitialize(), NetworkFindBroadcastIPs(), NetworkHTTPInitialize(), and NetworkUDPInitialize().

Referenced by openttd_main().

Variable Documentation

◆ _is_network_server

bool _is_network_server
extern

Does this client wants to be a network-server?

Definition at line 69 of file network.cpp.

Referenced by VideoDriver_Dedicated::MainLoop(), SelectGameWindow::OnClick(), and NetworkStartServerWindow::OnClick().

◆ _network_available

◆ _network_dedicated

◆ _network_server

bool _network_server
extern

network-server is active

Definition at line 66 of file network.cpp.

Referenced by AfterLoadGame(), AfterLoadLinkGraphs(), AI::BroadcastNewEvent(), AI::CanStartNew(), ChangeNetworkRestartTime(), NetworkGameSocketHandler::CloseConnection(), CmdCompanyCtrl(), CmdGoalQuestion(), CmdGoalQuestionAnswer(), CompanyAdminRemove(), CompanyAdminUpdate(), CompanyCheckBankrupt(), ClientNetworkCoordinatorSocketHandler::ConnectSuccess(), DEF_CONSOLE_HOOK(), DEF_CONSOLE_HOOK(), DEF_CONSOLE_HOOK(), DEF_CONSOLE_HOOK(), DoStartupNewCompany(), AI::GameLoop(), Game::GameLoop(), GetSettingsDesc(), SettingDesc::IsEditable(), AIPLChunkHandler::Load(), GSDTChunkHandler::Load(), PATSChunkHandler::Load(), LoadSettings(), MenuClickCompany(), NetworkDisconnect(), NetworkMaxCompaniesAllowed(), NetworkOnGameStart(), NetworkPrintClients(), NetworkReceive(), NetworkSendCommand(), NetworkServerNewCompany(), NetworkServerUpdateGameInfo(), NetworkUpdateClientName(), Game::NewEvent(), AI::NewEvent(), CompanyWindow::OnClick(), NetworkClientListWindow::OnClick(), NetworkClientListWindow::OnClickCompanyJoin(), NetworkClientListWindow::OnDropdownSelect(), MainWindow::OnHotkey(), NetworkClientListWindow::OnInvalidateData(), BuildVehicleWindow::OnPaint(), NetworkClientListWindow::OnQueryTextFinished(), OnTick_LinkGraph(), NetworkClientListWindow::RebuildList(), NetworkClientListWindow::RebuildListCompany(), ClientNetworkCoordinatorSocketHandler::Receive_GC_TURN_CONNECT(), OrderBackup::Reset(), OrderBackup::ResetUser(), SafeLoad(), SanitizeSingleStringHelper(), Game::Save(), BKORChunkHandler::Save(), AI::Save(), SendChat(), ClientNetworkCoordinatorSocketHandler::SendReceive(), SetSettingValue(), NetworkClientListWindow::SetStringParameters(), ShowScriptDebugWindow(), ShowScriptDebugWindowIfScriptError(), Game::StartNew(), AI::StartNew(), StateGameLoop(), AI::Stop(), SurveyConfiguration(), ToolbarOptionsClick(), UpdateClientConfigValues(), and NetworkClientListWindow::UpdateWidgetSize().

◆ _networking

bool _networking
extern

are we in networking mode?

Definition at line 65 of file network.cpp.

Referenced by AfterLoadGame(), AfterLoadLinkGraphs(), AI::BroadcastNewEvent(), AI::CanStartNew(), ChangeOwnershipOfCompanyItems(), CheckTrainsLengths(), ClientNetworkGameSocketHandler::ClientError(), SaveLoadWindow::Close(), EndGameWindow::Close(), HighScoreWindow::Close(), NetworkGameSocketHandler::CloseConnection(), CmdBuyCompany(), CmdCompanyCtrl(), CmdGiveMoney(), CmdGoalQuestionAnswer(), CmdPause(), CompanyCheckBankrupt(), DEF_CONSOLE_HOOK(), DEF_CONSOLE_HOOK(), DEF_CONSOLE_HOOK(), DoStartupNewCompany(), AI::GameLoop(), Game::GameLoop(), GetSettingsDesc(), CommandHelperBase::InternalExecuteValidateTestAndPrepExec(), CommandHelperBase::InternalPostBefore(), SettingDesc::IsEditable(), AIPLChunkHandler::Load(), GSDTChunkHandler::Load(), PATSChunkHandler::Load(), LoadNewGRF(), LoadSettings(), MenuClickCompany(), MenuClickSettings(), NetworkHandlePauseChange(), NetworkUpdateServerGameType(), Game::NewEvent(), AI::NewEvent(), TCPClientConnecter::OnConnect(), MainWindow::OnHotkey(), MainToolbarWindow::OnHotkey(), BuildVehicleWindow::OnPaint(), CompanyWindow::OnPaint(), OnTick_Companies(), OnTick_LinkGraph(), OrdersWindow::OrderClick_Delete(), ParamSet(), PopupMainCompanyToolbMenu(), TCPListenHandler< Tsocket, Tfull_packet, Tban_packet >::Receive(), ClientNetworkGameSocketHandler::Receive(), RedrawScreenRect(), ReInitAllWindows(), OrderBackup::Reset(), Game::Save(), BKORChunkHandler::Save(), AI::Save(), SetSettingValue(), ShowEndGameChart(), ShowNewGrfVehicleError(), ShowScriptDebugWindow(), ShowScriptDebugWindowIfScriptError(), Game::StartNew(), AI::StartNew(), StateGameLoop(), AI::Stop(), SurveyConfiguration(), VideoDriver::Tick(), ToolbarFastForwardClick(), and ToolbarOptionsClick().