From 65d556ef4e6a60d26c5ca3f1a92adf4e795143e8 Mon Sep 17 00:00:00 2001 From: BenDol Date: Sun, 20 Apr 2014 04:36:52 +1200 Subject: [PATCH] Fixed issue with isAttacking and isFollowing on older protocols. Some protocols don't send a cancel attack/follow packet to the client when a creature dies. --- src/client/game.cpp | 2 +- src/client/game.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/game.cpp b/src/client/game.cpp index d81f3387..115097da 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -1478,7 +1478,7 @@ void Game::setProtocolVersion(int version) enableFeature(Otc::GameNewFluids); enableFeature(Otc::GameMessageLevel); enableFeature(Otc::GamePlayerStateU16); - enableFeature(Otc::GameNewOutfitProtocol); + enableFeature(Otc::GameNewOutfitProtocol); // This might be 790 not 780 } if(version >= 790) { diff --git a/src/client/game.h b/src/client/game.h index ada055bd..7fdf582f 100644 --- a/src/client/game.h +++ b/src/client/game.h @@ -286,8 +286,8 @@ public: bool isOnline() { return m_online; } bool isLogging() { return !m_online && m_protocolGame; } bool isDead() { return m_dead; } - bool isAttacking() { return !!m_attackingCreature; } - bool isFollowing() { return !!m_followingCreature; } + bool isAttacking() { return !!m_attackingCreature && !m_attackingCreature->isRemoved(); } + bool isFollowing() { return !!m_followingCreature && !m_followingCreature->isRemoved(); } bool isConnectionOk() { return m_protocolGame && m_protocolGame->getElapsedTicksSinceLastRead() < 5000; } int getPing() { return m_ping >= 0 ? std::max(m_ping, m_pingTimer.elapsed_millis()) : -1; }