aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRealBadAngel <maciej.kasatkin@o2.pl>2015-06-28 14:45:47 +0200
committerRealBadAngel <maciej.kasatkin@o2.pl>2015-06-28 14:45:47 +0200
commit0a90fedabc07a3ba811f13ed8d673136e857ec02 (patch)
tree0122ffe2f26e8efbcb965f8d60f5130d3d301288
parentb160f8dfe7e3bf8176e3f9f64dc2d9a9868d7fce (diff)
downloadminetest-0a90fedabc07a3ba811f13ed8d673136e857ec02.tar.gz
minetest-0a90fedabc07a3ba811f13ed8d673136e857ec02.tar.bz2
minetest-0a90fedabc07a3ba811f13ed8d673136e857ec02.zip
Bugfix: minimap was updated only with loading new blocks, allow forced updates with changing player pos
-rw-r--r--src/minimap.cpp11
-rw-r--r--src/minimap.h2
2 files changed, 11 insertions, 2 deletions
diff --git a/src/minimap.cpp b/src/minimap.cpp
index 9adeb84bc..02660f969 100644
--- a/src/minimap.cpp
+++ b/src/minimap.cpp
@@ -120,6 +120,10 @@ void MinimapUpdateThread::enqueue_Block(v3s16 pos, MinimapMapblock *data)
m_queue_sem.Post();
}
+void MinimapUpdateThread::forceUpdate()
+{
+ m_queue_sem.Post();
+}
void *MinimapUpdateThread::Thread()
{
@@ -323,12 +327,17 @@ void Mapper::setMinimapMode(MinimapMode mode)
data->scan_height = modeDefs[(int)mode * 3 + 1];
data->map_size = modeDefs[(int)mode * 3 + 2];
data->mode = mode;
+ m_minimap_update_thread->forceUpdate();
}
void Mapper::setPos(v3s16 pos)
{
JMutexAutoLock lock(m_mutex);
- data->pos = pos;
+ if (pos != data->old_pos) {
+ data->old_pos = data->pos;
+ data->pos = pos;
+ m_minimap_update_thread->forceUpdate();
+ }
}
video::ITexture *Mapper::getMinimapTexture()
diff --git a/src/minimap.h b/src/minimap.h
index 220c3add0..37bc2f7cb 100644
--- a/src/minimap.h
+++ b/src/minimap.h
@@ -131,7 +131,7 @@ public:
video::SColor getColorFromId(u16 id);
void enqueue_Block(v3s16 pos, MinimapMapblock *data);
-
+ void forceUpdate();
IrrlichtDevice *device;
Client *client;
video::IVideoDriver *driver;