summaryrefslogtreecommitdiff
path: root/src/resources/mapreader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/mapreader.cpp')
-rw-r--r--src/resources/mapreader.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index db53e6518..f81741227 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -24,7 +24,9 @@
#include "client.h"
#include "configuration.h"
+#include "graphicsmanager.h"
#include "logger.h"
+#include "main.h"
#include "map.h"
#include "maplayer.h"
#include "tileset.h"
@@ -252,6 +254,7 @@ Map *MapReader::readMap(XmlNodePtr node, const std::string &path)
// Take the filename off the path
const std::string pathDir = path.substr(0, path.rfind("/") + 1);
+ const std::string fileName = path.substr(path.rfind("/") + 1);
const int w = XML::getProperty(node, "width", 0);
const int h = XML::getProperty(node, "height", 0);
@@ -272,6 +275,15 @@ Map *MapReader::readMap(XmlNodePtr node, const std::string &path)
Map *const map = new Map(w, h, tilew, tileh);
+#ifdef USE_OPENGL
+ if (graphicsManager.getUseAtlases())
+ {
+ const MapDB::MapInfo *const info = MapDB::getMapAtlas(fileName);
+ map->setAtlas(ResourceManager::getInstance()->getAtlas(
+ info->atlas, *info->files));
+ }
+#endif
+
for_each_xml_child_node(childNode, node)
{
if (xmlNameEqual(childNode, "tileset"))