Files
@ r28025:9116d6e411b0
Branch filter:
Location: cpp/openttd-patchpack/source/src/network/network_func.h - annotation
r28025:9116d6e411b0
4.3 KiB
text/x-c
Codechange: replace x.size() == 0 with x.empty()
r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r10238:f2215d7dd22b r9428:6800206a6c0d r9428:6800206a6c0d r9428:6800206a6c0d r9428:6800206a6c0d r21282:5b76c1614957 r21282:5b76c1614957 r21282:5b76c1614957 r21282:5b76c1614957 r21282:5b76c1614957 r21656:d57ae4494337 r21282:5b76c1614957 r9428:6800206a6c0d r9428:6800206a6c0d r11082:09fb79759019 r13521:8a785d107381 r14248:a9050881acd7 r25289:7c44ede418ad r9428:6800206a6c0d r10459:3e3b1f14f8df r9428:6800206a6c0d r10454:ba5e39738ffa r10454:ba5e39738ffa r27737:728d55b97775 r11629:97018c71b598 r11560:52827dc8eb76 r11560:52827dc8eb76 r9428:6800206a6c0d r9428:6800206a6c0d r25464:b2a279799858 r25726:96b4fe65dab7 r25464:b2a279799858 r25551:26df1bec7e96 r25549:fb65768b27a1 r25817:3f5c3838fe0a r10207:a1fc2f2a33db r25478:0c7266566a47 r9428:6800206a6c0d r27944:a5c70dad53db r9428:6800206a6c0d r18892:ba984148392c r27737:728d55b97775 r25308:af5928950609 r10457:8667446e8fd4 r9428:6800206a6c0d r10454:ba5e39738ffa r15025:2d23afc43d78 r25478:0c7266566a47 r25347:06f82554f1b8 r25475:0426c207464e r25570:d402b1c974e3 r27737:728d55b97775 r10460:5fba179e6ffa r10907:3616576a3216 r26940:92b381a46f34 r10907:3616576a3216 r10461:3494bf73458c r13521:8a785d107381 r9428:6800206a6c0d r9428:6800206a6c0d r10907:3616576a3216 r25386:b146841c350c r9428:6800206a6c0d r9428:6800206a6c0d r21467:8b87202cc00f r25567:8040ceacb29a r9428:6800206a6c0d r9428:6800206a6c0d r10907:3616576a3216 r25568:66d9ae4f04a1 r27737:728d55b97775 r25978:1911877bcb73 r9428:6800206a6c0d r25569:ae23e84953e3 r25569:ae23e84953e3 r25569:ae23e84953e3 r11274:6d4814f2e94b r9898:bbef3303e005 r26832:a6bd9039c80b r25400:69a72bf5e010 r9898:bbef3303e005 r9898:bbef3303e005 r13054:319ef5c8a6c7 r13054:319ef5c8a6c7 r9428:6800206a6c0d | /*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file network_func.h Network functions used by other parts of OpenTTD. */
#ifndef NETWORK_FUNC_H
#define NETWORK_FUNC_H
/**
* Uncomment the following define to enable command replaying.
* See docs/desync.txt for details.
*/
// #define DEBUG_DUMP_COMMANDS
// #define DEBUG_FAILED_DUMP_COMMANDS
#include "network_type.h"
#include "../console_type.h"
#include "../gfx_type.h"
#include "../openttd.h"
#include "../company_type.h"
#include "../string_type.h"
extern NetworkCompanyState *_network_company_states;
extern ClientID _network_own_client_id;
extern ClientID _redirect_console_to_client;
extern uint8_t _network_reconnect;
extern StringList _network_bind_list;
extern StringList _network_host_list;
extern StringList _network_ban_list;
byte NetworkSpectatorCount();
bool NetworkIsValidClientName(const std::string_view client_name);
bool NetworkValidateOurClientName();
bool NetworkValidateClientName(std::string &client_name);
bool NetworkValidateServerName(std::string &server_name);
void NetworkUpdateClientName(const std::string &client_name);
void NetworkUpdateServerGameType();
bool NetworkCompanyHasClients(CompanyID company);
std::string NetworkChangeCompanyPassword(CompanyID company_id, std::string password);
void NetworkReboot();
void NetworkDisconnect(bool close_admins = true);
void NetworkGameLoop();
void NetworkBackgroundLoop();
std::string_view ParseFullConnectionString(const std::string &connection_string, uint16_t &port, CompanyID *company_id = nullptr);
void NetworkStartDebugLog(const std::string &connection_string);
void NetworkPopulateCompanyStats(NetworkCompanyStats *stats);
void NetworkUpdateClientInfo(ClientID client_id);
void NetworkClientsToSpectators(CompanyID cid);
bool NetworkClientConnectGame(const std::string &connection_string, CompanyID default_company, const std::string &join_server_password = "", const std::string &join_company_password = "");
void NetworkClientJoinGame();
void NetworkClientRequestMove(CompanyID company, const std::string &pass = "");
void NetworkClientSendRcon(const std::string &password, const std::string &command);
void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const std::string &msg, int64_t data = 0);
bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio);
bool NetworkCompanyIsPassworded(CompanyID company_id);
uint NetworkMaxCompaniesAllowed();
bool NetworkMaxCompaniesReached();
void NetworkPrintClients();
void NetworkHandlePauseChange(PauseMode prev_mode, PauseMode changed_mode);
/*** Commands ran by the server ***/
void NetworkServerSendConfigUpdate();
void NetworkServerUpdateGameInfo();
void NetworkServerShowStatusToConsole();
bool NetworkServerStart();
void NetworkServerNewCompany(const Company *company, NetworkClientInfo *ci);
bool NetworkServerChangeClientName(ClientID client_id, const std::string &new_name);
void NetworkServerDoMove(ClientID client_id, CompanyID company_id);
void NetworkServerSendRcon(ClientID client_id, TextColour colour_code, const std::string &string);
void NetworkServerSendChat(NetworkAction action, DestType type, int dest, const std::string &msg, ClientID from_id, int64_t data = 0, bool from_admin = false);
void NetworkServerSendExternalChat(const std::string &source, TextColour colour, const std::string &user, const std::string &msg);
void NetworkServerKickClient(ClientID client_id, const std::string &reason);
uint NetworkServerKickOrBanIP(ClientID client_id, bool ban, const std::string &reason);
uint NetworkServerKickOrBanIP(const std::string &ip, bool ban, const std::string &reason);
void NetworkInitChatMessage();
void NetworkReInitChatBoxSize();
void CDECL NetworkAddChatMessage(TextColour colour, uint duration, const std::string &message);
void NetworkUndrawChatMessage();
void NetworkAfterNewGRFScan();
#endif /* NETWORK_FUNC_H */
|