summaryrefslogtreecommitdiff
path: root/src/resources/mapreader.cpp
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/mapreader.cpp
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/mapreader.cpp')
-rw-r--r--src/resources/mapreader.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index e5e7374fe..9393e781b 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -565,10 +565,18 @@ inline static void setTile(Map *const map,
{
case MapLayerType::TILES:
{
- Image *const img = set != nullptr ?
- set->get(gid - set->getFirstGid()) : nullptr;
- if (layer != nullptr)
+ if (layer == nullptr)
+ break;
+ if (set != nullptr &&
+ !set->isEmpty())
+ {
+ Image *const img = set->get(gid - set->getFirstGid());
layer->setTile(x, y, img);
+ }
+ else
+ {
+ layer->setTile(x, y, nullptr);
+ }
break;
}
@@ -1112,10 +1120,12 @@ Tileset *MapReader::readTileset(XmlNodePtr node,
const std::string source = XML::getProperty(
childNode, "source", "");
+ const std::string sourceResolved = resolveRelativePath(pathDir,
+ source);
+
if (!source.empty())
{
- Image *const tilebmp = Loader::getImage(
- resolveRelativePath(pathDir, source));
+ Image *const tilebmp = Loader::getImage(sourceResolved);
if (tilebmp != nullptr)
{
@@ -1126,6 +1136,8 @@ Tileset *MapReader::readTileset(XmlNodePtr node,
spacing);
tilebmp->decRef();
#ifdef USE_OPENGL
+ if (MapDB::isEmptyTileset(sourceResolved))
+ set->setEmpty(true);
if (tilebmp->getType() == ImageType::Image &&
map->haveAtlas() == true &&
graphicsManager.getUseAtlases())