Fixed shoddy packet typing
This commit is contained in:
@@ -271,7 +271,7 @@ void InWorld::KeyUp(SDL_KeyboardEvent const& key) {
|
|||||||
void InWorld::HandlePacket(SerialPacket* const argPacket) {
|
void InWorld::HandlePacket(SerialPacket* const argPacket) {
|
||||||
switch(argPacket->type) {
|
switch(argPacket->type) {
|
||||||
case SerialPacketType::DISCONNECT:
|
case SerialPacketType::DISCONNECT:
|
||||||
HandleDisconnect(argPacket);
|
HandleDisconnect(static_cast<ClientPacket*>(argPacket));
|
||||||
break;
|
break;
|
||||||
case SerialPacketType::CHARACTER_NEW:
|
case SerialPacketType::CHARACTER_NEW:
|
||||||
HandleCharacterNew(static_cast<CharacterPacket*>(argPacket));
|
HandleCharacterNew(static_cast<CharacterPacket*>(argPacket));
|
||||||
@@ -292,7 +292,8 @@ void InWorld::HandlePacket(SerialPacket* const argPacket) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InWorld::HandleDisconnect(SerialPacket* const argPacket) {
|
void InWorld::HandleDisconnect(ClientPacket* const argPacket) {
|
||||||
|
//TODO: More needed in the disconnection
|
||||||
SetNextScene(SceneList::CLEANUP);
|
SetNextScene(SceneList::CLEANUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ protected:
|
|||||||
|
|
||||||
//Network handlers
|
//Network handlers
|
||||||
void HandlePacket(SerialPacket* const);
|
void HandlePacket(SerialPacket* const);
|
||||||
void HandleDisconnect(SerialPacket* const);
|
void HandleDisconnect(ClientPacket* const);
|
||||||
void HandleCharacterNew(CharacterPacket* const);
|
void HandleCharacterNew(CharacterPacket* const);
|
||||||
void HandleCharacterDelete(CharacterPacket* const);
|
void HandleCharacterDelete(CharacterPacket* const);
|
||||||
void HandleCharacterUpdate(CharacterPacket* const);
|
void HandleCharacterUpdate(CharacterPacket* const);
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ void deserialCopy(void** buffer, void* data, int size) {
|
|||||||
*buffer = reinterpret_cast<char*>(*buffer) + size;
|
*buffer = reinterpret_cast<char*>(*buffer) + size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//DOCS: The server and client MUST use the correct packet types
|
||||||
|
|
||||||
//main switch functions
|
//main switch functions
|
||||||
void serializePacket(void* buffer, SerialPacketBase* packet) {
|
void serializePacket(void* buffer, SerialPacketBase* packet) {
|
||||||
switch(packet->type) {
|
switch(packet->type) {
|
||||||
|
|||||||
@@ -61,10 +61,10 @@ private:
|
|||||||
void HandlePacket(SerialPacket* const);
|
void HandlePacket(SerialPacket* const);
|
||||||
|
|
||||||
//basic connections
|
//basic connections
|
||||||
void HandleBroadcastRequest(SerialPacket* const);
|
void HandleBroadcastRequest(ServerPacket* const);
|
||||||
void HandleJoinRequest(ClientPacket* const);
|
void HandleJoinRequest(ClientPacket* const);
|
||||||
void HandleDisconnect(ClientPacket* const);
|
void HandleDisconnect(ClientPacket* const);
|
||||||
void HandleShutdown(SerialPacket* const);
|
void HandleShutdown(ClientPacket* const);
|
||||||
|
|
||||||
//map management
|
//map management
|
||||||
void HandleRegionRequest(RegionPacket* const);
|
void HandleRegionRequest(RegionPacket* const);
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ void ServerApplication::HandlePacket(SerialPacket* const argPacket) {
|
|||||||
switch(argPacket->type) {
|
switch(argPacket->type) {
|
||||||
//basic connections
|
//basic connections
|
||||||
case SerialPacketType::BROADCAST_REQUEST:
|
case SerialPacketType::BROADCAST_REQUEST:
|
||||||
HandleBroadcastRequest(static_cast<SerialPacket*>(argPacket));
|
HandleBroadcastRequest(static_cast<ServerPacket*>(argPacket));
|
||||||
break;
|
break;
|
||||||
case SerialPacketType::JOIN_REQUEST:
|
case SerialPacketType::JOIN_REQUEST:
|
||||||
HandleJoinRequest(static_cast<ClientPacket*>(argPacket));
|
HandleJoinRequest(static_cast<ClientPacket*>(argPacket));
|
||||||
@@ -188,7 +188,7 @@ void ServerApplication::HandlePacket(SerialPacket* const argPacket) {
|
|||||||
HandleDisconnect(static_cast<ClientPacket*>(argPacket));
|
HandleDisconnect(static_cast<ClientPacket*>(argPacket));
|
||||||
break;
|
break;
|
||||||
case SerialPacketType::SHUTDOWN:
|
case SerialPacketType::SHUTDOWN:
|
||||||
HandleShutdown(static_cast<SerialPacket*>(argPacket));
|
HandleShutdown(static_cast<ClientPacket*>(argPacket));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//map management
|
//map management
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
//basic connections
|
//basic connections
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
void ServerApplication::HandleBroadcastRequest(SerialPacket* const argPacket) {
|
void ServerApplication::HandleBroadcastRequest(ServerPacket* const argPacket) {
|
||||||
//send the server's data
|
//send the server's data
|
||||||
ServerPacket newPacket;
|
ServerPacket newPacket;
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ void ServerApplication::HandleDisconnect(ClientPacket* const argPacket) {
|
|||||||
std::cout << "Disconnection, " << clientMap.size() << " clients and " << accountMgr.GetContainer()->size() << " accounts total" << std::endl;
|
std::cout << "Disconnection, " << clientMap.size() << " clients and " << accountMgr.GetContainer()->size() << " accounts total" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerApplication::HandleShutdown(SerialPacket* const argPacket) {
|
void ServerApplication::HandleShutdown(ClientPacket* const argPacket) {
|
||||||
//TODO: authenticate who is shutting the server down
|
//TODO: authenticate who is shutting the server down
|
||||||
/*Pseudocode:
|
/*Pseudocode:
|
||||||
if sender's account -> admin is not true then
|
if sender's account -> admin is not true then
|
||||||
@@ -115,7 +115,7 @@ void ServerApplication::HandleShutdown(SerialPacket* const argPacket) {
|
|||||||
running = false;
|
running = false;
|
||||||
|
|
||||||
//disconnect all clients
|
//disconnect all clients
|
||||||
SerialPacket newPacket;
|
ClientPacket newPacket;
|
||||||
newPacket.type = SerialPacketType::DISCONNECT;
|
newPacket.type = SerialPacketType::DISCONNECT;
|
||||||
PumpPacket(&newPacket);
|
PumpPacket(&newPacket);
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
TODO: Sort out the *_cast<> stuff
|
TODO: Heartbeat systems
|
||||||
TODO: encapsulate the data structures
|
TODO: Rejection messages
|
||||||
TODO: Ping-pong and keep alive system
|
|
||||||
TODO: Move the statistics into their own SQL table, instead of duplicating the structure a dozen times
|
TODO: Move the statistics into their own SQL table, instead of duplicating the structure a dozen times
|
||||||
TODO: Get the rooms working, even if only via hotkeys
|
TODO: Get the rooms working, even if only via hotkeys
|
||||||
TODO: Rejection messages
|
|
||||||
TODO: Move the map system into it's own namespace
|
|
||||||
TODO: The TileSheet class should implement the surface itself
|
|
||||||
|
|
||||||
TODO: Fix shoddy movement
|
TODO: Fix shoddy movement
|
||||||
|
|
||||||
|
TODO: Move the map system into it's own namespace?
|
||||||
|
TODO: The TileSheet class should implement the surface itself
|
||||||
TODO: make the whole thing more fault tolerant
|
TODO: make the whole thing more fault tolerant
|
||||||
TODO: Authentication
|
TODO: Authentication
|
||||||
TODO: server is slaved to the client
|
|
||||||
|
|
||||||
TODO: Time delay for requesting region packets
|
TODO: Time delay for requesting region packets
|
||||||
TODO: command line parameters overriding config.cfg settings
|
TODO: command line parameters overriding config.cfg settings
|
||||||
|
|||||||
Reference in New Issue
Block a user