summaryrefslogtreecommitdiff
path: root/src/resources/db
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-04-20 22:58:11 +0300
committerAndrei Karas <akaras@inbox.ru>2018-04-20 22:58:11 +0300
commitea82328250b5b134da350f5bacbd7ee57730ba6b (patch)
tree2d02eec7524ce69bc12f5bede7f409f3d29cb209 /src/resources/db
parente7f9514cab45863edf6a613ef8563bb15ff66e96 (diff)
downloadmanaplus-ea82328250b5b134da350f5bacbd7ee57730ba6b.tar.gz
manaplus-ea82328250b5b134da350f5bacbd7ee57730ba6b.tar.bz2
manaplus-ea82328250b5b134da350f5bacbd7ee57730ba6b.tar.xz
manaplus-ea82328250b5b134da350f5bacbd7ee57730ba6b.zip
Dont put on maps tiles from empty atlases.
Before in wrong maps and OpenGL enabled modes, manaplus may show artifacts, because tiles from empty atlases really is not loaded and drawed.
Diffstat (limited to 'src/resources/db')
-rw-r--r--src/resources/db/mapdb.cpp17
-rw-r--r--src/resources/db/mapdb.h2
2 files changed, 18 insertions, 1 deletions
diff --git a/src/resources/db/mapdb.cpp b/src/resources/db/mapdb.cpp
index 0ca328dcf..971fa4578 100644
--- a/src/resources/db/mapdb.cpp
+++ b/src/resources/db/mapdb.cpp
@@ -34,6 +34,7 @@ namespace
MapDB::Maps mMaps;
MapDB::MapInfos mInfos;
MapDB::Atlases mAtlases;
+ std::set<std::string> mEmptyTilesets;
} // namespace
namespace MapDB
@@ -137,7 +138,16 @@ void MapDB::readAtlas(XmlNodePtrConst node)
mAtlases[atlas].push_back(file);
}
}
- if (atlas != "all" && atlas != paths.getStringValue("emptyAtlasName"))
+ if (atlas == paths.getStringValue("emptyAtlasName"))
+ {
+ const StringVect *files = &mAtlases[atlas];
+ FOR_EACHP (StringVectCIter, it, files)
+ {
+ mEmptyTilesets.insert(*it);
+ logger->log("empty tileset: " + *it);
+ }
+ }
+ else if (atlas != "all")
{
const AtlasCIter &allAtlas = mAtlases.find("all");
if (allAtlas != mAtlases.end())
@@ -223,3 +233,8 @@ const MapInfo *MapDB::getAtlas(const std::string &name)
info->files = &(*it).second;
return info;
}
+
+bool MapDB::isEmptyTileset(const std::string &name)
+{
+ return mEmptyTilesets.find(name) != mEmptyTilesets.end();
+}
diff --git a/src/resources/db/mapdb.h b/src/resources/db/mapdb.h
index 97a8f0cb1..e7ccf972c 100644
--- a/src/resources/db/mapdb.h
+++ b/src/resources/db/mapdb.h
@@ -57,6 +57,8 @@ namespace MapDB
const MapInfo *getAtlas(const std::string &name) A_WARN_UNUSED;
+ bool isEmptyTileset(const std::string &name);
+
// Maps DB
typedef std::map<std::string, std::string> Maps;
typedef Maps::iterator MapIterator;