(svn r21358) -Codechange: make some network function names conform to coding style

This commit is contained in:
rubidium 2010-11-30 13:38:46 +00:00
parent 9c83a8975f
commit b6c2216749
25 changed files with 141 additions and 141 deletions

View File

@ -627,7 +627,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
* send it to the command-queue and abort execution * send it to the command-queue and abort execution
*/ */
if (_networking && !(cmd & CMD_NETWORK_COMMAND)) { if (_networking && !(cmd & CMD_NETWORK_COMMAND)) {
NetworkSend_Command(tile, p1, p2, cmd & ~CMD_FLAGS_MASK, callback, text, _current_company); NetworkSendCommand(tile, p1, p2, cmd & ~CMD_FLAGS_MASK, callback, text, _current_company);
cur_company.Restore(); cur_company.Restore();
/* Don't return anything special here; no error, no costs. /* Don't return anything special here; no error, no costs.

View File

@ -53,7 +53,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
/** /**
* Send a command over the network * Send a command over the network
*/ */
void NetworkSend_Command(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, CompanyID company); void NetworkSendCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, CompanyID company);
#endif /* ENABLE_NETWORK */ #endif /* ENABLE_NETWORK */
extern Money _additional_cash_required; extern Money _additional_cash_required;

View File

@ -845,7 +845,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
* TODO: Perhaps this could be improved by when the client is ready * TODO: Perhaps this could be improved by when the client is ready
* with joining to let it send itself the command, and not the server? * with joining to let it send itself the command, and not the server?
* For example in network_client.c:534? */ * For example in network_client.c:534? */
NetworkSend_Command(0, 0, 0, CMD_RENAME_PRESIDENT, NULL, ci->client_name, ci->client_playas); NetworkSendCommand(0, 0, 0, CMD_RENAME_PRESIDENT, NULL, ci->client_name, ci->client_playas);
} }
/* Announce new company on network, if the client was a SPECTATOR before */ /* Announce new company on network, if the client was a SPECTATOR before */

View File

