From 0d32bf594356d7236956ef30becd4e7a46cffada Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sat, 4 Mar 2017 00:29:01 +0200 Subject: [PATCH] [General] Add extra death debug, don't request data from player on death --- apps/openmw-mp/Networking.cpp | 6 ++---- apps/openmw/mwmp/Networking.cpp | 10 ++++++++++ components/CMakeLists.txt | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index 3f9fff4ea..88431b18f 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -386,12 +386,10 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) case ID_PLAYER_RESURRECT: { - DEBUG_PRINTF("ID_PLAYER_RESURRECT\n"); - //packetResurrect.Read(player); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_RESURRECT from %s", player->npc.mName.c_str()); + player->creatureStats.mDead = false; myPacket->Send(player, true); - playerController->GetPacket(ID_PLAYER_POS)->RequestData(player->guid); - playerController->GetPacket(ID_PLAYER_CELL_CHANGE)->RequestData(player->guid); Script::Call(player->getId()); diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index 90e6ccb1d..28efff72d 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -452,8 +452,11 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) case ID_PLAYER_DEATH: { LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_DEATH from server"); + if (guid == myGuid) { + LOG_APPEND(Log::LOG_INFO, "- Packet was about me"); + MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); MWMechanics::DynamicStat health = player.getClass().getCreatureStats(player).getHealth(); health.setCurrent(0); @@ -463,6 +466,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) else if (pl != 0) { LOG_APPEND(Log::LOG_INFO, "- Packet was about %s", pl->npc.mName.c_str()); + MWMechanics::DynamicStat health; pl->creatureStats.mDead = true; health.readState(pl->creatureStats.mDynamic[0]); @@ -474,8 +478,12 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) } case ID_PLAYER_RESURRECT: { + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_RESURRECT from server"); + if (guid == myGuid) { + LOG_APPEND(Log::LOG_INFO, "- Packet was about me"); + MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); player.getClass().getCreatureStats(player).resurrect(); @@ -490,6 +498,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) } else if (pl != 0) { + LOG_APPEND(Log::LOG_INFO, "- Packet was about %s", pl->npc.mName.c_str()); + pl->creatureStats.mDead = false; if (pl->creatureStats.mDynamic[0].mMod < 1) pl->creatureStats.mDynamic[0].mMod = 1; diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index af3776d04..23f5b1448 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -161,7 +161,7 @@ add_component_dir (openmw-mp Packets/Player/PacketPlayerSpellbook Packets/Player/PacketPlayerJournal Packets/Player/PacketPlayerActiveSkills Packets/Player/PacketPlayerCellChange Packets/Player/PacketPlayerCellState - Packets/Player/PacketPlayerResurrect + Packets/Player/PacketPlayerDeath Packets/Player/PacketPlayerResurrect Packets/Player/PacketGUIBoxes Packets/Player/PacketTime