aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2016-10-12 18:39:35 +0200
committersfan5 <sfan5@live.de>2016-10-12 18:42:18 +0200
commit0b27a70b294590d7fb2bb25bf2d207a719ce8d98 (patch)
treeb52bc4c2cdb8ef4e80ff595ec33cfe2aef184834
parent4f684b589d8227c525d877b8a695736d561ea4d5 (diff)
downloadminetest-0b27a70b294590d7fb2bb25bf2d207a719ce8d98.tar.gz
minetest-0b27a70b294590d7fb2bb25bf2d207a719ce8d98.tar.bz2
minetest-0b27a70b294590d7fb2bb25bf2d207a719ce8d98.zip
Don't use unordered maps for ProfilerGraph (fixes flickering)
-rw-r--r--src/game.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 4f89aa680..b85f6d98d 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -605,7 +605,9 @@ public:
void draw(s32 x_left, s32 y_bottom, video::IVideoDriver *driver,
gui::IGUIFont *font) const
{
- UNORDERED_MAP<std::string, Meta> m_meta;
+ // Do *not* use UNORDERED_MAP here as the order needs
+ // to be the same for each call to prevent flickering
+ std::map<std::string, Meta> m_meta;
for (std::deque<Piece>::const_iterator k = m_log.begin();
k != m_log.end(); ++k) {
@@ -615,7 +617,7 @@ public:
i != piece.values.end(); ++i) {
const std::string &id = i->first;
const float &value = i->second;
- UNORDERED_MAP<std::string, Meta>::iterator j = m_meta.find(id);
+ std::map<std::string, Meta>::iterator j = m_meta.find(id);
if (j == m_meta.end()) {
m_meta[id] = Meta(value);
@@ -642,7 +644,7 @@ public:
sizeof(usable_colors) / sizeof(*usable_colors);
u32 next_color_i = 0;
- for (UNORDERED_MAP<std::string, Meta>::iterator i = m_meta.begin();
+ for (std::map<std::string, Meta>::iterator i = m_meta.begin();
i != m_meta.end(); ++i) {
Meta &meta = i->second;
video::SColor color(255, 200, 200, 200);
@@ -658,7 +660,7 @@ public:
s32 textx2 = textx + 200 - 15;
s32 meta_i = 0;
- for (UNORDERED_MAP<std::string, Meta>::const_iterator i = m_meta.begin();
+ for (std::map<std::string, Meta>::const_iterator i = m_meta.begin();
i != m_meta.end(); ++i) {
const std::string &id = i->first;
const Meta &meta = i->second;