summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2006-12-30 17:19:33 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2006-12-30 17:19:33 +0000
commit3c0af406c2b8d74558e236f9f99862ea0e33bf4a (patch)
tree0018d3d7f6d03c07570c36ecaa5818929b2c90e6
parent7a6bef223e5267eb377e39881de946251f7c7924 (diff)
downloadmanaserv-3c0af406c2b8d74558e236f9f99862ea0e33bf4a.tar.gz
manaserv-3c0af406c2b8d74558e236f9f99862ea0e33bf4a.tar.bz2
manaserv-3c0af406c2b8d74558e236f9f99862ea0e33bf4a.tar.xz
manaserv-3c0af406c2b8d74558e236f9f99862ea0e33bf4a.zip
Just for fun: a trigger to change map.
-rw-r--r--src/game-server/mapcomposite.hpp6
-rw-r--r--src/game-server/state.cpp29
2 files changed, 35 insertions, 0 deletions
diff --git a/src/game-server/mapcomposite.hpp b/src/game-server/mapcomposite.hpp
index 84fbb2d0..84599d39 100644
--- a/src/game-server/mapcomposite.hpp
+++ b/src/game-server/mapcomposite.hpp
@@ -188,6 +188,12 @@ class MapComposite {
*/
ZoneIterator getAroundPlayerIterator(Player *, int radius) const;
+ /**
+ * Gets all the objects on the map.
+ */
+ Objects const &getObjects() const
+ { return objects; }
+
private:
MapComposite(MapComposite const &);
diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp
index f4eb75d5..5fade89a 100644
--- a/src/game-server/state.cpp
+++ b/src/game-server/state.cpp
@@ -242,6 +242,35 @@ void State::update()
static_cast< Being * >(o)->clearHitsTaken();
}
}
+
+ // Just for fun. Should be replaced by a real trigger system.
+ for (size_t i = map->getObjects().size(); i-- > 0;)
+ {
+ Object *o = map->getObjects()[i];
+ if (o->getType() != OBJECT_PLAYER) continue;
+ Point pos = o->getPosition();
+ int x = pos.x / 32, y = pos.y / 32;
+ int m = 0;
+ switch (o->getMapId())
+ {
+ case 1:
+ if (x >= 56 && x <= 60 && y == 12)
+ { m = 3; x = 44; y = 80; }
+ break;
+ case 3:
+ if (x >= 42 && x <= 46 && y == 88)
+ { m = 1; x = 58; y = 17; }
+ break;
+ }
+ if (m != 0)
+ {
+ removeObject(o);
+ o->setMapId(m);
+ pos.x = x * 32; pos.y = y * 32;
+ o->setPosition(pos);
+ addObject(o);
+ }
+ }
}
}