@ -103,7 +103,7 @@ void NetworkCoreShutdown()
* @param p the packet to write the data to * @param p the packet to write the data to
* @param grf the GRFIdentifier to serialize * @param grf the GRFIdentifier to serialize
*/ */
void NetworkSocketHandler::Send_GRFIdentifier(Packet *p, const GRFIdentifier *grf) void NetworkSocketHandler::SendGRFIdentifier(Packet *p, const GRFIdentifier *grf)
{ {
uint j; uint j;
p->Send_uint32(grf->grfid); p->Send_uint32(grf->grfid);
@ -117,7 +117,7 @@ void NetworkSocketHandler::Send_GRFIdentifier(Packet *p, const GRFIdentifier *gr
* @param p the packet to read the data from * @param p the packet to read the data from
* @param grf the GRFIdentifier to deserialize * @param grf the GRFIdentifier to deserialize
*/ */
void NetworkSocketHandler::Recv_GRFIdentifier(Packet *p, GRFIdentifier *grf) void NetworkSocketHandler::ReceiveGRFIdentifier(Packet *p, GRFIdentifier *grf)
{ {
uint j; uint j;
grf->grfid = p->Recv_uint32(); grf->grfid = p->Recv_uint32();

View File

@ -74,9 +74,9 @@ public:
*/ */
void Reopen() { this->has_quit = false; } void Reopen() { this->has_quit = false; }
void Send_GRFIdentifier(Packet *p, const GRFIdentifier *grf); void SendGRFIdentifier(Packet *p, const GRFIdentifier *grf);
void Recv_GRFIdentifier(Packet *p, GRFIdentifier *grf); void ReceiveGRFIdentifier(Packet *p, GRFIdentifier *grf);
void Send_CompanyInformation(Packet *p, const struct Company *c, const struct NetworkCompanyStats *stats); void SendCompanyInformation(Packet *p, const struct Company *c, const struct NetworkCompanyStats *stats);
}; };
#endif /* ENABLE_NETWORK */ #endif /* ENABLE_NETWORK */

View File

@ -56,7 +56,7 @@ NetworkRecvStatus NetworkTCPSocketHandler::CloseConnection(bool error)
* if the OS-network-buffer is full) * if the OS-network-buffer is full)
* @param packet the packet to send * @param packet the packet to send
*/ */
void NetworkTCPSocketHandler::Send_Packet(Packet *packet) void NetworkTCPSocketHandler::SendPacket(Packet *packet)
{ {
Packet *p; Packet *p;
assert(packet != NULL); assert(packet != NULL);
@ -90,7 +90,7 @@ void NetworkTCPSocketHandler::Send_Packet(Packet *packet)
* @return \c true if a (part of a) packet could be sent and * @return \c true if a (part of a) packet could be sent and
* the connection is not closed yet. * the connection is not closed yet.
*/ */
bool NetworkTCPSocketHandler::Send_Packets(bool closing_down) bool NetworkTCPSocketHandler::SendPackets(bool closing_down)
{ {
ssize_t res; ssize_t res;
Packet *p; Packet *p;
@ -141,7 +141,7 @@ bool NetworkTCPSocketHandler::Send_Packets(bool closing_down)
* @param status the variable to store the status into * @param status the variable to store the status into
* @return the received packet (or NULL when it didn't receive one) * @return the received packet (or NULL when it didn't receive one)
*/ */
Packet *NetworkTCPSocketHandler::Recv_Packet() Packet *NetworkTCPSocketHandler::ReceivePacket()
{ {
ssize_t res; ssize_t res;

View File

@ -35,11 +35,11 @@ public:
bool IsConnected() const { return this->sock != INVALID_SOCKET; } bool IsConnected() const { return this->sock != INVALID_SOCKET; }
virtual NetworkRecvStatus CloseConnection(bool error = true); virtual NetworkRecvStatus CloseConnection(bool error = true);
void Send_Packet(Packet *packet); void SendPacket(Packet *packet);
bool Send_Packets(bool closing_down = false); bool SendPackets(bool closing_down = false);
bool IsPacketQueueEmpty(); bool IsPacketQueueEmpty();
Packet *Recv_Packet(); Packet *ReceivePacket();
bool CanSendReceive(); bool CanSendReceive();

View File

@ -100,11 +100,11 @@ NetworkRecvStatus NetworkAdminSocketHandler::HandlePacket(Packet *p)
* HandlePacket is returned. * HandlePacket is returned.
* @return #NetworkRecvStatus of the last handled packet. * @return #NetworkRecvStatus of the last handled packet.
*/ */
NetworkRecvStatus NetworkAdminSocketHandler::Recv_Packets() NetworkRecvStatus NetworkAdminSocketHandler::ReceivePackets()
{ {
Packet *p; Packet *p;
while ((p = this->Recv_Packet()) != NULL) { while ((p = this->ReceivePacket()) != NULL) {
NetworkRecvStatus res = HandlePacket(p); NetworkRecvStatus res = this->HandlePacket(p);
if (res != NETWORK_RECV_STATUS_OKAY) return res; if (res != NETWORK_RECV_STATUS_OKAY) return res;
} }

View File

@ -347,10 +347,10 @@ public:
NetworkAdminSocketHandler(SOCKET s); NetworkAdminSocketHandler(SOCKET s);
~NetworkAdminSocketHandler(); ~NetworkAdminSocketHandler();
NetworkRecvStatus Recv_Packets(); NetworkRecvStatus ReceivePackets();
const char *Recv_Command(Packet *p, CommandPacket *cp); const char *ReceiveCommand(Packet *p, CommandPacket *cp);
void Send_Command(Packet *p, const CommandPacket *cp); void SendCommand(Packet *p, const CommandPacket *cp);
}; };
#endif /* ENABLE_NETWORK */ #endif /* ENABLE_NETWORK */

View File

@ -117,11 +117,11 @@ bool NetworkContentSocketHandler::HandlePacket(Packet *p)
/** /**
* Receive a packet at TCP level * Receive a packet at TCP level
*/ */
void NetworkContentSocketHandler::Recv_Packets() void NetworkContentSocketHandler::ReceivePackets()
{ {
Packet *p; Packet *p;
while ((p = this->Recv_Packet()) != NULL) { while ((p = this->ReceivePacket()) != NULL) {
bool cont = HandlePacket(p); bool cont = this->HandlePacket(p);
delete p; delete p;
if (!cont) return; if (!cont) return;
} }

View File

@ -210,7 +210,7 @@ public:
virtual ~NetworkContentSocketHandler() { this->Close(); } virtual ~NetworkContentSocketHandler() { this->Close(); }
/** Do the actual receiving of packets. */ /** Do the actual receiving of packets. */
void Recv_Packets(); void ReceivePackets();
}; };
#endif /* ENABLE_NETWORK */ #endif /* ENABLE_NETWORK */

View File

@ -34,7 +34,7 @@ NetworkGameSocketHandler::NetworkGameSocketHandler(SOCKET s)
} }
/** /**
* Functions to help NetworkRecv_Packet/NetworkSend_Packet a bit * Functions to help ReceivePacket/SendPacket a bit
* A socket can make errors. When that happens this handles what to do. * A socket can make errors. When that happens this handles what to do.
* For clients: close connection and drop back to main-menu * For clients: close connection and drop back to main-menu
* For servers: close connection and that is it * For servers: close connection and that is it
@ -136,10 +136,10 @@ NetworkRecvStatus NetworkGameSocketHandler::HandlePacket(Packet *p)
* HandlePacket is returned. * HandlePacket is returned.
* @return #NetworkRecvStatus of the last handled packet. * @return #NetworkRecvStatus of the last handled packet.
*/ */
NetworkRecvStatus NetworkGameSocketHandler::Recv_Packets() NetworkRecvStatus NetworkGameSocketHandler::ReceivePackets()
{ {
Packet *p; Packet *p;
while ((p = this->Recv_Packet()) != NULL) { while ((p = this->ReceivePacket()) != NULL) {
NetworkRecvStatus res = HandlePacket(p); NetworkRecvStatus res = HandlePacket(p);
delete p; delete p;
if (res != NETWORK_RECV_STATUS_OKAY) return res; if (res != NETWORK_RECV_STATUS_OKAY) return res;

View File

@ -482,10 +482,10 @@ public:
inline void SetInfo(NetworkClientInfo *info) { assert(info != NULL && this->info == NULL); this->info = info; } inline void SetInfo(NetworkClientInfo *info) { assert(info != NULL && this->info == NULL); this->info = info; }
inline NetworkClientInfo *GetInfo() const { return this->info; } inline NetworkClientInfo *GetInfo() const { return this->info; }
NetworkRecvStatus Recv_Packets(); NetworkRecvStatus ReceivePackets();
const char *Recv_Command(Packet *p, CommandPacket *cp); const char *ReceiveCommand(Packet *p, CommandPacket *cp);
void Send_Command(Packet *p, const CommandPacket *cp); void SendCommand(Packet *p, const CommandPacket *cp);
}; };
#endif /* ENABLE_NETWORK */ #endif /* ENABLE_NETWORK */

View File

@ -129,7 +129,7 @@ public:
FOR_ALL_ITEMS_FROM(Tsocket, idx, cs, 0) { FOR_ALL_ITEMS_FROM(Tsocket, idx, cs, 0) {
cs->writable = !!FD_ISSET(cs->sock, &write_fd); cs->writable = !!FD_ISSET(cs->sock, &write_fd);
if (FD_ISSET(cs->sock, &read_fd)) { if (FD_ISSET(cs->sock, &read_fd)) {
cs->Recv_Packets(); cs->ReceivePackets();
} }
} }
return _networking; return _networking;

View File

@ -151,7 +151,7 @@ void NetworkUDPSocketHandler::ReceivePackets()
* @param p the packet to write the data to * @param p the packet to write the data to
* @param info the NetworkGameInfo struct to serialize * @param info the NetworkGameInfo struct to serialize
*/ */
void NetworkUDPSocketHandler::Send_NetworkGameInfo(Packet *p, const NetworkGameInfo *info) void NetworkUDPSocketHandler::SendNetworkGameInfo(Packet *p, const NetworkGameInfo *info)
{ {
p->Send_uint8 (NETWORK_GAME_INFO_VERSION); p->Send_uint8 (NETWORK_GAME_INFO_VERSION);
@ -180,7 +180,7 @@ void NetworkUDPSocketHandler::Send_NetworkGameInfo(Packet *p, const NetworkGameI
/* Send actual GRF Identifications */ /* Send actual GRF Identifications */
for (c = info->grfconfig; c != NULL; c = c->next) { for (c = info->grfconfig; c != NULL; c = c->next) {
if (!HasBit(c->flags, GCF_STATIC)) this->Send_GRFIdentifier(p, &c->ident); if (!HasBit(c->flags, GCF_STATIC)) this->SendGRFIdentifier(p, &c->ident);
} }
} }
@ -213,7 +213,7 @@ void NetworkUDPSocketHandler::Send_NetworkGameInfo(Packet *p, const NetworkGameI
* @param p the packet to read the data from * @param p the packet to read the data from
* @param info the NetworkGameInfo to deserialize into * @param info the NetworkGameInfo to deserialize into
*/ */
void NetworkUDPSocketHandler::Recv_NetworkGameInfo(Packet *p, NetworkGameInfo *info) void NetworkUDPSocketHandler::ReceiveNetworkGameInfo(Packet *p, NetworkGameInfo *info)
{ {
static const Date MAX_DATE = ConvertYMDToDate(MAX_YEAR, 11, 31); // December is month 11 static const Date MAX_DATE = ConvertYMDToDate(MAX_YEAR, 11, 31); // December is month 11
@ -238,7 +238,7 @@ void NetworkUDPSocketHandler::Recv_NetworkGameInfo(Packet *p, NetworkGameInfo *i
for (i = 0; i < num_grfs; i++) { for (i = 0; i < num_grfs; i++) {
GRFConfig *c = new GRFConfig(); GRFConfig *c = new GRFConfig();
this->Recv_GRFIdentifier(p, &c->ident); this->ReceiveGRFIdentifier(p, &c->ident);
this->HandleIncomingNetworkGameInfoGRFConfig(c); this->HandleIncomingNetworkGameInfoGRFConfig(c);
/* Append GRFConfig to the list */ /* Append GRFConfig to the list */

View File

@ -153,8 +153,8 @@ public:
void SendPacket(Packet *p, NetworkAddress *recv, bool all = false, bool broadcast = false); void SendPacket(Packet *p, NetworkAddress *recv, bool all = false, bool broadcast = false);
void ReceivePackets(); void ReceivePackets();
void Send_NetworkGameInfo(Packet *p, const NetworkGameInfo *info); void SendNetworkGameInfo(Packet *p, const NetworkGameInfo *info);
void Recv_NetworkGameInfo(Packet *p, NetworkGameInfo *info); void ReceiveNetworkGameInfo(Packet *p, NetworkGameInfo *info);
}; };
#endif /* ENABLE_NETWORK */ #endif /* ENABLE_NETWORK */

View File

@ -698,13 +698,13 @@ void NetworkReboot()
NetworkClientSocket *cs; NetworkClientSocket *cs;
FOR_ALL_CLIENT_SOCKETS(cs) { FOR_ALL_CLIENT_SOCKETS(cs) {
cs->SendNewGame(); cs->SendNewGame();
cs->Send_Packets(); cs->SendPackets();
} }
ServerNetworkAdminSocketHandler *as; ServerNetworkAdminSocketHandler *as;
FOR_ALL_ADMIN_SOCKETS(as) { FOR_ALL_ADMIN_SOCKETS(as) {
as->SendNewGame(); as->SendNewGame();
as->Send_Packets(); as->SendPackets();
} }
} }
@ -724,14 +724,14 @@ void NetworkDisconnect(bool blocking, bool close_admins)
NetworkClientSocket *cs; NetworkClientSocket *cs;
FOR_ALL_CLIENT_SOCKETS(cs) { FOR_ALL_CLIENT_SOCKETS(cs) {
cs->SendShutdown(); cs->SendShutdown();
cs->Send_Packets(); cs->SendPackets();
} }
if (close_admins) { if (close_admins) {
ServerNetworkAdminSocketHandler *as; ServerNetworkAdminSocketHandler *as;
FOR_ALL_ADMIN_SOCKETS(as) { FOR_ALL_ADMIN_SOCKETS(as) {
as->SendShutdown(); as->SendShutdown();
as->Send_Packets(); as->SendPackets();
} }
} }
} }
@ -823,7 +823,7 @@ void NetworkGameLoop()
while (f != NULL && !feof(f)) { while (f != NULL && !feof(f)) {
if (_date == next_date && _date_fract == next_date_fract) { if (_date == next_date && _date_fract == next_date_fract) {
if (cp != NULL) { if (cp != NULL) {
NetworkSend_Command(cp->tile, cp->p1, cp->p2, cp->cmd & ~CMD_FLAGS_MASK, NULL, cp->text, cp->company); NetworkSendCommand(cp->tile, cp->p1, cp->p2, cp->cmd & ~CMD_FLAGS_MASK, NULL, cp->text, cp->company);
DEBUG(net, 0, "injecting: %08x; %02x; %02x; %06x; %08x; %08x; %08x; \"%s\" (%s)", _date, _date_fract, (int)_current_company, cp->tile, cp->p1, cp->p2, cp->cmd, cp->text, GetCommandName(cp->cmd)); DEBUG(net, 0, "injecting: %08x; %02x; %02x; %06x; %08x; %08x; %08x; \"%s\" (%s)", _date, _date_fract, (int)_current_company, cp->tile, cp->p1, cp->p2, cp->cmd, cp->text, GetCommandName(cp->cmd));
free(cp); free(cp);
cp = NULL; cp = NULL;

View File

@ -94,7 +94,7 @@ ServerNetworkAdminSocketHandler::~ServerNetworkAdminSocketHandler()
continue; continue;
} }
if (as->writable) { if (as->writable) {
as->Send_Packets(); as->SendPackets();
} }
} }
} }
@ -114,7 +114,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendError(NetworkErrorCode er
Packet *p = new Packet(ADMIN_PACKET_SERVER_ERROR); Packet *p = new Packet(ADMIN_PACKET_SERVER_ERROR);
p->Send_uint8(error); p->Send_uint8(error);
this->Send_Packet(p); this->SendPacket(p);
char str[100]; char str[100];
StringID strid = GetNetworkErrorMsg(error); StringID strid = GetNetworkErrorMsg(error);
@ -139,7 +139,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendProtocol()
} }
p->Send_bool(false); p->Send_bool(false);
this->Send_Packet(p); this->SendPacket(p);
return this->SendWelcome(); return this->SendWelcome();
} }
@ -161,7 +161,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendWelcome()
p->Send_uint16(MapSizeX()); p->Send_uint16(MapSizeX());
p->Send_uint16(MapSizeY()); p->Send_uint16(MapSizeY());
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -169,14 +169,14 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendWelcome()
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendNewGame() NetworkRecvStatus ServerNetworkAdminSocketHandler::SendNewGame()
{ {
Packet *p = new Packet(ADMIN_PACKET_SERVER_NEWGAME); Packet *p = new Packet(ADMIN_PACKET_SERVER_NEWGAME);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendShutdown() NetworkRecvStatus ServerNetworkAdminSocketHandler::SendShutdown()
{ {
Packet *p = new Packet(ADMIN_PACKET_SERVER_SHUTDOWN); Packet *p = new Packet(ADMIN_PACKET_SERVER_SHUTDOWN);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -185,7 +185,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendDate()
Packet *p = new Packet(ADMIN_PACKET_SERVER_DATE); Packet *p = new Packet(ADMIN_PACKET_SERVER_DATE);
p->Send_uint32(_date); p->Send_uint32(_date);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -195,7 +195,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientJoin(ClientID clien
Packet *p = new Packet(ADMIN_PACKET_SERVER_CLIENT_JOIN); Packet *p = new Packet(ADMIN_PACKET_SERVER_CLIENT_JOIN);
p->Send_uint32(client_id); p->Send_uint32(client_id);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -211,7 +211,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientInfo(const NetworkC
p->Send_uint32(ci->join_date); p->Send_uint32(ci->join_date);
p->Send_uint8 (ci->client_playas); p->Send_uint8 (ci->client_playas);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -224,7 +224,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientUpdate(const Networ
p->Send_string(ci->client_name); p->Send_string(ci->client_name);
p->Send_uint8 (ci->client_playas); p->Send_uint8 (ci->client_playas);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -234,7 +234,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientQuit(ClientID clien
Packet *p = new Packet(ADMIN_PACKET_SERVER_CLIENT_QUIT); Packet *p = new Packet(ADMIN_PACKET_SERVER_CLIENT_QUIT);
p->Send_uint32(client_id); p->Send_uint32(client_id);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -245,7 +245,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientError(ClientID clie
p->Send_uint32(client_id); p->Send_uint32(client_id);
p->Send_uint8 (error); p->Send_uint8 (error);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -255,7 +255,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyNew(CompanyID comp
Packet *p = new Packet(ADMIN_PACKET_SERVER_COMPANY_NEW); Packet *p = new Packet(ADMIN_PACKET_SERVER_COMPANY_NEW);
p->Send_uint8(company_id); p->Send_uint8(company_id);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -281,7 +281,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyInfo(const Company
p->Send_uint32(c->inaugurated_year); p->Send_uint32(c->inaugurated_year);
p->Send_bool (c->is_ai); p->Send_bool (c->is_ai);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -310,7 +310,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyUpdate(const Compa
p->Send_uint8(c->share_owners[i]); p->Send_uint8(c->share_owners[i]);
} }
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -322,7 +322,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyRemove(CompanyID c
p->Send_uint8(company_id); p->Send_uint8(company_id);
p->Send_uint8(acrr); p->Send_uint8(acrr);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -354,7 +354,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyEconomy()
p->Send_uint16(company->old_economy[i].delivered_cargo); p->Send_uint16(company->old_economy[i].delivered_cargo);
} }
this->Send_Packet(p); this->SendPacket(p);
} }
@ -384,7 +384,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyStats()
p->Send_uint16(company_stats->num_station[i]); p->Send_uint16(company_stats->num_station[i]);
} }
this->Send_Packet(p); this->SendPacket(p);
} }
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
@ -400,7 +400,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendChat(NetworkAction action
p->Send_string(msg); p->Send_string(msg);
p->Send_uint64(data); p->Send_uint64(data);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -410,7 +410,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendRcon(uint16 colour, const
p->Send_uint16(colour); p->Send_uint16(colour);
p->Send_string(result); p->Send_string(result);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -443,7 +443,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendConsole(const char *origi
p->Send_string(origin); p->Send_string(origin);
p->Send_string(string); p->Send_string(string);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }

View File

@ -62,9 +62,9 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::CloseConnection(NetworkRecvSta
{ {
assert(status != NETWORK_RECV_STATUS_OKAY); assert(status != NETWORK_RECV_STATUS_OKAY);
/* /*
* Sending a message just before leaving the game calls cs->Send_Packets. * Sending a message just before leaving the game calls cs->SendPackets.
* This might invoke this function, which means that when we close the * This might invoke this function, which means that when we close the
* connection after cs->Send_Packets we will close an already closed * connection after cs->SendPackets we will close an already closed
* connection. This handles that case gracefully without having to make * connection. This handles that case gracefully without having to make
* that code any more complex or more aware of the validity of the socket. * that code any more complex or more aware of the validity of the socket.
*/ */
@ -72,7 +72,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::CloseConnection(NetworkRecvSta
DEBUG(net, 1, "Closed client connection %d", this->client_id); DEBUG(net, 1, "Closed client connection %d", this->client_id);
this->Send_Packets(true); this->SendPackets(true);
delete this->GetInfo(); delete this->GetInfo();
delete this; delete this;
@ -127,7 +127,7 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res)
/*static */ bool ClientNetworkGameSocketHandler::Receive() /*static */ bool ClientNetworkGameSocketHandler::Receive()
{ {
if (my_client->CanSendReceive()) { if (my_client->CanSendReceive()) {
NetworkRecvStatus res = my_client->Recv_Packets(); NetworkRecvStatus res = my_client->ReceivePackets();
if (res != NETWORK_RECV_STATUS_OKAY) { if (res != NETWORK_RECV_STATUS_OKAY) {
/* The client made an error of which we can not recover /* The client made an error of which we can not recover
* close the client and drop back to main menu */ * close the client and drop back to main menu */
@ -141,7 +141,7 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res)
/** Send the packets of this socket handler. */ /** Send the packets of this socket handler. */
/*static */ void ClientNetworkGameSocketHandler::Send() /*static */ void ClientNetworkGameSocketHandler::Send()
{ {
my_client->Send_Packets(); my_client->SendPackets();
my_client->CheckConnection(); my_client->CheckConnection();
} }
@ -277,7 +277,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendCompanyInformationQuery()
SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0); SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0);
Packet *p = new Packet(PACKET_CLIENT_COMPANY_INFO); Packet *p = new Packet(PACKET_CLIENT_COMPANY_INFO);
my_client->Send_Packet(p); my_client->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -292,14 +292,14 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendJoin()
p->Send_string(_settings_client.network.client_name); // Client name p->Send_string(_settings_client.network.client_name); // Client name
p->Send_uint8 (_network_join_as); // PlayAs p->Send_uint8 (_network_join_as); // PlayAs
p->Send_uint8 (NETLANG_ANY); // Language p->Send_uint8 (NETLANG_ANY); // Language
my_client->Send_Packet(p); my_client->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
NetworkRecvStatus ClientNetworkGameSocketHandler::SendNewGRFsOk() NetworkRecvStatus ClientNetworkGameSocketHandler::SendNewGRFsOk()
{ {
Packet *p = new Packet(PACKET_CLIENT_NEWGRFS_CHECKED); Packet *p = new Packet(PACKET_CLIENT_NEWGRFS_CHECKED);
my_client->Send_Packet(p); my_client->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -307,7 +307,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendGamePassword(const char *p
{ {
Packet *p = new Packet(PACKET_CLIENT_GAME_PASSWORD); Packet *p = new Packet(PACKET_CLIENT_GAME_PASSWORD);
p->Send_string(password); p->Send_string(password);
my_client->Send_Packet(p); my_client->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -315,7 +315,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendCompanyPassword(const char
{ {
Packet *p = new Packet(PACKET_CLIENT_COMPANY_PASSWORD); Packet *p = new Packet(PACKET_CLIENT_COMPANY_PASSWORD);
p->Send_string(GenerateCompanyPasswordHash(password)); p->Send_string(GenerateCompanyPasswordHash(password));
my_client->Send_Packet(p); my_client->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -331,7 +331,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendGetMap()
* will have the lower bits set to 0. As such they would become * will have the lower bits set to 0. As such they would become
* incompatible, which we would like to prevent by this. */ * incompatible, which we would like to prevent by this. */
if (HasBit(_openttd_newgrf_version, 19)) p->Send_uint32(_openttd_newgrf_version); if (HasBit(_openttd_newgrf_version, 19)) p->Send_uint32(_openttd_newgrf_version);
my_client->Send_Packet(p); my_client->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -340,7 +340,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendMapOk()
my_client->status = STATUS_ACTIVE; my_client->status = STATUS_ACTIVE;
Packet *p = new Packet(PACKET_CLIENT_MAP_OK); Packet *p = new Packet(PACKET_CLIENT_MAP_OK);
my_client->Send_Packet(p); my_client->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -349,7 +349,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendAck()
Packet *p = new Packet(PACKET_CLIENT_ACK); Packet *p = new Packet(PACKET_CLIENT_ACK);
p->Send_uint32(_frame_counter); p->Send_uint32(_frame_counter);
my_client->Send_Packet(p); my_client->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -357,9 +357,9 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendAck()
NetworkRecvStatus ClientNetworkGameSocketHandler::SendCommand(const CommandPacket *cp) NetworkRecvStatus ClientNetworkGameSocketHandler::SendCommand(const CommandPacket *cp)
{ {
Packet *p = new Packet(PACKET_CLIENT_COMMAND); Packet *p = new Packet(PACKET_CLIENT_COMMAND);
my_client->Send_Command(p, cp); my_client->NetworkGameSocketHandler::SendCommand(p, cp);
my_client->Send_Packet(p); my_client->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -374,7 +374,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendChat(NetworkAction action,
p->Send_string(msg); p->Send_string(msg);
p->Send_uint64(data); p->Send_uint64(data);
my_client->Send_Packet(p); my_client->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -384,7 +384,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendError(NetworkErrorCode err
Packet *p = new Packet(PACKET_CLIENT_ERROR); Packet *p = new Packet(PACKET_CLIENT_ERROR);
p->Send_uint8(errorno); p->Send_uint8(errorno);
my_client->Send_Packet(p); my_client->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -393,7 +393,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendSetPassword(const char *pa
Packet *p = new Packet(PACKET_CLIENT_SET_PASSWORD); Packet *p = new Packet(PACKET_CLIENT_SET_PASSWORD);
p->Send_string(GenerateCompanyPasswordHash(password)); p->Send_string(GenerateCompanyPasswordHash(password));
my_client->Send_Packet(p); my_client->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -402,7 +402,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendSetName(const char *name)
Packet *p = new Packet(PACKET_CLIENT_SET_NAME); Packet *p = new Packet(PACKET_CLIENT_SET_NAME);
p->Send_string(name); p->Send_string(name);
my_client->Send_Packet(p); my_client->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -410,7 +410,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendQuit()
{ {
Packet *p = new Packet(PACKET_CLIENT_QUIT); Packet *p = new Packet(PACKET_CLIENT_QUIT);
my_client->Send_Packet(p); my_client->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -419,7 +419,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendRCon(const char *pass, con
Packet *p = new Packet(PACKET_CLIENT_RCON); Packet *p = new Packet(PACKET_CLIENT_RCON);
p->Send_string(pass); p->Send_string(pass);
p->Send_string(command); p->Send_string(command);
my_client->Send_Packet(p); my_client->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -428,7 +428,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendMove(CompanyID company, co
Packet *p = new Packet(PACKET_CLIENT_MOVE); Packet *p = new Packet(PACKET_CLIENT_MOVE);
p->Send_uint8(company); p->Send_uint8(company);
p->Send_string(GenerateCompanyPasswordHash(pass)); p->Send_string(GenerateCompanyPasswordHash(pass));
my_client->Send_Packet(p); my_client->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -597,7 +597,7 @@ DEF_GAME_RECEIVE_COMMAND(Client, PACKET_SERVER_CHECK_NEWGRFS)
/* Check all GRFs */ /* Check all GRFs */
for (; grf_count > 0; grf_count--) { for (; grf_count > 0; grf_count--) {
GRFIdentifier c; GRFIdentifier c;
this->Recv_GRFIdentifier(p, &c); this->ReceiveGRFIdentifier(p, &c);
/* Check whether we know this GRF */ /* Check whether we know this GRF */
const GRFConfig *f = FindGRFConfig(c.grfid, FGCM_EXACT, c.md5sum); const GRFConfig *f = FindGRFConfig(c.grfid, FGCM_EXACT, c.md5sum);
@ -779,7 +779,7 @@ DEF_GAME_RECEIVE_COMMAND(Client, PACKET_SERVER_MAP_DONE)
* the server will give us a client-id and let us in */ * the server will give us a client-id and let us in */
_network_join_status = NETWORK_JOIN_STATUS_REGISTERING; _network_join_status = NETWORK_JOIN_STATUS_REGISTERING;
ShowJoinStatusWindow(); ShowJoinStatusWindow();
NetworkSend_Command(0, 0, 0, CMD_COMPANY_CTRL, NULL, NULL, _local_company); NetworkSendCommand(0, 0, 0, CMD_COMPANY_CTRL, NULL, NULL, _local_company);
} }
} else { } else {
/* take control over an existing company */ /* take control over an existing company */
@ -837,7 +837,7 @@ DEF_GAME_RECEIVE_COMMAND(Client, PACKET_SERVER_COMMAND)
if (this->status != STATUS_ACTIVE) return NETWORK_RECV_STATUS_MALFORMED_PACKET; if (this->status != STATUS_ACTIVE) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
CommandPacket cp; CommandPacket cp;
const char *err = this->Recv_Command(p, &cp); const char *err = this->ReceiveCommand(p, &cp);
cp.frame = p->Recv_uint32(); cp.frame = p->Recv_uint32();
cp.my_cmd = p->Recv_bool(); cp.my_cmd = p->Recv_bool();

View File

@ -121,7 +121,7 @@ static CommandQueue _local_execution_queue;
* @param text The text to pass * @param text The text to pass
* @param company The company that wants to send the command * @param company The company that wants to send the command
*/ */
void NetworkSend_Command(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, CompanyID company) void NetworkSendCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, CompanyID company)
{ {
assert((cmd & CMD_FLAGS_MASK) == 0); assert((cmd & CMD_FLAGS_MASK) == 0);
@ -275,7 +275,7 @@ void NetworkDistributeCommands()
* @param cp the struct to write the data to. * @param cp the struct to write the data to.
* @return an error message. When NULL there has been no error. * @return an error message. When NULL there has been no error.
*/ */
const char *NetworkGameSocketHandler::Recv_Command(Packet *p, CommandPacket *cp) const char *NetworkGameSocketHandler::ReceiveCommand(Packet *p, CommandPacket *cp)
{ {
cp->company = (CompanyID)p->Recv_uint8(); cp->company = (CompanyID)p->Recv_uint8();
cp->cmd = p->Recv_uint32(); cp->cmd = p->Recv_uint32();
@ -300,7 +300,7 @@ const char *NetworkGameSocketHandler::Recv_Command(Packet *p, CommandPacket *cp)
* @param p the packet to send it in. * @param p the packet to send it in.
* @param cp the packet to actually send. * @param cp the packet to actually send.
*/ */
void NetworkGameSocketHandler::Send_Command(Packet *p, const CommandPacket *cp) void NetworkGameSocketHandler::SendCommand(Packet *p, const CommandPacket *cp)
{ {
p->Send_uint8 (cp->company); p->Send_uint8 (cp->company);
p->Send_uint32(cp->cmd); p->Send_uint32(cp->cmd);

View File

@ -185,7 +185,7 @@ void ClientNetworkContentSocketHandler::RequestContentList(ContentType type)
p->Send_uint8 ((byte)type); p->Send_uint8 ((byte)type);
p->Send_uint32(_openttd_newgrf_version); p->Send_uint32(_openttd_newgrf_version);
this->Send_Packet(p); this->SendPacket(p);
} }
void ClientNetworkContentSocketHandler::RequestContentList(uint count, const ContentID *content_ids) void ClientNetworkContentSocketHandler::RequestContentList(uint count, const ContentID *content_ids)
@ -207,7 +207,7 @@ void ClientNetworkContentSocketHandler::RequestContentList(uint count, const Con
p->Send_uint32(content_ids[i]); p->Send_uint32(content_ids[i]);
} }
this->Send_Packet(p); this->SendPacket(p);
count -= p_count; count -= p_count;
content_ids += p_count; content_ids += p_count;
} }
@ -237,7 +237,7 @@ void ClientNetworkContentSocketHandler::RequestContentList(ContentVector *cv, bo
} }
} }
this->Send_Packet(p); this->SendPacket(p);
for (ContentIterator iter = cv->Begin(); iter != cv->End(); iter++) { for (ContentIterator iter = cv->Begin(); iter != cv->End(); iter++) {
ContentInfo *ci = *iter; ContentInfo *ci = *iter;
@ -327,7 +327,7 @@ void ClientNetworkContentSocketHandler::DownloadSelectedContentFallback(const Co
p->Send_uint32(content_ids[i]); p->Send_uint32(content_ids[i]);
} }
this->Send_Packet(p); this->SendPacket(p);
count -= p_count; count -= p_count;
content_ids += p_count; content_ids += p_count;
} }
@ -736,11 +736,11 @@ void ClientNetworkContentSocketHandler::SendReceive()
} }
if (this->CanSendReceive()) { if (this->CanSendReceive()) {
this->Recv_Packets(); this->ReceivePackets();
this->lastActivity = _realtime_tick; this->lastActivity = _realtime_tick;
} }
this->Send_Packets(); this->SendPackets();
} }
/** /**

View File

@ -80,9 +80,9 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::CloseConnection(NetworkRecvSta
{ {
assert(status != NETWORK_RECV_STATUS_OKAY); assert(status != NETWORK_RECV_STATUS_OKAY);
/* /*
* Sending a message just before leaving the game calls cs->Send_Packets. * Sending a message just before leaving the game calls cs->SendPackets.
* This might invoke this function, which means that when we close the * This might invoke this function, which means that when we close the
* connection after cs->Send_Packets we will close an already closed * connection after cs->SendPackets we will close an already closed
* connection. This handles that case gracefully without having to make * connection. This handles that case gracefully without having to make
* that code any more complex or more aware of the validity of the socket. * that code any more complex or more aware of the validity of the socket.
*/ */
@ -114,7 +114,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::CloseConnection(NetworkRecvSta
SetWindowDirty(WC_CLIENT_LIST, 0); SetWindowDirty(WC_CLIENT_LIST, 0);
this->Send_Packets(true); this->SendPackets(true);
delete this->GetInfo(); delete this->GetInfo();
delete this; delete this;
@ -138,7 +138,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::CloseConnection(NetworkRecvSta
NetworkClientSocket *cs; NetworkClientSocket *cs;
FOR_ALL_CLIENT_SOCKETS(cs) { FOR_ALL_CLIENT_SOCKETS(cs) {
if (cs->writable) { if (cs->writable) {
if (cs->Send_Packets() && cs->status == STATUS_MAP) { if (cs->SendPackets() && cs->status == STATUS_MAP) {
/* This client is in the middle of a map-send, call the function for that */ /* This client is in the middle of a map-send, call the function for that */
cs->SendMap(); cs->SendMap();
} }
@ -161,7 +161,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendClientInfo(NetworkClientIn
p->Send_uint8 (ci->client_playas); p->Send_uint8 (ci->client_playas);
p->Send_string(ci->client_name); p->Send_string(ci->client_name);
this->Send_Packet(p); this->SendPacket(p);
} }
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -208,7 +208,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendCompanyInfo()
p->Send_uint8 (NETWORK_COMPANY_INFO_VERSION); p->Send_uint8 (NETWORK_COMPANY_INFO_VERSION);
p->Send_bool (true); p->Send_bool (true);
this->Send_CompanyInformation(p, company, &company_stats[company->index]); this->SendCompanyInformation(p, company, &company_stats[company->index]);
if (StrEmpty(clients[company->index])) { if (StrEmpty(clients[company->index])) {
p->Send_string("<none>"); p->Send_string("<none>");
@ -216,7 +216,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendCompanyInfo()
p->Send_string(clients[company->index]); p->Send_string(clients[company->index]);
} }
this->Send_Packet(p); this->SendPacket(p);
} }
p = new Packet(PACKET_SERVER_COMPANY_INFO); p = new Packet(PACKET_SERVER_COMPANY_INFO);
@ -224,7 +224,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendCompanyInfo()
p->Send_uint8 (NETWORK_COMPANY_INFO_VERSION); p->Send_uint8 (NETWORK_COMPANY_INFO_VERSION);
p->Send_bool (false); p->Send_bool (false);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -234,7 +234,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendError(NetworkErrorCode err
Packet *p = new Packet(PACKET_SERVER_ERROR); Packet *p = new Packet(PACKET_SERVER_ERROR);
p->Send_uint8(error); p->Send_uint8(error);
this->Send_Packet(p); this->SendPacket(p);
StringID strid = GetNetworkErrorMsg(error); StringID strid = GetNetworkErrorMsg(error);
GetString(str, strid, lastof(str)); GetString(str, strid, lastof(str));
@ -282,10 +282,10 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendNewGRFCheck()
p->Send_uint8 (grf_count); p->Send_uint8 (grf_count);
for (c = _grfconfig; c != NULL; c = c->next) { for (c = _grfconfig; c != NULL; c = c->next) {
if (!HasBit(c->flags, GCF_STATIC)) this->Send_GRFIdentifier(p, &c->ident); if (!HasBit(c->flags, GCF_STATIC)) this->SendGRFIdentifier(p, &c->ident);
} }
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -297,7 +297,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendNeedGamePassword()
this->status = STATUS_AUTH_GAME; this->status = STATUS_AUTH_GAME;
Packet *p = new Packet(PACKET_SERVER_NEED_GAME_PASSWORD); Packet *p = new Packet(PACKET_SERVER_NEED_GAME_PASSWORD);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -311,7 +311,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendNeedCompanyPassword()
Packet *p = new Packet(PACKET_SERVER_NEED_COMPANY_PASSWORD); Packet *p = new Packet(PACKET_SERVER_NEED_COMPANY_PASSWORD);
p->Send_uint32(_settings_game.game_creation.generation_seed); p->Send_uint32(_settings_game.game_creation.generation_seed);
p->Send_string(_settings_client.network.network_id); p->Send_string(_settings_client.network.network_id);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -330,7 +330,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendWelcome()
p->Send_uint32(this->client_id); p->Send_uint32(this->client_id);
p->Send_uint32(_settings_game.game_creation.generation_seed); p->Send_uint32(_settings_game.game_creation.generation_seed);
p->Send_string(_settings_client.network.network_id); p->Send_string(_settings_client.network.network_id);
this->Send_Packet(p); this->SendPacket(p);
/* Transmit info about all the active clients */ /* Transmit info about all the active clients */
FOR_ALL_CLIENT_SOCKETS(new_cs) { FOR_ALL_CLIENT_SOCKETS(new_cs) {
@ -355,7 +355,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendWait()
p = new Packet(PACKET_SERVER_WAIT); p = new Packet(PACKET_SERVER_WAIT);
p->Send_uint8(waiting); p->Send_uint8(waiting);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -390,7 +390,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendMap()
Packet *p = new Packet(PACKET_SERVER_MAP_BEGIN); Packet *p = new Packet(PACKET_SERVER_MAP_BEGIN);
p->Send_uint32(_frame_counter); p->Send_uint32(_frame_counter);
p->Send_uint32(ftell(file_pointer)); p->Send_uint32(ftell(file_pointer));
this->Send_Packet(p); this->SendPacket(p);
fseek(file_pointer, 0, SEEK_SET); fseek(file_pointer, 0, SEEK_SET);
@ -413,11 +413,11 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendMap()
if (ferror(file_pointer)) usererror("Error reading temporary network savegame!"); if (ferror(file_pointer)) usererror("Error reading temporary network savegame!");
p->size += res; p->size += res;
this->Send_Packet(p); this->SendPacket(p);
if (feof(file_pointer)) { if (feof(file_pointer)) {
/* Done reading! */ /* Done reading! */
Packet *p = new Packet(PACKET_SERVER_MAP_DONE); Packet *p = new Packet(PACKET_SERVER_MAP_DONE);
this->Send_Packet(p); this->SendPacket(p);
/* Set the status to DONE_MAP, no we will wait for the client /* Set the status to DONE_MAP, no we will wait for the client
* to send it is ready (maybe that happens like never ;)) */ * to send it is ready (maybe that happens like never ;)) */
@ -450,7 +450,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendMap()
} }
/* Send all packets (forced) and check if we have send it all */ /* Send all packets (forced) and check if we have send it all */
if (this->Send_Packets() && this->IsPacketQueueEmpty()) { if (this->SendPackets() && this->IsPacketQueueEmpty()) {
/* All are sent, increase the sent_packets */ /* All are sent, increase the sent_packets */
sent_packets *= 2; sent_packets *= 2;
} else { } else {
@ -467,7 +467,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendJoin(ClientID client_id)
p->Send_uint32(client_id); p->Send_uint32(client_id);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -483,7 +483,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendFrame()
p->Send_uint32(_sync_seed_2); p->Send_uint32(_sync_seed_2);
#endif #endif
#endif #endif
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -496,7 +496,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendSync()
#ifdef NETWORK_SEND_DOUBLE_SEED #ifdef NETWORK_SEND_DOUBLE_SEED
p->Send_uint32(_sync_seed_2); p->Send_uint32(_sync_seed_2);
#endif #endif
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -504,11 +504,11 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendCommand(const CommandPacke
{ {
Packet *p = new Packet(PACKET_SERVER_COMMAND); Packet *p = new Packet(PACKET_SERVER_COMMAND);
this->Send_Command(p, cp); this->NetworkGameSocketHandler::SendCommand(p, cp);
p->Send_uint32(cp->frame); p->Send_uint32(cp->frame);
p->Send_bool (cp->my_cmd); p->Send_bool (cp->my_cmd);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -522,7 +522,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendChat(NetworkAction action,
p->Send_string(msg); p->Send_string(msg);
p->Send_uint64(data); p->Send_uint64(data);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -533,7 +533,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendErrorQuit(ClientID client_
p->Send_uint32(client_id); p->Send_uint32(client_id);
p->Send_uint8 (errorno); p->Send_uint8 (errorno);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -543,21 +543,21 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendQuit(ClientID client_id)
p->Send_uint32(client_id); p->Send_uint32(client_id);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
NetworkRecvStatus ServerNetworkGameSocketHandler::SendShutdown() NetworkRecvStatus ServerNetworkGameSocketHandler::SendShutdown()
{ {
Packet *p = new Packet(PACKET_SERVER_SHUTDOWN); Packet *p = new Packet(PACKET_SERVER_SHUTDOWN);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
NetworkRecvStatus ServerNetworkGameSocketHandler::SendNewGame() NetworkRecvStatus ServerNetworkGameSocketHandler::SendNewGame()
{ {
Packet *p = new Packet(PACKET_SERVER_NEWGAME); Packet *p = new Packet(PACKET_SERVER_NEWGAME);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -567,7 +567,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendRConResult(uint16 colour,
p->Send_uint16(colour); p->Send_uint16(colour);
p->Send_string(command); p->Send_string(command);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -577,7 +577,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendMove(ClientID client_id, C
p->Send_uint32(client_id); p->Send_uint32(client_id);
p->Send_uint8(company_id); p->Send_uint8(company_id);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -586,7 +586,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendCompanyUpdate()
Packet *p = new Packet(PACKET_SERVER_COMPANY_UPDATE); Packet *p = new Packet(PACKET_SERVER_COMPANY_UPDATE);
p->Send_uint16(_network_company_passworded); p->Send_uint16(_network_company_passworded);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -596,7 +596,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendConfigUpdate()
p->Send_uint8(_settings_client.network.max_companies); p->Send_uint8(_settings_client.network.max_companies);
p->Send_uint8(_settings_client.network.max_spectators); p->Send_uint8(_settings_client.network.max_spectators);
this->Send_Packet(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
@ -854,7 +854,7 @@ DEF_GAME_RECEIVE_COMMAND(Server, PACKET_CLIENT_COMMAND)
} }
CommandPacket cp; CommandPacket cp;
const char *err = this->Recv_Command(p, &cp); const char *err = this->ReceiveCommand(p, &cp);
if (this->HasClientQuit()) return NETWORK_RECV_STATUS_CONN_LOST; if (this->HasClientQuit()) return NETWORK_RECV_STATUS_CONN_LOST;
@ -1239,7 +1239,7 @@ DEF_GAME_RECEIVE_COMMAND(Server, PACKET_CLIENT_MOVE)
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;
} }
void NetworkSocketHandler::Send_CompanyInformation(Packet *p, const Company *c, const NetworkCompanyStats *stats) void NetworkSocketHandler::SendCompanyInformation(Packet *p, const Company *c, const NetworkCompanyStats *stats)
{ {
/* Grab the company name */ /* Grab the company name */
char company_name[NETWORK_COMPANY_NAME_LENGTH]; char company_name[NETWORK_COMPANY_NAME_LENGTH];

View File

@ -115,7 +115,7 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_FIND_SERVER)
strecpy(ngi.server_revision, _openttd_revision, lastof(ngi.server_revision)); strecpy(ngi.server_revision, _openttd_revision, lastof(ngi.server_revision));
Packet packet(PACKET_UDP_SERVER_RESPONSE); Packet packet(PACKET_UDP_SERVER_RESPONSE);
this->Send_NetworkGameInfo(&packet, &ngi); this->SendNetworkGameInfo(&packet, &ngi);
/* Let the client know that we are here */ /* Let the client know that we are here */
this->SendPacket(&packet, client_addr); this->SendPacket(&packet, client_addr);
@ -142,7 +142,7 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_DETAIL_INFO)
/* Go through all the companies */ /* Go through all the companies */
FOR_ALL_COMPANIES(company) { FOR_ALL_COMPANIES(company) {
/* Send the information */ /* Send the information */
this->Send_CompanyInformation(&packet, company, &company_stats[company->index]); this->SendCompanyInformation(&packet, company, &company_stats[company->index]);
} }
this->SendPacket(&packet, client_addr); this->SendPacket(&packet, client_addr);
@ -179,7 +179,7 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_GET_NEWGRFS)
GRFIdentifier c; GRFIdentifier c;
const GRFConfig *f; const GRFConfig *f;
this->Recv_GRFIdentifier(p, &c); this->ReceiveGRFIdentifier(p, &c);
/* Find the matching GRF file */ /* Find the matching GRF file */
f = FindGRFConfig(c.grfid, FGCM_EXACT, c.md5sum); f = FindGRFConfig(c.grfid, FGCM_EXACT, c.md5sum);
@ -206,7 +206,7 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_GET_NEWGRFS)
/* The name could be an empty string, if so take the filename */ /* The name could be an empty string, if so take the filename */
strecpy(name, in_reply[i]->GetName(), lastof(name)); strecpy(name, in_reply[i]->GetName(), lastof(name));
this->Send_GRFIdentifier(&packet, &in_reply[i]->ident); this->SendGRFIdentifier(&packet, &in_reply[i]->ident);
packet.Send_string(name); packet.Send_string(name);
} }
@ -238,7 +238,7 @@ DEF_UDP_RECEIVE_COMMAND(Client, PACKET_UDP_SERVER_RESPONSE)
item = NetworkGameListAddItem(*client_addr); item = NetworkGameListAddItem(*client_addr);
ClearGRFConfigList(&item->info.grfconfig); ClearGRFConfigList(&item->info.grfconfig);
this->Recv_NetworkGameInfo(p, &item->info); this->ReceiveNetworkGameInfo(p, &item->info);
item->info.compatible = true; item->info.compatible = true;
{ {
@ -267,7 +267,7 @@ DEF_UDP_RECEIVE_COMMAND(Client, PACKET_UDP_SERVER_RESPONSE)
packet.Send_uint8(in_request_count); packet.Send_uint8(in_request_count);
for (i = 0; i < in_request_count; i++) { for (i = 0; i < in_request_count; i++) {
this->Send_GRFIdentifier(&packet, &in_request[i]->ident); this->SendGRFIdentifier(&packet, &in_request[i]->ident);
} }
this->SendPacket(&packet, &item->address); this->SendPacket(&packet, &item->address);
@ -342,7 +342,7 @@ DEF_UDP_RECEIVE_COMMAND(Client, PACKET_UDP_SERVER_NEWGRFS)
char name[NETWORK_GRF_NAME_LENGTH]; char name[NETWORK_GRF_NAME_LENGTH];
GRFIdentifier c; GRFIdentifier c;
this->Recv_GRFIdentifier(p, &c); this->ReceiveGRFIdentifier(p, &c);
p->Recv_string(name, sizeof(name)); p->Recv_string(name, sizeof(name));
/* An empty name is not possible under normal circumstances /* An empty name is not possible under normal circumstances

View File

@ -1770,7 +1770,7 @@ void SyncCompanySettings()
const void *new_var = GetVariableAddress(&_settings_client.company, &sd->save); const void *new_var = GetVariableAddress(&_settings_client.company, &sd->save);
uint32 old_value = (uint32)ReadValue(old_var, sd->save.conv); uint32 old_value = (uint32)ReadValue(old_var, sd->save.conv);
uint32 new_value = (uint32)ReadValue(new_var, sd->save.conv); uint32 new_value = (uint32)ReadValue(new_var, sd->save.conv);
if (old_value != new_value) NetworkSend_Command(0, i, new_value, CMD_CHANGE_COMPANY_SETTING, NULL, NULL, _local_company); if (old_value != new_value) NetworkSendCommand(0, i, new_value, CMD_CHANGE_COMPANY_SETTING, NULL, NULL, _local_company);
} }
} }
#endif /* ENABLE_NETWORK */ #endif /* ENABLE_NETWORK */

View File

@ -487,7 +487,7 @@ static void MenuClickCompany(int index)
if (_network_server) { if (_network_server) {
DoCommandP(0, 0, _network_own_client_id, CMD_COMPANY_CTRL); DoCommandP(0, 0, _network_own_client_id, CMD_COMPANY_CTRL);
} else { } else {
NetworkSend_Command(0, 0, 0, CMD_COMPANY_CTRL, NULL, NULL, _local_company); NetworkSendCommand(0, 0, 0, CMD_COMPANY_CTRL, NULL, NULL, _local_company);
} }
return; return;