summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-04-29 13:23:51 +0300
committerAndrei Karas <akaras@inbox.ru>2013-04-29 21:10:19 +0300
commit95c7914cc3c87408f482e4f5f78bcc3642ada111 (patch)
treebc99a7d17e36d49f2c743feb3e940dc4d0372e89 /src/being.cpp
parent2b13a2f1f0daafe489b5a742962970e0ecedc8f4 (diff)
downloadplus-95c7914cc3c87408f482e4f5f78bcc3642ada111.tar.gz
plus-95c7914cc3c87408f482e4f5f78bcc3642ada111.tar.bz2
plus-95c7914cc3c87408f482e4f5f78bcc3642ada111.tar.xz
plus-95c7914cc3c87408f482e4f5f78bcc3642ada111.zip
split being.cpp to some files.
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp159
1 files changed, 2 insertions, 157 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 3ebfb77af..f06de55c7 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -24,22 +24,18 @@
#include "actorspritemanager.h"
#include "animatedsprite.h"
+#include "beingcacheentry.h"
+#include "beingequipbackend.h"
#include "client.h"
-#include "configuration.h"
#include "effectmanager.h"
-#include "graphics.h"
#include "guild.h"
-#include "item.h"
-#include "localplayer.h"
#include "particle.h"
#include "party.h"
#include "playerrelations.h"
-#include "simpleanimation.h"
#include "soundmanager.h"
#include "text.h"
#include "gui/equipmentwindow.h"
-#include "gui/gui.h"
#include "gui/socialwindow.h"
#include "gui/speechbubble.h"
#include "gui/sdlfont.h"
@@ -52,7 +48,6 @@
#include "net/npchandler.h"
#include "net/playerhandler.h"
-#include "resources/colordb.h"
#include "resources/emotedb.h"
#include "resources/iteminfo.h"
#include "resources/monsterdb.h"
@@ -60,7 +55,6 @@
#include "resources/petdb.h"
#include "resources/resourcemanager.h"
-#include "gui/widgets/chattab.h"
#include "gui/widgets/langtab.h"
#include "utils/gettext.h"
@@ -71,107 +65,6 @@
const unsigned int CACHE_SIZE = 50;
-class BeingCacheEntry final
-{
- public:
- explicit BeingCacheEntry(const int id):
- mId(id),
- mName(""),
- mPartyName(""),
- mGuildName(""),
- mLevel(0),
- mPvpRank(0),
- mTime(0),
- mIp(""),
- mIsAdvanced(false),
- mFlags(0)
- {
- }
-
- A_DELETE_COPY(BeingCacheEntry)
-
- int getId() const
- { return mId; }
-
- /**
- * Returns the name of the being.
- */
- const std::string &getName() const
- { return mName; }
-
- /**
- * Sets the name for the being.
- *
- * @param name The name that should appear.
- */
- void setName(const std::string &name)
- { mName = name; }
-
- /**
- * Following are set from the server (mainly for players)
- */
- void setPartyName(const std::string &name)
- { mPartyName = name; }
-
- void setGuildName(const std::string &name)
- { mGuildName = name; }
-
- const std::string &getPartyName() const
- { return mPartyName; }
-
- const std::string &getGuildName() const
- { return mGuildName; }
-
- void setLevel(const int n)
- { mLevel = n; }
-
- int getLevel() const
- { return mLevel; }
-
- void setTime(const int n)
- { mTime = n; }
-
- int getTime() const
- { return mTime; }
-
- unsigned getPvpRank() const
- { return mPvpRank; }
-
- void setPvpRank(const int r)
- { mPvpRank = r; }
-
- std::string getIp() const
- { return mIp; }
-
- void setIp(std::string ip)
- { mIp = ip; }
-
- bool isAdvanced() const
- { return mIsAdvanced; }
-
- void setAdvanced(const bool a)
- { mIsAdvanced = a; }
-
- int getFlags() const
- { return mFlags; }
-
- void setFlags(const int flags)
- { mFlags = flags; }
-
- protected:
- int mId; /**< Unique sprite id */
- std::string mName; /**< Name of character */
- std::string mPartyName;
- std::string mGuildName;
- int mLevel;
- unsigned int mPvpRank;
- int mTime;
- std::string mIp;
- bool mIsAdvanced;
- int mFlags;
-};
-
-
int Being::mNumberOfHairstyles = 1;
int Being::mNumberOfRaces = 1;
@@ -2990,51 +2883,3 @@ void Being::playSfx(const SoundInfo &sound, Being *const being,
soundManager.playSfx(sound.sound, x, y);
}
}
-
-BeingEquipBackend::BeingEquipBackend(Being *const being):
- mBeing(being)
-{
- memset(mEquipment, 0, sizeof(mEquipment));
- if (being)
- {
- const size_t sz = being->mSpriteIDs.size();
-
- for (unsigned f = 0; f < sz; f ++)
- {
- const int idx = Net::getInventoryHandler()->
- convertFromServerSlot(f);
- const int id = being->mSpriteIDs[f];
- if (id > 0 && idx >= 0 && idx < EQUIPMENT_SIZE)
- {
- mEquipment[idx] = new Item(id, 1, 0,
- being->mSpriteColorsIds[f], true, true);
- }
- }
- }
-}
-
-BeingEquipBackend::~BeingEquipBackend()
-{
- clear();
-}
-
-void BeingEquipBackend::clear()
-{
- for (int i = 0; i < EQUIPMENT_SIZE; i++)
- {
- delete mEquipment[i];
- mEquipment[i] = nullptr;
- }
-}
-
-void BeingEquipBackend::setEquipment(const int index, Item *const item)
-{
- mEquipment[index] = item;
-}
-
-Item *BeingEquipBackend::getEquipment(const int index) const
-{
- if (index < 0 || index >= EQUIPMENT_SIZE)
- return nullptr;
- return mEquipment[index];
-}