summaryrefslogtreecommitdiff
path: root/src/resources/resourcemanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-03-12 13:32:49 +0300
committerAndrei Karas <akaras@inbox.ru>2013-03-17 14:53:41 +0300
commit8571843f1405e676142e7bb289f9879d10a888ed (patch)
treee414c90b31979372220fa5c78f9ebb6cc05cd024 /src/resources/resourcemanager.cpp
parent3d8682618f0b46a334f9db5dd0c780f671e7f072 (diff)
downloadmv-8571843f1405e676142e7bb289f9879d10a888ed.tar.gz
mv-8571843f1405e676142e7bb289f9879d10a888ed.tar.bz2
mv-8571843f1405e676142e7bb289f9879d10a888ed.tar.xz
mv-8571843f1405e676142e7bb289f9879d10a888ed.zip
add walkmaps support.
Fast detecting between two targets is they in same walkable area.
Diffstat (limited to 'src/resources/resourcemanager.cpp')
-rw-r--r--src/resources/resourcemanager.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 9a4d1c3f1..43092e28d 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -26,6 +26,9 @@
#include "client.h"
#include "configuration.h"
#include "logger.h"
+#include "map.h"
+#include "navigationmanager.h"
+#include "walklayer.h"
#include "resources/atlasmanager.h"
#include "resources/dye.h"
@@ -740,6 +743,31 @@ Resource *ResourceManager::getAtlas(const std::string &name,
}
#endif
+struct WalkLayerLoader
+{
+ const std::string name;
+ Map *map;
+
+ static Resource *load(const void *const v)
+ {
+ if (!v)
+ return nullptr;
+
+ const WalkLayerLoader *const rl = static_cast<const
+ WalkLayerLoader *const>(v);
+ Resource *const resource = NavigationManager::loadWalkLayer(rl->map);
+ return resource;
+ }
+};
+
+WalkLayer *ResourceManager::getWalkLayer(const std::string &name,
+ Map *const map)
+{
+ WalkLayerLoader rl = {name, map};
+ return static_cast<WalkLayer*>(get("map_" + name,
+ WalkLayerLoader::load, &rl));
+}
+
struct SpriteDefLoader
{
std::string path;