summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-12 17:29:22 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-12 17:29:22 +0300
commit707a1570df9146c42411afb6dd7b2e9bc11b0251 (patch)
tree590ecfdf2cde1908c2264ab5370a0495b7aa83b7 /src/being
parent81f319af0c6321474282de8928378366bbb6e44d (diff)
downloadmanaverse-707a1570df9146c42411afb6dd7b2e9bc11b0251.tar.gz
manaverse-707a1570df9146c42411afb6dd7b2e9bc11b0251.tar.bz2
manaverse-707a1570df9146c42411afb6dd7b2e9bc11b0251.tar.xz
manaverse-707a1570df9146c42411afb6dd7b2e9bc11b0251.zip
Move being flags into separate file.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp20
-rw-r--r--src/being/being.h12
-rw-r--r--src/being/beingflag.h37
-rw-r--r--src/being/localplayer.cpp14
4 files changed, 55 insertions, 28 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index e06190623..0e06d45fd 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -2167,9 +2167,9 @@ bool Being::updateFromCache()
if (mAdvanced)
{
const int flags = entry->getFlags();
- mShop = ((flags & FLAG_SHOP) != 0);
- mAway = ((flags & FLAG_AWAY) != 0);
- mInactive = ((flags & FLAG_INACTIVE) != 0);
+ mShop = ((flags & BeingFlag::SHOP) != 0);
+ mAway = ((flags & BeingFlag::AWAY) != 0);
+ mInactive = ((flags & BeingFlag::INACTIVE) != 0);
if (mShop || mAway || mInactive)
updateName();
}
@@ -2220,11 +2220,11 @@ void Being::addToCache() const
{
int flags = 0;
if (mShop)
- flags += FLAG_SHOP;
+ flags += BeingFlag::SHOP;
if (mAway)
- flags += FLAG_AWAY;
+ flags += BeingFlag::AWAY;
if (mInactive)
- flags += FLAG_INACTIVE;
+ flags += BeingFlag::INACTIVE;
entry->setFlags(flags);
}
else
@@ -2916,9 +2916,9 @@ void Being::saveComment(const std::string &restrict name,
void Being::setState(const uint8_t state)
{
- const bool shop = ((state & FLAG_SHOP) != 0);
- const bool away = ((state & FLAG_AWAY) != 0);
- const bool inactive = ((state & FLAG_INACTIVE) != 0);
+ const bool shop = ((state & BeingFlag::SHOP) != 0);
+ const bool away = ((state & BeingFlag::AWAY) != 0);
+ const bool inactive = ((state & BeingFlag::INACTIVE) != 0);
const bool needUpdate = (shop != mShop || away != mAway
|| inactive != mInactive);
@@ -2938,7 +2938,7 @@ void Being::setState(const uint8_t state)
void Being::setEmote(const uint8_t emotion, const int emote_time)
{
- if ((emotion & FLAG_SPECIAL) == FLAG_SPECIAL)
+ if ((emotion & BeingFlag::SPECIAL) == BeingFlag::SPECIAL)
{
setState(emotion);
mAdvanced = true;
diff --git a/src/being/being.h b/src/being/being.h
index c476e45b3..4de35303f 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -30,6 +30,7 @@
#include "listeners/configlistener.h"
#include "being/beingdirection.h"
+#include "being/beingflag.h"
#include "being/gender.h"
#include <map>
@@ -84,17 +85,6 @@ class Being : public ActorSprite, public ConfigListener
friend class BeingEquipBackend;
friend class LocalPlayer;
- enum FLAGS
- {
- FLAG_SHOP = 1,
- FLAG_AWAY = 2,
- FLAG_INACTIVE = 4,
- FLAG_GENDER_OTHER = 32,
- FLAG_GM = 64,
- FLAG_GENDER_MALE = 128,
- FLAG_SPECIAL = 128 + 64
- };
-
/**
* Action the being is currently performing
* WARNING: Has to be in sync with the same enum in the Being class
diff --git a/src/being/beingflag.h b/src/being/beingflag.h
new file mode 100644
index 000000000..9c9a76ef4
--- /dev/null
+++ b/src/being/beingflag.h
@@ -0,0 +1,37 @@
+/*
+ * The ManaPlus Client
+ * 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_BEINGFLAG_H
+#define BEING_BEINGFLAG_H
+
+namespace BeingFlag
+{
+ enum
+ {
+ SHOP = 1,
+ AWAY = 2,
+ INACTIVE = 4,
+ GENDER_OTHER = 32,
+ GM = 64,
+ GENDER_MALE = 128,
+ SPECIAL = 128 + 64
+ };
+}
+#endif // BEING_BEINGFLAG_H
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 283024243..800cd10a8 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -342,15 +342,15 @@ void LocalPlayer::slowLogic()
if (serverVersion < 4 && mEnableAdvert && !mBlockAdvert
&& mAdvertTime < cur_time)
{
- uint8_t smile = FLAG_SPECIAL;
+ uint8_t smile = BeingFlag::SPECIAL;
if (mTradebot && shopWindow && !shopWindow->isShopEmpty())
- smile |= FLAG_SHOP;
+ smile |= BeingFlag::SHOP;
if (mAwayMode || mPseudoAwayMode)
- smile |= FLAG_AWAY;
+ smile |= BeingFlag::AWAY;
if (mInactive)
- smile |= FLAG_INACTIVE;
+ smile |= BeingFlag::INACTIVE;
if (emote(smile))
mAdvertTime = time + 60;
@@ -3782,13 +3782,13 @@ void LocalPlayer::updateStatus() const
{
uint8_t status = 0;
if (mTradebot && shopWindow && !shopWindow->isShopEmpty())
- status |= FLAG_SHOP;
+ status |= BeingFlag::SHOP;
if (mAwayMode || mPseudoAwayMode)
- status |= FLAG_AWAY;
+ status |= BeingFlag::AWAY;
if (mInactive)
- status |= FLAG_INACTIVE;
+ status |= BeingFlag::INACTIVE;
Net::getPlayerHandler()->updateStatus(status);
}