summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/popupmenu.cpp6
-rw-r--r--src/localplayer.cpp12
-rw-r--r--src/localplayer.h7
3 files changed, 22 insertions, 3 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 9048c53b2..9577d6107 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -1090,11 +1090,17 @@ void PopupMenu::handleLink(const std::string &link,
SpecialLayer *specialLayer = map->getSpecialLayer();
if (specialLayer)
{
+ bool isHome = (mMapItem->getType() == MapItem::HOME);
const int x = mMapItem->getX();
const int y = mMapItem->getY();
specialLayer->setTile(x, y, MapItem::EMPTY);
if (socialWindow)
socialWindow->removePortal(x, y);
+ if (isHome && player_node)
+ {
+ player_node->removeHome();
+ player_node->saveHomes();
+ }
}
}
}
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 2a3048a3d..544c67f97 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -3856,6 +3856,18 @@ unsigned char LocalPlayer::getWalkMask() const
return Map::BLOCKMASK_WALL | Map::BLOCKMASK_AIR | Map::BLOCKMASK_WATER;
}
+void LocalPlayer::removeHome()
+{
+ if (!mMap)
+ return;
+
+ std::string key = mMap->getProperty("_realfilename");
+ std::map<std::string, Vector>::iterator iter = mHomes.find(key);
+
+ if (iter != mHomes.end())
+ mHomes.erase(key);
+}
+
void AwayListener::action(const gcn::ActionEvent &event)
{
if (event.getId() == "ok" && player_node && player_node->getAwayMode())
diff --git a/src/localplayer.h b/src/localplayer.h
index d3a166d85..a5d5563cf 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -459,6 +459,10 @@ class LocalPlayer : public Being, public ActorSpriteListener,
virtual unsigned char getWalkMask() const;
+ void saveHomes();
+
+ void removeHome();
+
protected:
/** Whether or not the name settings have changed */
bool mUpdateName;
@@ -485,8 +489,6 @@ class LocalPlayer : public Being, public ActorSpriteListener,
void loadHomes();
- void saveHomes();
-
bool mInStorage; /**< Whether storage is currently accessible */
int mAttackRange;
@@ -494,7 +496,6 @@ class LocalPlayer : public Being, public ActorSpriteListener,
int mTargetTime; /** How long the being has been targeted **/
int mLastTarget; /** Time stamp of last targeting action,
-1 if none. */
-
int mGMLevel;
//move type