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.
This commit is contained in:
BenDol 2014-04-20 04:36:52 +12:00
parent 54b8e362d5
commit 65d556ef4e
2 changed files with 3 additions and 3 deletions

View File

@ -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) {

View File

@ -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<int>(m_ping, m_pingTimer.elapsed_millis()) : -1; }