Fix: server shutdown and newgame packets should be stable

The server sends shutdown and newgame (reboot) packets to any connected client.
This can be useful, so you can tell clients that are trying to join that the
server is restarting. However, that means that packets can be sent before a
version check has been done.
So, these packets should be in the stable packet range instead of the one that
is unstable and guarded by a version check.
This commit is contained in:
Rubidium 2024-03-25 21:59:04 +01:00 committed by rubidium42
parent 4751179dc5
commit 8e12bd35ae
1 changed files with 7 additions and 8 deletions

View File

@ -24,10 +24,9 @@
*/
enum PacketGameType : uint8_t {
/*
* These first four pair of packets (thus eight in
* total) must remain in this order for backward
* and forward compatibility between clients that
* are trying to join directly.
* These first ten packets must remain in this order for backward and forward compatibility
* between clients that are trying to join directly. These packets can be received and/or sent
* by the server before the server has processed the 'join' packet from the client.
*/
/* Packets sent by socket accepting code without ever constructing a client socket instance. */
@ -46,6 +45,10 @@ enum PacketGameType : uint8_t {
PACKET_SERVER_GAME_INFO, ///< Information about the server.
PACKET_CLIENT_GAME_INFO, ///< Request information about the server.
/* A server quitting this game. */
PACKET_SERVER_NEWGAME, ///< The server is preparing to start a new game.
PACKET_SERVER_SHUTDOWN, ///< The server is shutting down.
/*
* Packets after here assume that the client
* and server are running the same version. As
@ -121,10 +124,6 @@ enum PacketGameType : uint8_t {
PACKET_SERVER_COMPANY_UPDATE, ///< Information (password) of a company changed.
PACKET_SERVER_CONFIG_UPDATE, ///< Some network configuration important to the client changed.
/* A server quitting this game. */
PACKET_SERVER_NEWGAME, ///< The server is preparing to start a new game.
PACKET_SERVER_SHUTDOWN, ///< The server is shutting down.
/* A client quitting. */
PACKET_CLIENT_QUIT, ///< A client tells the server it is going to quit.
PACKET_SERVER_QUIT, ///< A server tells that a client has quit.