From f91ad9a0c39ae1c537f2769f1fdf4b0a59e8bf91 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 16 Sep 2014 21:24:09 +0300 Subject: add server feature haveMonsterAttackRange. --- src/net/eathena/serverfeatures.cpp | 5 +++++ src/net/eathena/serverfeatures.h | 2 ++ src/net/serverfeatures.h | 2 ++ src/net/tmwa/beinghandler.cpp | 6 ++++-- src/net/tmwa/serverfeatures.cpp | 5 +++++ src/net/tmwa/serverfeatures.h | 2 ++ 6 files changed, 20 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/net/eathena/serverfeatures.cpp b/src/net/eathena/serverfeatures.cpp index 9d6824ba2..d28b7a91c 100644 --- a/src/net/eathena/serverfeatures.cpp +++ b/src/net/eathena/serverfeatures.cpp @@ -112,4 +112,9 @@ bool ServerFeatures::haveOtherGender() const return false; } +bool ServerFeatures::haveMonsterAttackRange() const +{ + return false; +} + } // namespace EAthena diff --git a/src/net/eathena/serverfeatures.h b/src/net/eathena/serverfeatures.h index 036d3be4b..e4469868c 100644 --- a/src/net/eathena/serverfeatures.h +++ b/src/net/eathena/serverfeatures.h @@ -65,6 +65,8 @@ class ServerFeatures final : public Net::ServerFeatures bool haveItemColors() const override final; bool haveOtherGender() const override final; + + bool haveMonsterAttackRange() const override final; }; } // namespace EAthena diff --git a/src/net/serverfeatures.h b/src/net/serverfeatures.h index dcd777a03..803d81b81 100644 --- a/src/net/serverfeatures.h +++ b/src/net/serverfeatures.h @@ -62,6 +62,8 @@ class ServerFeatures notfinal virtual bool haveItemColors() const = 0; virtual bool haveOtherGender() const = 0; + + virtual bool haveMonsterAttackRange() const = 0; }; } // namespace Net diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 398d582bd..f39b88979 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -1133,7 +1133,8 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) msg.readInt16("manner"); dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3")); - if (serverVersion > 0 && dstBeing->getType() == ActorType::Monster) + if (Net::getServerFeatures()->haveMonsterAttackRange() + && dstBeing->getType() == ActorType::Monster) { const int attackRange = static_cast( msg.readUInt8("attack range (was karma)")); @@ -1336,7 +1337,8 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) msg.readInt16("manner"); dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3")); - if (serverVersion > 0 && dstBeing->getType() == ActorType::Monster) + if (Net::getServerFeatures()->haveMonsterAttackRange() + && dstBeing->getType() == ActorType::Monster) { const int attackRange = static_cast( msg.readUInt8("attack range (was karma)")); diff --git a/src/net/tmwa/serverfeatures.cpp b/src/net/tmwa/serverfeatures.cpp index e7d35b666..aaba467ac 100644 --- a/src/net/tmwa/serverfeatures.cpp +++ b/src/net/tmwa/serverfeatures.cpp @@ -114,4 +114,9 @@ bool ServerFeatures::haveOtherGender() const return serverVersion >= 5; } +bool ServerFeatures::haveMonsterAttackRange() const +{ + return serverVersion > 0; +} + } // namespace TmwAthena diff --git a/src/net/tmwa/serverfeatures.h b/src/net/tmwa/serverfeatures.h index 2af67f255..c5b3fddaa 100644 --- a/src/net/tmwa/serverfeatures.h +++ b/src/net/tmwa/serverfeatures.h @@ -65,6 +65,8 @@ class ServerFeatures final : public Net::ServerFeatures bool haveItemColors() const override final; bool haveOtherGender() const override final; + + bool haveMonsterAttackRange() const override final; }; } // namespace TmwAthena -- cgit v1.2.3-70-g09d2