Skip to content

Commit

Permalink
Bugfix: minimap was updated only with loading new blocks, allow force…
Browse files Browse the repository at this point in the history
…d updates with changing player pos
  • Loading branch information
RealBadAngel committed Jun 28, 2015
1 parent b160f8d commit 0a90fed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/minimap.cpp
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/minimap.h
Expand Up @@ -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;
Expand Down

0 comments on commit 0a90fed

Please sign in to comment.