diff --git a/src/minimap.cpp b/src/minimap.cpp index 9adeb84bca2e44ac1a7ee57beeaef8f667f3a14c..02660f969fe892e2f89ced604a52b39deb12a866 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 220c3add0794585613c8cea9b289205c30be0ee6..37bc2f7cb81d64d31a4e42eab7edb93f23cf9c77 100644 --- a/src/minimap.h +++ b/src/minimap.h @@ -131,7 +131,7 @@ class MinimapUpdateThread : public JThread video::SColor getColorFromId(u16 id); void enqueue_Block(v3s16 pos, MinimapMapblock *data); - + void forceUpdate(); IrrlichtDevice *device; Client *client; video::IVideoDriver *driver;