diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-30 16:42:51 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-30 16:42:51 +0300 |
commit | 2b46f2d6d7cd732f1f4f1d9e8a15a1428166a959 (patch) | |
tree | f32c0aea02ec7a0b818aede9a81238e0418b1f23 /src | |
parent | 2b8e0b02338400b215b73cec900ffa1fddbac60a (diff) | |
download | plus-2b46f2d6d7cd732f1f4f1d9e8a15a1428166a959.tar.gz plus-2b46f2d6d7cd732f1f4f1d9e8a15a1428166a959.tar.bz2 plus-2b46f2d6d7cd732f1f4f1d9e8a15a1428166a959.tar.xz plus-2b46f2d6d7cd732f1f4f1d9e8a15a1428166a959.zip |
Move reachable enum into separate file.
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/being/being.cpp | 3 | ||||
-rw-r--r-- | src/being/being.h | 7 | ||||
-rw-r--r-- | src/being/localplayer.cpp | 11 | ||||
-rw-r--r-- | src/enums/being/reachable.h | 36 |
6 files changed, 46 insertions, 13 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 29a51bc55..904c5e3d2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1016,6 +1016,7 @@ SET(SRCS being/playerrelations.cpp being/playerrelations.h enums/being/rank.h + enums/being/reachable.h enums/being/targetcursorsize.h enums/being/targetcursortype.h listeners/playerrelationslistener.h diff --git a/src/Makefile.am b/src/Makefile.am index 7db06392f..8eea44b8d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1149,6 +1149,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ being/playerrelations.cpp \ being/playerrelations.h \ enums/being/rank.h \ + enums/being/reachable.h \ enums/being/targetcursorsize.h \ enums/being/targetcursortype.h \ listeners/playerrelationslistener.h \ diff --git a/src/being/being.cpp b/src/being/being.cpp index 49a044150..179e64635 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -41,6 +41,7 @@ #include "enums/being/attributes.h" #include "enums/being/beingdirection.h" +#include "enums/being/reachable.h" #include "enums/net/packettypes.h" @@ -201,7 +202,7 @@ Being::Being(const BeingId id, mHP(0), mMaxHP(0), mDistance(0), - mIsReachable(REACH_UNKNOWN), + mIsReachable(Reachable::REACH_UNKNOWN), mGoodStatus(-1), mMoveTime(0), mAttackTime(0), diff --git a/src/being/being.h b/src/being/being.h index 1837f9cbe..ead24af3f 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -91,13 +91,6 @@ class Being notfinal : public ActorSprite, friend class BeingEquipBackend; friend class LocalPlayer; - enum Reachable - { - REACH_UNKNOWN = 0, - REACH_YES = 1, - REACH_NO = 2 - }; - /** * Constructor. * diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 5c47c55a8..6c8bd5ea6 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -42,6 +42,7 @@ #include "enums/being/attributes.h" #include "enums/being/beingdirection.h" +#include "enums/being/reachable.h" #include "enums/net/packettypes.h" @@ -1375,14 +1376,14 @@ bool LocalPlayer::isReachable(Being *const being, if (!being || !mMap) return false; - if (being->isReachable() == Being::REACH_NO) + if (being->isReachable() == Reachable::REACH_NO) return false; if (being->getTileX() == mX && being->getTileY() == mY) { being->setDistance(0); - being->setIsReachable(Being::REACH_YES); + being->setIsReachable(Reachable::REACH_YES); return true; } else if (being->getTileX() - 1 <= mX @@ -1391,7 +1392,7 @@ bool LocalPlayer::isReachable(Being *const being, && being->getTileY() + 1 >= mY) { being->setDistance(1); - being->setIsReachable(Being::REACH_YES); + being->setIsReachable(Reachable::REACH_YES); return true; } @@ -1405,12 +1406,12 @@ bool LocalPlayer::isReachable(Being *const being, being->setDistance(static_cast<int>(debugPath.size())); if (!debugPath.empty()) { - being->setIsReachable(Being::REACH_YES); + being->setIsReachable(Reachable::REACH_YES); return true; } else { - being->setIsReachable(Being::REACH_NO); + being->setIsReachable(Reachable::REACH_NO); return false; } } diff --git a/src/enums/being/reachable.h b/src/enums/being/reachable.h new file mode 100644 index 000000000..18271169d --- /dev/null +++ b/src/enums/being/reachable.h @@ -0,0 +1,36 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef ENUMS_BEING_REACHABLE_H +#define ENUMS_BEING_REACHABLE_H + +namespace Reachable +{ + enum T + { + REACH_UNKNOWN = 0, + REACH_YES = 1, + REACH_NO = 2 + }; +} // namespace Reachable + +#endif // ENUMS_BEING_REACHABLE_H |