diff --git a/client/scenes/in_world.cpp b/client/scenes/in_world.cpp index fc1bdde..7e3805d 100644 --- a/client/scenes/in_world.cpp +++ b/client/scenes/in_world.cpp @@ -287,7 +287,8 @@ void InWorld::HandleRegionContent(SerialPacket packet) { void InWorld::HandlePlayerUpdate(SerialPacket packet) { if (playerCharacters.find(packet.playerInfo.playerIndex) == playerCharacters.end()) { - throw(std::runtime_error("Cannot update nen-existant players")); + HandlePlayerNew(packet); + return; } //update only if the message didn't originate from here diff --git a/common/network/serial_packet.hpp b/common/network/serial_packet.hpp index ff4fb8c..12574f7 100644 --- a/common/network/serial_packet.hpp +++ b/common/network/serial_packet.hpp @@ -110,6 +110,7 @@ union SerialPacket { int playerIndex; char handle[PACKET_STRING_SIZE]; char avatar[PACKET_STRING_SIZE]; + int mapIndex; Vector2 position; Vector2 motion; }playerInfo; diff --git a/server/networking.cpp b/server/server_networking.cpp similarity index 99% rename from server/networking.cpp rename to server/server_networking.cpp index c7afbc9..c206077 100644 --- a/server/networking.cpp +++ b/server/server_networking.cpp @@ -87,6 +87,7 @@ void ServerApplication::HandleSynchronize(SerialPacket packet) { newPacket.playerInfo.playerIndex = it.first; snprintf(newPacket.playerInfo.handle, PACKET_STRING_SIZE, "%s", it.second.handle.c_str()); snprintf(newPacket.playerInfo.avatar, PACKET_STRING_SIZE, "%s", it.second.avatar.c_str()); + newPacket.playerInfo.mapIndex = it.second.mapIndex; newPacket.playerInfo.position = it.second.position; newPacket.playerInfo.motion = it.second.motion; serialize(&newPacket, buffer);