summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-29 23:24:05 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-29 23:24:05 +0300
commitc593adb7fb0dffc62f1311e6c52f25bfafcdf0f4 (patch)
treefc89a0dde74c24d2876cf5833ff1d42d3ffd8c51 /src
parente9b375927f271808d507c5a95443d460bbd6ce92 (diff)
downloadmanaverse-c593adb7fb0dffc62f1311e6c52f25bfafcdf0f4.tar.gz
manaverse-c593adb7fb0dffc62f1311e6c52f25bfafcdf0f4.tar.bz2
manaverse-c593adb7fb0dffc62f1311e6c52f25bfafcdf0f4.tar.xz
manaverse-c593adb7fb0dffc62f1311e6c52f25bfafcdf0f4.zip
Convert BeingAction enum into strong typed enum.
Diffstat (limited to 'src')
-rw-r--r--src/being/being.cpp2
-rw-r--r--src/being/being.h6
-rw-r--r--src/being/localplayer.cpp6
-rw-r--r--src/being/localplayer.h4
-rw-r--r--src/enums/being/beingaction.h31
-rw-r--r--src/gui/windows/charcreatedialog.cpp2
-rw-r--r--src/gui/windows/npcdialog.cpp2
-rw-r--r--src/net/eathena/playerhandler.cpp2
-rw-r--r--src/net/eathena/playerhandler.h2
-rw-r--r--src/net/playerhandler.h2
-rw-r--r--src/net/tmwa/playerhandler.cpp2
-rw-r--r--src/net/tmwa/playerhandler.h2
12 files changed, 29 insertions, 34 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 947e98fb6..7c250aac3 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -1263,7 +1263,7 @@ getSpriteAction(Dead, DEAD)
getSpriteAction(Stand, STAND)
getSpriteAction(Spawn, SPAWN)
-void Being::setAction(const BeingAction::Action &action, const int attackId)
+void Being::setAction(const BeingActionT &action, const int attackId)
{
std::string currentAction = SpriteAction::INVALID;
diff --git a/src/being/being.h b/src/being/being.h
index 83ca7785a..d21ad8acc 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -438,13 +438,13 @@ class Being notfinal : public ActorSprite,
/**
* Sets the current action.
*/
- virtual void setAction(const BeingAction::Action &action,
+ virtual void setAction(const BeingActionT &action,
const int attackType);
/**
* Get the being's action currently performed.
*/
- BeingAction::Action getCurrentAction() const A_WARN_UNUSED
+ BeingActionT getCurrentAction() const A_WARN_UNUSED
{ return mAction; }
/**
@@ -996,7 +996,7 @@ class Being notfinal : public ActorSprite,
int mPreStandTime;
Gender::Type mGender;
- BeingAction::Action mAction;
+ BeingActionT mAction;
BeingTypeId mSubType; /**< Subtype (graphical view, basically) */
uint8_t mDirection; /**< Facing direction */
uint8_t mDirectionDelayed; /**< Facing direction */
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 1374eefab..4ad43b098 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -372,7 +372,7 @@ void LocalPlayer::slowLogic()
BLOCK_END("LocalPlayer::slowLogic")
}
-void LocalPlayer::setAction(const BeingAction::Action &action,
+void LocalPlayer::setAction(const BeingActionT &action,
const int attackType)
{
if (action == BeingAction::DEAD)
@@ -691,7 +691,7 @@ bool LocalPlayer::toggleSit() const
if (!PacketLimiter::limitPackets(PACKET_SIT))
return false;
- BeingAction::Action newAction;
+ BeingActionT newAction;
switch (mAction)
{
case BeingAction::STAND:
@@ -2241,7 +2241,7 @@ void LocalPlayer::imitateEmote(const Being *const being,
}
void LocalPlayer::imitateAction(const Being *const being,
- const BeingAction::Action &action)
+ const BeingActionT &action)
{
if (!being)
return;
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index 84089984e..e64f8fd58 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -71,7 +71,7 @@ class LocalPlayer final : public Being,
void slowLogic();
- void setAction(const BeingAction::Action &action,
+ void setAction(const BeingActionT &action,
const int attackType = 0) override final;
/**
@@ -250,7 +250,7 @@ class LocalPlayer final : public Being,
const unsigned char emote) const;
void imitateAction(const Being *const being,
- const BeingAction::Action &action);
+ const BeingActionT &action);
void imitateDirection(const Being *const being,
const unsigned char dir);
diff --git a/src/enums/being/beingaction.h b/src/enums/being/beingaction.h
index 408051d74..51b3e4e2d 100644
--- a/src/enums/being/beingaction.h
+++ b/src/enums/being/beingaction.h
@@ -23,24 +23,19 @@
#ifndef ENUMS_BEING_BEINGACTION_H
#define ENUMS_BEING_BEINGACTION_H
-namespace BeingAction
+#include "enums/simpletypes/enumdefines.h"
+
+enumStart(BeingAction)
{
- /**
- * Action the being is currently performing
- * WARNING: Has to be in sync with the same enum in the Being class
- * of the server!
- */
- enum Action
- {
- STAND = 0,
- MOVE,
- ATTACK,
- SIT,
- DEAD,
- HURT,
- SPAWN,
- PRESTAND
- };
-} // namespace BeingAction
+ STAND = 0,
+ MOVE,
+ ATTACK,
+ SIT,
+ DEAD,
+ HURT,
+ SPAWN,
+ PRESTAND
+}
+enumEnd(BeingAction);
#endif // ENUMS_BEING_BEINGACTION_H
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp
index f37749756..8ccd127c6 100644
--- a/src/gui/windows/charcreatedialog.cpp
+++ b/src/gui/windows/charcreatedialog.cpp
@@ -55,7 +55,7 @@
#undef ERROR
-static const BeingAction::Action actions[] =
+static const BeingActionT actions[] =
{
BeingAction::STAND,
BeingAction::SIT,
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index ebc716d0f..de485d6f1 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -920,7 +920,7 @@ void NpcDialog::setAvatarAction(const int actionId)
{
Being *const being = mPlayerBox->getBeing();
if (being)
- being->setAction(static_cast<BeingAction::Action>(actionId), 0);
+ being->setAction(static_cast<BeingActionT>(actionId), 0);
}
void NpcDialog::logic()
diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp
index f2627c605..83cbec9ba 100644
--- a/src/net/eathena/playerhandler.cpp
+++ b/src/net/eathena/playerhandler.cpp
@@ -277,7 +277,7 @@ void PlayerHandler::setDestination(const int x, const int y,
static_cast<unsigned char>(direction), "destination");
}
-void PlayerHandler::changeAction(const BeingAction::Action &action) const
+void PlayerHandler::changeAction(const BeingActionT &action) const
{
unsigned char type;
switch (action)
diff --git a/src/net/eathena/playerhandler.h b/src/net/eathena/playerhandler.h
index 49572f0b1..5207b4ce7 100644
--- a/src/net/eathena/playerhandler.h
+++ b/src/net/eathena/playerhandler.h
@@ -51,7 +51,7 @@ class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler
void setDirection(const unsigned char direction) const override final;
void setDestination(const int x, const int y,
const int direction) const override final;
- void changeAction(const BeingAction::Action &action)
+ void changeAction(const BeingActionT &action)
const override final;
void updateStatus(const uint8_t status) const override final;
diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h
index 6f31cf7ac..3cb104d2c 100644
--- a/src/net/playerhandler.h
+++ b/src/net/playerhandler.h
@@ -63,7 +63,7 @@ class PlayerHandler notfinal
virtual void setDestination(const int x, const int y,
const int direction) const = 0;
- virtual void changeAction(const BeingAction::Action &action) const = 0;
+ virtual void changeAction(const BeingActionT &action) const = 0;
virtual void respawn() const = 0;
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index d2871a456..8a730db8f 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -194,7 +194,7 @@ void PlayerHandler::setDestination(const int x, const int y,
static_cast<unsigned char>(direction), "destination");
}
-void PlayerHandler::changeAction(const BeingAction::Action &action) const
+void PlayerHandler::changeAction(const BeingActionT &action) const
{
char type;
switch (action)
diff --git a/src/net/tmwa/playerhandler.h b/src/net/tmwa/playerhandler.h
index d831d7ab3..f4e9e1e44 100644
--- a/src/net/tmwa/playerhandler.h
+++ b/src/net/tmwa/playerhandler.h
@@ -51,7 +51,7 @@ class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler
void setDirection(const unsigned char direction) const override final;
void setDestination(const int x, const int y,
const int direction) const override final;
- void changeAction(const BeingAction::Action &action)
+ void changeAction(const BeingActionT &action)
const override final;
void requestOnlineList() const override final;
void updateStatus(const uint8_t status) const override final;