Rename some packet and handlers to <packet>_Legacy name for compat layer between new network changes and old network clients

This commit is contained in:
Loic Blot 2015-03-13 13:40:48 +01:00
parent 4e63c977c7
commit 126f36c2e6
9 changed files with 26 additions and 26 deletions

View File

@ -407,7 +407,7 @@ void Client::step(float dtime)
snprintf(pName, PLAYERNAME_SIZE, "%s", myplayer->getName());
snprintf(pPassword, PASSWORD_SIZE, "%s", m_password.c_str());
NetworkPacket* pkt = new NetworkPacket(TOSERVER_INIT,
NetworkPacket* pkt = new NetworkPacket(TOSERVER_INIT_LEGACY,
1 + PLAYERNAME_SIZE + PASSWORD_SIZE + 2 + 2);
*pkt << (u8) SER_FMT_VER_HIGHEST_READ;
@ -1065,7 +1065,7 @@ void Client::sendChangePassword(const std::wstring &oldpassword,
std::string oldpwd = translatePassword(playername, oldpassword);
std::string newpwd = translatePassword(playername, newpassword);
NetworkPacket* pkt = new NetworkPacket(TOSERVER_PASSWORD, 2 * PASSWORD_SIZE);
NetworkPacket* pkt = new NetworkPacket(TOSERVER_PASSWORD_LEGACY, 2 * PASSWORD_SIZE);
for(u8 i = 0; i < PASSWORD_SIZE; i++) {
*pkt << (u8) (i < oldpwd.length() ? oldpwd[i] : 0);

View File

@ -350,7 +350,7 @@ public:
void handleCommand_Null(NetworkPacket* pkt) {};
void handleCommand_Deprecated(NetworkPacket* pkt);
void handleCommand_Init(NetworkPacket* pkt);
void handleCommand_AccessDenied(NetworkPacket* pkt);
void handleCommand_AccessDenied_Legacy(NetworkPacket* pkt);
void handleCommand_RemoveNode(NetworkPacket* pkt);
void handleCommand_AddNode(NetworkPacket* pkt);
void handleCommand_BlockData(NetworkPacket* pkt);
@ -379,7 +379,7 @@ public:
void handleCommand_ShowFormSpec(NetworkPacket* pkt);
void handleCommand_SpawnParticle(NetworkPacket* pkt);
void handleCommand_AddParticleSpawner(NetworkPacket* pkt);
void handleCommand_DeleteParticleSpawner(NetworkPacket* pkt);
void handleCommand_DeleteParticleSpawner_Legacy(NetworkPacket* pkt);
void handleCommand_HudAdd(NetworkPacket* pkt);
void handleCommand_HudRemove(NetworkPacket* pkt);
void handleCommand_HudChange(NetworkPacket* pkt);

View File

@ -40,7 +40,7 @@ const ToClientCommandHandler toClientCommandTable[TOCLIENT_NUM_MSG_TYPES] =
null_command_handler,
null_command_handler,
null_command_handler,
{ "TOCLIENT_INIT", TOCLIENT_STATE_NOT_CONNECTED, &Client::handleCommand_Init }, // 0x10
{ "TOCLIENT_INIT", TOCLIENT_STATE_NOT_CONNECTED, &Client::handleCommand_Init }, // 0x10
null_command_handler,
null_command_handler,
null_command_handler,
@ -77,7 +77,7 @@ const ToClientCommandHandler toClientCommandTable[TOCLIENT_NUM_MSG_TYPES] =
{ "TOCLIENT_ACTIVE_OBJECT_MESSAGES", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_ActiveObjectMessages }, // 0x32
{ "TOCLIENT_HP", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_HP }, // 0x33
{ "TOCLIENT_MOVE_PLAYER", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_MovePlayer }, // 0x34
{ "TOCLIENT_ACCESS_DENIED", TOCLIENT_STATE_NOT_CONNECTED, &Client::handleCommand_AccessDenied }, // 0x35
{ "TOCLIENT_ACCESS_DENIED_LEGACY", TOCLIENT_STATE_NOT_CONNECTED, &Client::handleCommand_AccessDenied_Legacy }, // 0x35
{ "TOCLIENT_PLAYERITEM", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_PlayerItem }, // 0x36
{ "TOCLIENT_DEATHSCREEN", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_DeathScreen }, // 0x37
{ "TOCLIENT_MEDIA", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_Media }, // 0x38
@ -96,7 +96,7 @@ const ToClientCommandHandler toClientCommandTable[TOCLIENT_NUM_MSG_TYPES] =
{ "TOCLIENT_MOVEMENT", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_Movement }, // 0x45
{ "TOCLIENT_SPAWN_PARTICLE", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_SpawnParticle }, // 0x46
{ "TOCLIENT_ADD_PARTICLESPAWNER", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_AddParticleSpawner }, // 0x47
{ "TOCLIENT_DELETE_PARTICLESPAWNER", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_DeleteParticleSpawner }, // 0x48
{ "TOCLIENT_DELETE_PARTICLESPAWNER", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_DeleteParticleSpawner_Legacy }, // 0x48
{ "TOCLIENT_HUDADD", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_HudAdd }, // 0x49
{ "TOCLIENT_HUDRM", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_HudRemove }, // 0x4a
{ "TOCLIENT_HUDCHANGE", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_HudChange }, // 0x4b
@ -167,7 +167,7 @@ const ServerCommandFactory serverCommandFactoryTable[TOSERVER_NUM_MSG_TYPES] =
{ "TOSERVER_SIGNNODETEXT", 0, false }, // 0x33
{ "TOSERVER_CLICK_ACTIVEOBJECT", 0, false }, // 0x34
{ "TOSERVER_DAMAGE", 0, true }, // 0x35
{ "TOSERVER_PASSWORD", 0, true }, // 0x36
{ "TOSERVER_PASSWORD_LEGACY", 0, true }, // 0x36
{ "TOSERVER_PLAYERITEM", 0, true }, // 0x37
{ "TOSERVER_RESPAWN", 0, true }, // 0x38
{ "TOSERVER_INTERACT", 0, true }, // 0x39

View File

@ -270,7 +270,7 @@ enum ToClientCommand
f1000 player yaw
*/
TOCLIENT_ACCESS_DENIED = 0x35,
TOCLIENT_ACCESS_DENIED_LEGACY = 0x35,
/*
u16 command
u16 reason_length
@ -457,7 +457,7 @@ enum ToClientCommand
u32 id
*/
TOCLIENT_DELETE_PARTICLESPAWNER = 0x48,
TOCLIENT_DELETE_PARTICLESPAWNER_LEGACY = 0x48,
/*
u16 command
u32 id
@ -562,7 +562,7 @@ enum ToClientCommand
enum ToServerCommand
{
TOSERVER_INIT=0x10,
TOSERVER_INIT_LEGACY = 0x10,
/*
Sent first after connected.
@ -694,7 +694,7 @@ enum ToServerCommand
u8 amount
*/
TOSERVER_PASSWORD=0x36,
TOSERVER_PASSWORD_LEGACY = 0x36,
/*
Sent to change password.
@ -703,7 +703,7 @@ enum ToServerCommand
[30] u8[28] new password
*/
TOSERVER_PLAYERITEM=0x37,
TOSERVER_PLAYERITEM = 0x37,
/*
Sent to change selected item.
@ -711,7 +711,7 @@ enum ToServerCommand
[2] u16 item
*/
TOSERVER_RESPAWN=0x38,
TOSERVER_RESPAWN = 0x38,
/*
u16 TOSERVER_RESPAWN
*/

View File

@ -89,7 +89,7 @@ void Client::handleCommand_Init(NetworkPacket* pkt)
m_state = LC_Init;
}
void Client::handleCommand_AccessDenied(NetworkPacket* pkt)
void Client::handleCommand_AccessDenied_Legacy(NetworkPacket* pkt)
{
// The server didn't like our password. Note, this needs
// to be processed even if the serialisation format has
@ -822,7 +822,7 @@ void Client::handleCommand_AddParticleSpawner(NetworkPacket* pkt)
}
void Client::handleCommand_DeleteParticleSpawner(NetworkPacket* pkt)
void Client::handleCommand_DeleteParticleSpawner_Legacy(NetworkPacket* pkt)
{
u16 id;

View File

@ -43,7 +43,7 @@ void Server::handleCommand_Deprecated(NetworkPacket* pkt)
<< " not supported anymore" << std::endl;
}
void Server::handleCommand_Init(NetworkPacket* pkt)
void Server::handleCommand_Init_Legacy(NetworkPacket* pkt)
{
// [0] u8 SER_FMT_VER_HIGHEST_READ
// [1] u8[20] player_name
@ -942,7 +942,7 @@ void Server::handleCommand_Breath(NetworkPacket* pkt)
SendPlayerBreath(pkt->getPeerId());
}
void Server::handleCommand_Password(NetworkPacket* pkt)
void Server::handleCommand_Password_Legacy(NetworkPacket* pkt)
{
/*
[0] u16 TOSERVER_PASSWORD

View File

@ -40,7 +40,7 @@ const ToServerCommandHandler toServerCommandTable[TOSERVER_NUM_MSG_TYPES] =
null_command_handler, // 0x0d
null_command_handler, // 0x0e
null_command_handler, // 0x0f
{ "TOSERVER_INIT", TOSERVER_STATE_NOT_CONNECTED, &Server::handleCommand_Init }, // 0x10
{ "TOSERVER_INIT_LEGACY", TOSERVER_STATE_NOT_CONNECTED, &Server::handleCommand_Init_Legacy }, // 0x10
{ "TOSERVER_INIT2", TOSERVER_STATE_NOT_CONNECTED, &Server::handleCommand_Init2 }, // 0x11
null_command_handler, // 0x12
null_command_handler, // 0x13
@ -78,7 +78,7 @@ const ToServerCommandHandler toServerCommandTable[TOSERVER_NUM_MSG_TYPES] =
{ "TOSERVER_SIGNNODETEXT", TOSERVER_STATE_INGAME, &Server::handleCommand_Deprecated }, // 0x33
{ "TOSERVER_CLICK_ACTIVEOBJECT", TOSERVER_STATE_INGAME, &Server::handleCommand_Deprecated }, // 0x34
{ "TOSERVER_DAMAGE", TOSERVER_STATE_INGAME, &Server::handleCommand_Damage }, // 0x35
{ "TOSERVER_PASSWORD", TOSERVER_STATE_INGAME, &Server::handleCommand_Password }, // 0x36
{ "TOSERVER_PASSWORD_LEGACY", TOSERVER_STATE_INGAME, &Server::handleCommand_Password_Legacy }, // 0x36
{ "TOSERVER_PLAYERITEM", TOSERVER_STATE_INGAME, &Server::handleCommand_PlayerItem }, // 0x37
{ "TOSERVER_RESPAWN", TOSERVER_STATE_INGAME, &Server::handleCommand_Respawn }, // 0x38
{ "TOSERVER_INTERACT", TOSERVER_STATE_INGAME, &Server::handleCommand_Interact }, // 0x39
@ -151,7 +151,7 @@ const ClientCommandFactory clientCommandFactoryTable[TOCLIENT_NUM_MSG_TYPES] =
{ "TOCLIENT_ACTIVE_OBJECT_MESSAGES", 0, true }, // 0x32 Special packet, sent by 0 (rel) and 1 (unrel) channel
{ "TOCLIENT_HP", 0, true }, // 0x33
{ "TOCLIENT_MOVE_PLAYER", 0, true }, // 0x34
{ "TOCLIENT_ACCESS_DENIED", 0, true }, // 0x35
{ "TOCLIENT_ACCESS_DENIED_LEGACY", 0, true }, // 0x35
{ "TOCLIENT_PLAYERITEM", 0, false }, // 0x36 obsolete
{ "TOCLIENT_DEATHSCREEN", 0, true }, // 0x37
{ "TOCLIENT_MEDIA", 2, true }, // 0x38
@ -170,7 +170,7 @@ const ClientCommandFactory clientCommandFactoryTable[TOCLIENT_NUM_MSG_TYPES] =
{ "TOCLIENT_MOVEMENT", 0, true }, // 0x45
{ "TOCLIENT_SPAWN_PARTICLE", 0, true }, // 0x46
{ "TOCLIENT_ADD_PARTICLESPAWNER", 0, true }, // 0x47
{ "TOCLIENT_DELETE_PARTICLESPAWNER", 0, true }, // 0x48
{ "TOCLIENT_DELETE_PARTICLESPAWNER_LEGACY", 0, true }, // 0x48
{ "TOCLIENT_HUDADD", 1, true }, // 0x49
{ "TOCLIENT_HUDRM", 1, true }, // 0x4a
{ "TOCLIENT_HUDCHANGE", 0, true }, // 0x4b

View File

@ -1506,7 +1506,7 @@ void Server::SendAccessDenied(u16 peer_id,const std::wstring &reason)
{
DSTACK(__FUNCTION_NAME);
NetworkPacket* pkt = new NetworkPacket(TOCLIENT_ACCESS_DENIED, 0, peer_id);
NetworkPacket* pkt = new NetworkPacket(TOCLIENT_ACCESS_DENIED_LEGACY, 0, peer_id);
*pkt << reason;
Send(pkt);
}
@ -1677,7 +1677,7 @@ void Server::SendDeleteParticleSpawner(u16 peer_id, u32 id)
{
DSTACK(__FUNCTION_NAME);
NetworkPacket* pkt = new NetworkPacket(TOCLIENT_DELETE_PARTICLESPAWNER, 2, peer_id);
NetworkPacket* pkt = new NetworkPacket(TOCLIENT_DELETE_PARTICLESPAWNER_LEGACY, 2, peer_id);
// Ugly error in this packet
*pkt << (u16) id;

View File

@ -197,7 +197,7 @@ public:
void handleCommand_Null(NetworkPacket* pkt) {};
void handleCommand_Deprecated(NetworkPacket* pkt);
void handleCommand_Init(NetworkPacket* pkt);
void handleCommand_Init_Legacy(NetworkPacket* pkt);
void handleCommand_Init2(NetworkPacket* pkt);
void handleCommand_RequestMedia(NetworkPacket* pkt);
void handleCommand_ReceivedMedia(NetworkPacket* pkt);
@ -209,7 +209,7 @@ public:
void handleCommand_ChatMessage(NetworkPacket* pkt);
void handleCommand_Damage(NetworkPacket* pkt);
void handleCommand_Breath(NetworkPacket* pkt);
void handleCommand_Password(NetworkPacket* pkt);
void handleCommand_Password_Legacy(NetworkPacket* pkt);
void handleCommand_PlayerItem(NetworkPacket* pkt);
void handleCommand_Respawn(NetworkPacket* pkt);
void handleCommand_Interact(NetworkPacket* pkt);