Decrease RAM usage by at least 200MB

This was quite ridiculous.

TILESTATE_LAST = 1 << 24

Basically we were creating 2^24 Color structures within the array, each
of them has 4 floats (16 bytes) resulting in about 256 MB of extra
wasted memory.
This commit is contained in:
Konrad Kuśnierz
2015-05-09 20:27:04 +02:00
parent e4cdb3834b
commit 53dbbd2ba3
2 changed files with 10 additions and 4 deletions

View File

@@ -196,7 +196,7 @@ public:
void setZoneOpacity(float opacity) { m_zoneOpacity = opacity; }
float getZoneOpacity() { return m_zoneOpacity; }
Color getZoneColor(tileflags_t flag) { return m_zoneColors[flag]; }
Color getZoneColor(tileflags_t flag);
tileflags_t getZoneFlags() { return (tileflags_t)m_zoneFlags; }
bool showZones() { return m_zoneFlags != 0; }
bool showZone(tileflags_t zone) { return (m_zoneFlags & zone) == zone; }
@@ -257,7 +257,7 @@ private:
uint8 m_animationFlags;
uint32 m_zoneFlags;
std::array<Color, TILESTATE_LAST> m_zoneColors;
std::map<uint32, Color> m_zoneColors;
float m_zoneOpacity;
Light m_light;
@@ -272,5 +272,3 @@ private:
extern Map g_map;
#endif
/* vim: set ts=4 sw=4 et: */