diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-27 21:39:10 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-27 21:39:10 +0300 |
commit | f2dba51be00b6c67b6d1b8924cac8019a3bcd000 (patch) | |
tree | bc40b96606b74c80e60fb21064b1e8883dee2db6 | |
parent | 420664f4025b261674e0cdea503d43fb95beae38 (diff) | |
download | ManaVerse-f2dba51be00b6c67b6d1b8924cac8019a3bcd000.tar.gz ManaVerse-f2dba51be00b6c67b6d1b8924cac8019a3bcd000.tar.bz2 ManaVerse-f2dba51be00b6c67b6d1b8924cac8019a3bcd000.tar.xz ManaVerse-f2dba51be00b6c67b6d1b8924cac8019a3bcd000.zip |
Add strong typed bool type Move.
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/being/being.cpp | 9 | ||||
-rw-r--r-- | src/being/being.h | 4 | ||||
-rw-r--r-- | src/enums/simpletypes/move.h | 28 | ||||
-rw-r--r-- | src/text.cpp | 5 | ||||
-rw-r--r-- | src/text.h | 3 |
7 files changed, 43 insertions, 8 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ca9bf2d0b..9d4934b16 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1068,6 +1068,7 @@ SET(SRCS enums/simpletypes/keep.h enums/simpletypes/modal.h enums/simpletypes/modifiable.h + enums/simpletypes/move.h enums/simpletypes/notify.h enums/simpletypes/npcnames.h enums/simpletypes/online.h diff --git a/src/Makefile.am b/src/Makefile.am index 44c4d1750..e97f60e9e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1197,6 +1197,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ enums/simpletypes/keep.h \ enums/simpletypes/modal.h \ enums/simpletypes/modifiable.h \ + enums/simpletypes/move.h \ enums/simpletypes/notify.h \ enums/simpletypes/npcnames.h \ enums/simpletypes/online.h \ diff --git a/src/being/being.cpp b/src/being/being.cpp index 9c820f0c5..a4ffbbf3f 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -117,7 +117,7 @@ bool Being::mShowLevel = false; bool Being::mShowPlayersStatus = false; bool Being::mEnableReorderSprites = true; bool Being::mHideErased = false; -bool Being::mMoveNames = false; +Move Being::mMoveNames = Move_false; bool Being::mUseDiagonal = true; int Being::mAwayEffect = -1; @@ -457,8 +457,9 @@ void Being::setPosition(const Vector &pos) if (mText) { - mText->adviseXY(static_cast<int>(pos.x), static_cast<int>(pos.y) - - getHeight() - mText->getHeight() - 6, mMoveNames); + mText->adviseXY(static_cast<int>(pos.x), + static_cast<int>(pos.y) - getHeight() - mText->getHeight() - 6, + mMoveNames); } } @@ -2333,7 +2334,7 @@ void Being::reReadConfig() mShowPlayersStatus = config.getBoolValue("showPlayersStatus"); mEnableReorderSprites = config.getBoolValue("enableReorderSprites"); mHideErased = config.getBoolValue("hideErased"); - mMoveNames = config.getBoolValue("moveNames"); + mMoveNames = fromBool(config.getBoolValue("moveNames"), Move); mUseDiagonal = config.getBoolValue("useDiagonalSpeed"); mUpdateConfigTime = cur_time; diff --git a/src/being/being.h b/src/being/being.h index 6fb26b620..03a69b986 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -23,6 +23,8 @@ #ifndef BEING_BEING_H #define BEING_BEING_H +#include "enums/simpletypes/move.h" + #include "resources/beinginfo.h" #include "position.h" @@ -1079,7 +1081,7 @@ class Being notfinal : public ActorSprite, static bool mShowPlayersStatus; static bool mEnableReorderSprites; static bool mHideErased; - static bool mMoveNames; + static Move mMoveNames; static bool mUseDiagonal; static int mAwayEffect; diff --git a/src/enums/simpletypes/move.h b/src/enums/simpletypes/move.h new file mode 100644 index 000000000..95c2ff4a0 --- /dev/null +++ b/src/enums/simpletypes/move.h @@ -0,0 +1,28 @@ +/* + * The ManaPlus Client + * Copyright (C) 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_SIMPLETYPES_MOVE_H +#define ENUMS_SIMPLETYPES_MOVE_H + +#include "enums/simpletypes/simpledefines.h" + +defBoolEnum(Move); + +#endif // ENUMS_SIMPLETYPES_MOVE_H diff --git a/src/text.cpp b/src/text.cpp index bec055f60..8dca7d366 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -134,9 +134,10 @@ void Text::setColor(const Color *const color) } } -void Text::adviseXY(const int x, const int y, const bool move) +void Text::adviseXY(const int x, const int y, + const Move move) { - if (textManager && move) + if (textManager && move == Move_true) { textManager->moveText(this, x - mXOffset, y); } diff --git a/src/text.h b/src/text.h index 916de924e..fc9b0f08c 100644 --- a/src/text.h +++ b/src/text.h @@ -24,6 +24,7 @@ #ifndef TEXT_H #define TEXT_H +#include "enums/simpletypes/move.h" #include "enums/simpletypes/speech.h" #include "gui/fonts/textchunk.h" @@ -67,7 +68,7 @@ class Text notfinal /** * Allows the originator of the text to specify the ideal coordinates. */ - void adviseXY(const int x, const int y, const bool move); + void adviseXY(const int x, const int y, const Move move); /** * Draws the text. |