summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
Diffstat (limited to 'src/being')
-rw-r--r--src/being/actorsprite.cpp23
-rw-r--r--src/being/actorsprite.h15
-rw-r--r--src/being/being.cpp4
-rw-r--r--src/being/being.h4
-rw-r--r--src/being/targetcursorsize.h36
5 files changed, 58 insertions, 24 deletions
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp
index eb695a0e2..6d5702da0 100644
--- a/src/being/actorsprite.cpp
+++ b/src/being/actorsprite.cpp
@@ -42,7 +42,7 @@
#include "debug.h"
-AnimatedSprite *ActorSprite::targetCursor[NUM_TCT][NUM_TC];
+AnimatedSprite *ActorSprite::targetCursor[NUM_TCT][TargetCursorSize::NUM_TC];
bool ActorSprite::loaded = false;
ActorSprite::ActorSprite(const int id) :
@@ -144,12 +144,13 @@ void ActorSprite::setTargetType(const TargetCursorType type)
}
else
{
- const TargetCursorSize sz = getTargetCursorSize();
+ const TargetCursorSize::Size sz = getTargetCursorSize();
mUsedTargetCursor = targetCursor[static_cast<int>(type)][sz];
if (mUsedTargetCursor)
{
- static const int targetWidths[ActorSprite::NUM_TC] = {0, 0, 0};
- static const int targetHeights[ActorSprite::NUM_TC]
+ static const int targetWidths[TargetCursorSize::NUM_TC]
+ = {0, 0, 0};
+ static const int targetHeights[TargetCursorSize::NUM_TC]
= {-mapTileSize / 2, -mapTileSize / 2, -mapTileSize};
mCursorPaddingX = static_cast<int>(targetWidths[sz]);
@@ -345,12 +346,12 @@ static const char *cursorSize(const int size)
{
switch (size)
{
- case ActorSprite::TC_LARGE:
+ case TargetCursorSize::LARGE:
return "l";
- case ActorSprite::TC_MEDIUM:
+ case TargetCursorSize::MEDIUM:
return "m";
default:
- case ActorSprite::TC_SMALL:
+ case TargetCursorSize::SMALL:
return "s";
}
}
@@ -360,7 +361,9 @@ void ActorSprite::initTargetCursor()
static const std::string targetCursorFile("target-cursor-%s-%s.xml");
// Load target cursors
- for (int size = TC_SMALL; size < NUM_TC; size++)
+ for (int size = TargetCursorSize::SMALL;
+ size < TargetCursorSize::NUM_TC;
+ size ++)
{
for (int type = TCT_NORMAL; type < NUM_TCT; type++)
{
@@ -375,7 +378,9 @@ void ActorSprite::initTargetCursor()
void ActorSprite::cleanupTargetCursors()
{
- for (int size = TC_SMALL; size < NUM_TC; size++)
+ for (int size = TargetCursorSize::SMALL;
+ size < TargetCursorSize::NUM_TC;
+ size ++)
{
for (int type = TCT_NORMAL; type < NUM_TCT; type++)
{
diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h
index 5b9c438d8..b646500da 100644
--- a/src/being/actorsprite.h
+++ b/src/being/actorsprite.h
@@ -30,6 +30,7 @@
#include "being/actor.h"
#include "being/actortype.h"
#include "being/compoundsprite.h"
+#include "being/targetcursorsize.h"
#include "particle/particlecontainer.h"
@@ -45,14 +46,6 @@ class ActorSpriteListener;
class ActorSprite : public CompoundSprite, public Actor
{
public:
- enum TargetCursorSize
- {
- TC_SMALL = 0,
- TC_MEDIUM,
- TC_LARGE,
- NUM_TC
- };
-
enum TargetCursorType
{
TCT_NONE = -1,
@@ -103,8 +96,8 @@ public:
/**
* Returns the required size of a target cursor for this being.
*/
- virtual TargetCursorSize getTargetCursorSize() const A_WARN_UNUSED
- { return TC_MEDIUM; }
+ virtual TargetCursorSize::Size getTargetCursorSize() const A_WARN_UNUSED
+ { return TargetCursorSize::MEDIUM; }
virtual int getTargetOffsetX() const A_WARN_UNUSED
{ return 0; }
@@ -225,7 +218,7 @@ private:
static void cleanupTargetCursors();
/** Animated target cursors. */
- static AnimatedSprite *targetCursor[NUM_TCT][NUM_TC];
+ static AnimatedSprite *targetCursor[NUM_TCT][TargetCursorSize::NUM_TC];
static bool loaded;
diff --git a/src/being/being.cpp b/src/being/being.cpp
index a494df61e..a2be3a071 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -345,10 +345,10 @@ void Being::setSubtype(const uint16_t subtype, const uint8_t look)
}
}
-ActorSprite::TargetCursorSize Being::getTargetCursorSize() const
+TargetCursorSize::Size Being::getTargetCursorSize() const
{
if (!mInfo)
- return ActorSprite::TC_SMALL;
+ return TargetCursorSize::SMALL;
return mInfo->getTargetCursorSize();
}
diff --git a/src/being/being.h b/src/being/being.h
index dfa920e68..e01c7b08e 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -390,8 +390,8 @@ class Being : public ActorSprite, public ConfigListener
const BeingInfo *getInfo() const A_WARN_UNUSED
{ return mInfo; }
- TargetCursorSize getTargetCursorSize() const override final
- A_WARN_UNUSED;
+ TargetCursorSize::Size getTargetCursorSize() const override final
+ A_WARN_UNUSED;
int getTargetOffsetX() const A_WARN_UNUSED
{
diff --git a/src/being/targetcursorsize.h b/src/being/targetcursorsize.h
new file mode 100644
index 000000000..655fd6acd
--- /dev/null
+++ b/src/being/targetcursorsize.h
@@ -0,0 +1,36 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2010 The Mana Developers
+ * Copyright (C) 2011-2014 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 BEING_TARGETCURSORSIZE_H
+#define BEING_TARGETCURSORSIZE_H
+
+namespace TargetCursorSize
+{
+ enum Size
+ {
+ SMALL = 0,
+ MEDIUM,
+ LARGE,
+ NUM_TC
+ };
+} // TargetCursorSize
+
+#endif // BEING_TARGETCURSORSIZE_H