summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-10-28 14:30:31 +0300
committerAndrei Karas <akaras@inbox.ru>2013-10-28 14:30:31 +0300
commit462867b1d99cf63a27566449cbf8f0feda7f1ec6 (patch)
tree3d4a159827bc5af72a2c5aedc89698fee44033c2
parentbc27e1bc29ab07a8560db30355ca3aeb3cfb724f (diff)
downloadmv-462867b1d99cf63a27566449cbf8f0feda7f1ec6.tar.gz
mv-462867b1d99cf63a27566449cbf8f0feda7f1ec6.tar.bz2
mv-462867b1d99cf63a27566449cbf8f0feda7f1ec6.tar.xz
mv-462867b1d99cf63a27566449cbf8f0feda7f1ec6.zip
Revert "Remove setMap from being constructor."
This reverts commit 9cf563fa7f4059bfddd82efdaa89df2ed07a6d7c.
-rw-r--r--src/actormanager.cpp4
-rw-r--r--src/being/being.cpp4
-rw-r--r--src/being/being.h4
-rw-r--r--src/being/localplayer.cpp2
-rw-r--r--src/gui/windows/charcreatedialog.cpp3
-rw-r--r--src/gui/windows/npcdialog.cpp2
6 files changed, 12 insertions, 7 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index 694b1de36..f37cc9a18 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -238,8 +238,8 @@ Being *ActorManager::createBeing(const int id,
const ActorSprite::Type type,
const uint16_t subtype)
{
- Being *const being = new Being(id, type, subtype);
- being->setMap(mMap);
+ Being *const being = new Being(id, type, subtype, mMap);
+
mActors.insert(being);
return being;
}
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 4745f516e..fdd706bbe 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -99,7 +99,8 @@ std::list<BeingCacheEntry*> beingInfoCache;
typedef std::map<int, Guild*>::const_iterator GuildsMapCIter;
typedef std::map<int, int>::const_iterator IntMapCIter;
-Being::Being(const int id, const Type type, const uint16_t subtype) :
+Being::Being(const int id, const Type type, const uint16_t subtype,
+ Map *const map) :
ActorSprite(id),
mNextSound(),
mInfo(BeingInfo::unknown),
@@ -189,6 +190,7 @@ Being::Being(const int id, const Type type, const uint16_t subtype) :
mSpriteHide[f] = 0;
}
+ setMap(map);
setSubtype(subtype, 0);
if (mType == PLAYER)
diff --git a/src/being/being.h b/src/being/being.h
index 90a351af0..313a92c2d 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -155,8 +155,10 @@ class Being : public ActorSprite, public ConfigListener
*
* @param id a unique being id
* @param subtype partly determines the type of the being
+ * @param map the map the being is on
*/
- Being(const int id, const Type type, const uint16_t subtype);
+ Being(const int id, const Type type, const uint16_t subtype,
+ Map *const map);
A_DELETE_COPY(Being)
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 17424e6a8..6df48dec7 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -88,7 +88,7 @@ extern MiniStatusWindow *miniStatusWindow;
extern SkillDialog *skillDialog;
LocalPlayer::LocalPlayer(const int id, const int subtype) :
- Being(id, PLAYER, subtype),
+ Being(id, PLAYER, subtype, nullptr),
mGMLevel(0),
mInvertDirection(0),
mCrazyMoveType(config.getIntValue("crazyMoveType")),
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp
index d23a40f7a..5164c89b6 100644
--- a/src/gui/windows/charcreatedialog.cpp
+++ b/src/gui/windows/charcreatedialog.cpp
@@ -121,7 +121,8 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
mLook(0),
mMinLook(CharDB::getMinLook()),
mMaxLook(CharDB::getMaxLook()),
- mPlayer(new Being(0, ActorSprite::PLAYER, static_cast<uint16_t>(mRace))),
+ mPlayer(new Being(0, ActorSprite::PLAYER, static_cast<uint16_t>(mRace),
+ nullptr)),
mPlayerBox(new PlayerBox(mPlayer, "charcreate_playerbox.xml",
"charcreate_selectedplayerbox.xml")),
mHairStyle(0),
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index 9192b66b9..3b5d0d772 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -851,7 +851,7 @@ void NpcDialog::showAvatar(const uint16_t avatarId)
if (needShow)
{
delete mAvatarBeing;
- mAvatarBeing = new Being(0, ActorSprite::AVATAR, avatarId);
+ mAvatarBeing = new Being(0, ActorSprite::AVATAR, avatarId, nullptr);
mPlayerBox->setPlayer(mAvatarBeing);
if (!mAvatarBeing->empty())
{