summaryrefslogtreecommitdiff
path: root/src/resources/mapreader.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-13 22:18:03 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-30 02:57:13 +0300
commit135c19b4337e1ab45cff40a306eadc52a061ddef (patch)
tree0a163ca1edd542aec5570b7e451034aafb4089dd /src/resources/mapreader.cpp
parent3a2bab265768c219b0c077eef10b69dfe8158131 (diff)
downloadplus-135c19b4337e1ab45cff40a306eadc52a061ddef.tar.gz
plus-135c19b4337e1ab45cff40a306eadc52a061ddef.tar.bz2
plus-135c19b4337e1ab45cff40a306eadc52a061ddef.tar.xz
plus-135c19b4337e1ab45cff40a306eadc52a061ddef.zip
add atlas textures support.
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"))