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

OpenTTD Source 15.0-RC2

Functions | Variables
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 98 of file network.cpp.

## ◆ NetworkDrawChatMessage()

void NetworkDrawChatMessage | ( |  | ) |

Draw the chat message-box.

Definition at line 180 of file network_chat_gui.cpp.

References _chatmessage_backup, _chatmessage_dirty, _chatmessage_visible, _chatmsg_box, _chatmsg_list, ReusableBuffer< T >::Allocate(), Blitter::CopyToBuffer(), DrawStringMultiLine(), FILLRECT_RECOLOUR, FindWindowByClass(), FS_NORMAL, GetCharacterHeight(), BlitterFactory::GetCurrentBlitter(), VideoDriver::GetInstance(), GetString(), GetStringLineCount(), GfxFillRect(), HaveChatMessages(), ICONSOLE_FULL, VideoDriver::MakeDirty(), MAX_CHAT_MESSAGES, Blitter::MoveTo(), NETWORK_CHAT_LINE_SPACING, NetworkUndrawChatMessage(), PALETTE_TO_TRANSPARENT, SA_BOTTOM, SA_FORCE, SA_LEFT, ScaleGUITrad(), and WC_SEND_NETWORK_MSG.

Referenced by UpdateWindows().

## ◆ NetworkShutDown()

void NetworkShutDown | ( |  | ) |

This shuts the network down.

Definition at line 1303 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 1285 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 70 of file network.cpp.

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

## ◆ _network_available

bool _network_available
| extern

is network mode available?

Definition at line 68 of file network.cpp.

Referenced by HandleBootstrap(), NetworkAvailable(), NetworkClientConnectGame(), NetworkQueryServer(), NetworkShutDown(), NetworkStartUp(), AIConfigWindow::OnClick(), SaveLoadWindow::OnClick(), GSConfigWindow::OnClick(), SelectGameWindow::OnClick(), NewGRFWindow::OnClick(), GameOptionsWindow::OnInvalidateData(), AfterNewGRFScan::OnNewGRFsScanned(), and ShutdownGame().

## ◆ _network_dedicated

bool _network_dedicated
| extern

are we a dedicated server?

Definition at line 69 of file network.cpp.

Referenced by _GenerateWorld(), AfterLoadGame(), CheckMinActiveClients(), ConHookNeedNonDedicatedNetwork(), IConsolePrint(), VideoDriver_Dedicated::MainLoop(), NetworkAutoCleanCompanies(), NetworkOnGameStart(), NetworkServerDoMove(), NetworkStartUp(), AI::Pause(), ClientNetworkCoordinatorSocketHandler::Receive_GC_REGISTER_ACK(), SafeLoad(), ServerNetworkAdminSocketHandler::SendWelcome(), ShowEndGameChart(), SpecializedVehicle< T, Type >::UpdateViewport(), and UpdateWindows().

## ◆ _network_server

bool _network_server
| extern

network-server is active

Definition at line 67 of file network.cpp.

Referenced by AfterLoadGame(), AfterLoadLinkGraphs(), AI::BroadcastNewEvent(), AI::CanStartNew(), ChangeNetworkRestartTime(), NetworkGameSocketHandler::CloseConnection(), CmdCompanyCtrl(), CmdGoalQuestion(), CmdGoalQuestionAnswer(), CompanyAdminRemove(), CompanyAdminUpdate(), CompanyCheckBankrupt(), ConHookClientOnly(), ConHookNeedNetwork(), ConHookServerOnly(), ConHookServerOrNoNetwork(), ClientNetworkCoordinatorSocketHandler::ConnectSuccess(), DoStartupNewCompany(), AI::GameLoop(), Game::GameLoop(), GetSettingsDesc(), NetworkClientListWindow::GetWidgetString(), SettingDesc::IsEditable(), AIPLChunkHandler::Load(), GSDTChunkHandler::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(), ResetSettings(), OrderBackup::ResetUser(), SafeLoad(), SanitizeSingleStringHelper(), Game::Save(), BKORChunkHandler::Save(), AI::Save(), SendChat(), ClientNetworkCoordinatorSocketHandler::SendReceive(), SetSettingValue(), 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 66 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(), ConHookNeedNetwork(), ConHookNoNetwork(), ConHookServerOrNoNetwork(), DoStartupNewCompany(), AI::GameLoop(), Game::GameLoop(), GetSettingsDesc(), CommandHelperBase::InternalExecuteValidateTestAndPrepExec(), CommandHelperBase::InternalPostBefore(), SettingDesc::IsEditable(), AIPLChunkHandler::Load(), GSDTChunkHandler::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(), TCPListenHandler< Tsocket, Tfull_packet, Tban_packet >::Receive(), ClientNetworkGameSocketHandler::Receive(), RedrawScreenRect(), ReInitAllWindows(), OrderBackup::Reset(), ResetSettings(), Game::Save(), BKORChunkHandler::Save(), AI::Save(), SetSettingValue(), ShowEndGameChart(), ShowNewGrfVehicleError(), ShowScriptDebugWindow(), ShowScriptDebugWindowIfScriptError(), Game::StartNew(), AI::StartNew(), StateGameLoop(), AI::Stop(), SurveyConfiguration(), VideoDriver::Tick(), ToolbarFastForwardClick(), and ToolbarOptionsClick().