Codechange: use references for handling received TCP packets
This commit is contained in:
@@ -125,14 +125,14 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_ADMIN_JOIN(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_ADMIN_JOIN(Packet &p);
|
||||
|
||||
/**
|
||||
* Notification to the server that this admin is quitting.
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_ADMIN_QUIT(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_ADMIN_QUIT(Packet &p);
|
||||
|
||||
/**
|
||||
* Register updates to be sent at certain frequencies (as announced in the PROTOCOL packet):
|
||||
@@ -141,7 +141,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_ADMIN_UPDATE_FREQUENCY(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_ADMIN_UPDATE_FREQUENCY(Packet &p);
|
||||
|
||||
/**
|
||||
* Poll the server for certain updates, an invalid poll (e.g. not existent id) gets silently dropped:
|
||||
@@ -152,7 +152,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_ADMIN_POLL(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_ADMIN_POLL(Packet &p);
|
||||
|
||||
/**
|
||||
* Send chat as the server:
|
||||
@@ -163,7 +163,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_ADMIN_CHAT(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_ADMIN_CHAT(Packet &p);
|
||||
|
||||
/**
|
||||
* Send chat from the external source:
|
||||
@@ -174,7 +174,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_ADMIN_EXTERNAL_CHAT(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_ADMIN_EXTERNAL_CHAT(Packet &p);
|
||||
|
||||
/**
|
||||
* Execute a command on the servers console:
|
||||
@@ -182,7 +182,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_ADMIN_RCON(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_ADMIN_RCON(Packet &p);
|
||||
|
||||
/**
|
||||
* Send a JSON string to the current active GameScript.
|
||||
@@ -190,7 +190,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_ADMIN_GAMESCRIPT(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_ADMIN_GAMESCRIPT(Packet &p);
|
||||
|
||||
/**
|
||||
* Ping the server, requiring the server to reply with a pong packet.
|
||||
@@ -198,21 +198,21 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_ADMIN_PING(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_ADMIN_PING(Packet &p);
|
||||
|
||||
/**
|
||||
* The server is full (connection gets closed).
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_FULL(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_FULL(Packet &p);
|
||||
|
||||
/**
|
||||
* The source IP address is banned (connection gets closed).
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_BANNED(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_BANNED(Packet &p);
|
||||
|
||||
/**
|
||||
* An error was caused by this admin connection (connection gets closed).
|
||||
@@ -220,7 +220,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_ERROR(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_ERROR(Packet &p);
|
||||
|
||||
/**
|
||||
* Inform a just joined admin about the protocol specifics:
|
||||
@@ -231,7 +231,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_PROTOCOL(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_PROTOCOL(Packet &p);
|
||||
|
||||
/**
|
||||
* Welcome a connected admin to the game:
|
||||
@@ -247,21 +247,21 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_WELCOME(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_WELCOME(Packet &p);
|
||||
|
||||
/**
|
||||
* Notification about a newgame.
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_NEWGAME(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_NEWGAME(Packet &p);
|
||||
|
||||
/**
|
||||
* Notification about the server shutting down.
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_SHUTDOWN(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_SHUTDOWN(Packet &p);
|
||||
|
||||
/**
|
||||
* Send the current date of the game:
|
||||
@@ -269,7 +269,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_DATE(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_DATE(Packet &p);
|
||||
|
||||
/**
|
||||
* Notification of a new client:
|
||||
@@ -277,7 +277,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_CLIENT_JOIN(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_CLIENT_JOIN(Packet &p);
|
||||
|
||||
/**
|
||||
* Client information of a specific client:
|
||||
@@ -290,7 +290,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_CLIENT_INFO(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_CLIENT_INFO(Packet &p);
|
||||
|
||||
/**
|
||||
* Client update details on a specific client (e.g. after rename or move):
|
||||
@@ -300,7 +300,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_CLIENT_UPDATE(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_CLIENT_UPDATE(Packet &p);
|
||||
|
||||
/**
|
||||
* Notification about a client leaving the game.
|
||||
@@ -308,7 +308,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_CLIENT_QUIT(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_CLIENT_QUIT(Packet &p);
|
||||
|
||||
/**
|
||||
* Notification about a client error (and thus the clients disconnection).
|
||||
@@ -317,7 +317,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_CLIENT_ERROR(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_CLIENT_ERROR(Packet &p);
|
||||
|
||||
/**
|
||||
* Notification of a new company:
|
||||
@@ -325,7 +325,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_COMPANY_NEW(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_COMPANY_NEW(Packet &p);
|
||||
|
||||
/**
|
||||
* Company information on a specific company:
|
||||
@@ -339,7 +339,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_COMPANY_INFO(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_COMPANY_INFO(Packet &p);
|
||||
|
||||
/**
|
||||
* Company information of a specific company:
|
||||
@@ -356,7 +356,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_COMPANY_UPDATE(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_COMPANY_UPDATE(Packet &p);
|
||||
|
||||
/**
|
||||
* Notification about a removed company (e.g. due to bankruptcy).
|
||||
@@ -365,7 +365,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_COMPANY_REMOVE(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_COMPANY_REMOVE(Packet &p);
|
||||
|
||||
/**
|
||||
* Economy update of a specific company:
|
||||
@@ -383,7 +383,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_COMPANY_ECONOMY(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_COMPANY_ECONOMY(Packet &p);
|
||||
|
||||
/**
|
||||
* Company statistics on stations and vehicles:
|
||||
@@ -401,7 +401,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_COMPANY_STATS(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_COMPANY_STATS(Packet &p);
|
||||
|
||||
/**
|
||||
* Send chat from the game into the admin network:
|
||||
@@ -413,7 +413,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_CHAT(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_CHAT(Packet &p);
|
||||
|
||||
/**
|
||||
* Result of an rcon command:
|
||||
@@ -422,7 +422,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_RCON(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_RCON(Packet &p);
|
||||
|
||||
/**
|
||||
* Send what would be printed on the server's console also into the admin network.
|
||||
@@ -431,7 +431,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_CONSOLE(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_CONSOLE(Packet &p);
|
||||
|
||||
/**
|
||||
* Send DoCommand names to the bot upon request only.
|
||||
@@ -450,7 +450,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_CMD_NAMES(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_CMD_NAMES(Packet &p);
|
||||
|
||||
/**
|
||||
* Send incoming command packets to the admin network.
|
||||
@@ -470,7 +470,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_CMD_LOGGING(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_CMD_LOGGING(Packet &p);
|
||||
|
||||
/**
|
||||
* Send a ping-reply (pong) to the admin that sent us the ping packet.
|
||||
@@ -478,7 +478,7 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_PONG(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_PONG(Packet &p);
|
||||
|
||||
/**
|
||||
* Notify the admin connection that the rcon command has finished.
|
||||
@@ -486,9 +486,9 @@ protected:
|
||||
* @param p The packet that was just received.
|
||||
* @return The state the network should have.
|
||||
*/
|
||||
virtual NetworkRecvStatus Receive_SERVER_RCON_END(Packet *p);
|
||||
virtual NetworkRecvStatus Receive_SERVER_RCON_END(Packet &p);
|
||||
|
||||
NetworkRecvStatus HandlePacket(Packet *p);
|
||||
NetworkRecvStatus HandlePacket(Packet &p);
|
||||
public:
|
||||
NetworkRecvStatus CloseConnection(bool error = true) override;
|
||||
|
||||
|
Reference in New Issue
Block a user