summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-03-09 07:31:43 +0300
committerAndrei Karas <akaras@inbox.ru>2018-03-09 07:32:10 +0300
commitb624b0a4d6410134072c894d5686335c588a6c99 (patch)
tree655dda6e0f4ed4ac772a6150f8d3cd2a6ebaec9b
parentb406b1a7717af8fd479d39133df35fb331880b61 (diff)
downloadmanaplus-b624b0a4d6410134072c894d5686335c588a6c99.tar.gz
manaplus-b624b0a4d6410134072c894d5686335c588a6c99.tar.bz2
manaplus-b624b0a4d6410134072c894d5686335c588a6c99.tar.xz
manaplus-b624b0a4d6410134072c894d5686335c588a6c99.zip
Fix compilation without OpenGL.
-rw-r--r--src/gui/widgets/tabs/debugwindowtabs.cpp14
-rw-r--r--src/gui/widgets/tabs/debugwindowtabs.h2
-rw-r--r--src/resources/map/map.cpp6
-rw-r--r--src/resources/map/map.h18
4 files changed, 31 insertions, 9 deletions
diff --git a/src/gui/widgets/tabs/debugwindowtabs.cpp b/src/gui/widgets/tabs/debugwindowtabs.cpp
index e3d7d7498..d9a1e4c0e 100644
--- a/src/gui/widgets/tabs/debugwindowtabs.cpp
+++ b/src/gui/widgets/tabs/debugwindowtabs.cpp
@@ -67,9 +67,11 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) :
mMapActorCountLabel(new Label(this, strprintf("%s %d",
// TRANSLATORS: debug window label
_("Map actors count:"), 88888))),
+#ifdef USE_OPENGL
mMapAtlasCountLabel(new Label(this, strprintf("%s %d",
// TRANSLATORS: debug window label
_("Map atlas count:"), 88888))),
+#endif // USE_OPENGL
// TRANSLATORS: debug window label
mXYLabel(new Label(this, strprintf("%s (?,?)", _("Player Position:")))),
mTexturesLabel(nullptr),
@@ -144,11 +146,11 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) :
place(0, 7, mTileMouseLabel, 2, 1);
place(0, 8, mParticleCountLabel, 2, 1);
place(0, 9, mMapActorCountLabel, 2, 1);
- place(0, 10, mMapAtlasCountLabel, 2, 1);
#ifdef USE_OPENGL
+ place(0, 10, mMapAtlasCountLabel, 2, 1);
#if defined (DEBUG_OPENGL_LEAKS) || defined(DEBUG_DRAW_CALLS) \
|| defined(DEBUG_BIND_TEXTURE)
- int n = 10;
+ int n = 11;
#endif // defined (DEBUG_OPENGL_LEAKS) || defined(DEBUG_DRAW_CALLS)
// || defined(DEBUG_BIND_TEXTURE)
#ifdef DEBUG_OPENGL_LEAKS
@@ -225,11 +227,11 @@ void MapDebugTab::logic()
// TRANSLATORS: debug window label
strprintf("%s %d", _("Map actors count:"),
map->getActorsCount()));
+#ifdef USE_OPENGL
mMapAtlasCountLabel->setCaption(
// TRANSLATORS: debug window label
strprintf("%s %d", _("Map atlas count:"),
map->getAtlasCount()));
-#ifdef USE_OPENGL
#ifdef DEBUG_OPENGL_LEAKS
mTexturesLabel->setCaption(strprintf("%s %d",
// TRANSLATORS: debug window label
@@ -269,14 +271,18 @@ void MapDebugTab::logic()
mMapActorCountLabel->setCaption(
// TRANSLATORS: debug window label
strprintf("%s ?", _("Map actors count:")));
+#ifdef USE_OPENGL
mMapAtlasCountLabel->setCaption(
// TRANSLATORS: debug window label
strprintf("%s ?", _("Map atlas count:")));
+#endif // USE_OPENGL
}
mMapActorCountLabel->adjustSize();
- mMapAtlasCountLabel->adjustSize();
mParticleCountLabel->adjustSize();
+#ifdef USE_OPENGL
+ mMapAtlasCountLabel->adjustSize();
+#endif // USE_OPENGL
mFPSLabel->setCaption(strprintf(mFPSText.c_str(), fps));
// TRANSLATORS: debug window label, logic per second
diff --git a/src/gui/widgets/tabs/debugwindowtabs.h b/src/gui/widgets/tabs/debugwindowtabs.h
index e4c41dda8..17722f658 100644
--- a/src/gui/widgets/tabs/debugwindowtabs.h
+++ b/src/gui/widgets/tabs/debugwindowtabs.h
@@ -66,7 +66,9 @@ class MapDebugTab final : public DebugTab
Label *mTileMouseLabel A_NONNULLPOINTER;
Label *mParticleCountLabel A_NONNULLPOINTER;
Label *mMapActorCountLabel A_NONNULLPOINTER;
+#ifdef USE_OPENGL
Label *mMapAtlasCountLabel A_NONNULLPOINTER;
+#endif // USE_OPENGL
Label *mXYLabel A_NONNULLPOINTER;
Label *mTexturesLabel A_NONNULLPOINTER;
time_t mUpdateTime;
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index c9636183e..656f10fba 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -147,7 +147,9 @@ Map::Map(const std::string &name,
mDrawScrollX(-1),
mDrawScrollY(-1),
mMask(1),
+#ifdef USE_OPENGL
mAtlas(nullptr),
+#endif // USE_OPENGL
mHeights(nullptr),
mRedrawMap(true),
mBeingOpacity(false),
@@ -192,11 +194,13 @@ Map::~Map()
delete2(mTempLayer);
delete2(mObjects);
delete_all(mMapPortals);
+#ifdef USE_OPENGL
if (mAtlas != nullptr)
{
mAtlas->decRef();
mAtlas = nullptr;
}
+#endif // USE_OPENGL
delete2(mHeights);
delete [] mMetaTiles;
}
@@ -1794,9 +1798,11 @@ int Map::calcMemoryChilds(const int level) const
return sz;
}
+#ifdef USE_OPENGL
int Map::getAtlasCount() const restrict2
{
if (mAtlas == nullptr)
return 0;
return CAST_S32(mAtlas->atlases.size());
}
+#endif // USE_OPENGL
diff --git a/src/resources/map/map.h b/src/resources/map/map.h
index a3397ad2e..bcfd9e12e 100644
--- a/src/resources/map/map.h
+++ b/src/resources/map/map.h
@@ -42,7 +42,10 @@
#include "resources/map/properties.h"
class AmbientLayer;
+#ifdef USE_OPENGL
class AtlasResource;
+#endif // USE_OPENGL
+
class MapHeights;
class MapItem;
class MapLayer;
@@ -284,8 +287,6 @@ class Map final : public Properties,
int getActorsCount() const restrict2 A_WARN_UNUSED
{ return CAST_S32(mActors.size()); }
- int getAtlasCount() const restrict2 A_WARN_UNUSED;
-
void setPvpMode(const int mode) restrict2;
int getPvpMode() const restrict2 noexcept2 A_WARN_UNUSED
@@ -330,9 +331,16 @@ class Map final : public Properties,
restrict2 noexcept2 A_WARN_UNUSED
{ return mTileAnimations; }
+#ifdef USE_OPENGL
+ int getAtlasCount() const restrict2 A_WARN_UNUSED;
+
void setAtlas(AtlasResource *restrict const atlas) restrict2 noexcept2
{ mAtlas = atlas; }
+ bool haveAtlas() const
+ { return mAtlas != nullptr; }
+#endif // USE_OPENGL
+
const MetaTile *getMetaTiles() const restrict2 noexcept2
{ return mMetaTiles; }
@@ -365,9 +373,6 @@ class Map final : public Properties,
std::string getCounterName() const override final
{ return mName; }
- bool haveAtlas() const
- { return mAtlas != nullptr; }
-
protected:
friend class Actor;
friend class Minimap;
@@ -486,7 +491,10 @@ class Map final : public Properties,
int mDrawScrollX;
int mDrawScrollY;
int mMask;
+#ifdef USE_OPENGL
AtlasResource *mAtlas;
+#endif // USE_OPENGL
+
const MapHeights *mHeights;
bool mRedrawMap;
bool mBeingOpacity;