summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/localplayer.cpp2
-rw-r--r--src/map.cpp8
-rw-r--r--src/map.h9
-rw-r--r--src/resources/mapreader.cpp3
4 files changed, 21 insertions, 1 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 69e2572e1..f204164ee 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -4055,6 +4055,8 @@ void LocalPlayer::setRealPos(int x, int y)
mCrossX = x;
mCrossY = y;
}
+ if (mMap && mMap->isCustom())
+ mMap->setWalk(x, y, true);
}
void LocalPlayer::fixAttackTarget()
{
diff --git a/src/map.cpp b/src/map.cpp
index 0530b2702..f252308b6 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -151,7 +151,8 @@ Map::Map(int width, int height, int tileWidth, int tileHeight):
mDrawScrollX(-1),
mDrawScrollY(-1),
mRedrawMap(true),
- mBeingOpacity(false)
+ mBeingOpacity(false),
+ mCustom(false)
{
const int size = mWidth * mHeight;
for (int i = 0; i < NB_BLOCKTYPES; i++)
@@ -659,6 +660,11 @@ bool Map::getWalk(int x, int y, unsigned char walkmask) const
return !(mMetaTiles[x + y * mWidth].blockmask & walkmask);
}
+void Map::setWalk(int x, int y, bool walkable)
+{
+ blockTile(x, y, Map::BLOCKTYPE_GROUNDTOP);
+}
+
bool Map::occupied(int x, int y) const
{
const ActorSprites &actors = actorSpriteManager->getAll();
diff --git a/src/map.h b/src/map.h
index 3f9df9f95..44eb63979 100644
--- a/src/map.h
+++ b/src/map.h
@@ -219,6 +219,8 @@ class Map : public Properties, public ConfigListener
unsigned char walkmask = BLOCKMASK_WALL | BLOCKMASK_AIR
| BLOCKMASK_WATER) const;
+ void setWalk(int x, int y, bool walkable);
+
/**
* Tells whether a tile is occupied by a being.
*/
@@ -376,6 +378,12 @@ class Map : public Properties, public ConfigListener
bool empty() const
{ return mLayers.empty(); }
+ void setCustom(bool b)
+ { mCustom = b; }
+
+ bool isCustom()
+ { return mCustom; }
+
protected:
friend class Actor;
friend class Minimap;
@@ -483,6 +491,7 @@ class Map : public Properties, public ConfigListener
int mDrawScrollY;
bool mRedrawMap;
bool mBeingOpacity;
+ bool mCustom;
};
#endif
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 57524e953..67959b819 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -795,6 +795,9 @@ Map *MapReader::createEmptyMap(const std::string &filename,
{
logger->log("Creating empty map");
Map *map = new Map(300, 300, 32, 32);
+ map->setProperty("_filename", realFilename);
+ map->setProperty("_realfilename", filename);
+ map->setCustom(true);
MapLayer *layer = new MapLayer(0, 0, 300, 300, false);
map->addLayer(layer);
layer = new MapLayer(0, 0, 300, 300, true);