]> git.lizzy.rs Git - minetest.git/blobdiff - src/minimap.cpp
Mgvalleys: use standard caves
[minetest.git] / src / minimap.cpp
index 950202c6a4f8895bce0cc8ed16b6779d0ac31126..ded8470c54bcad77c6a6d8bd8fdbcb5a142d9524 100644 (file)
@@ -18,16 +18,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 */
 
 #include "minimap.h"
-#include <math.h>
-#include "logoutputbuffer.h"
-#include "jthread/jmutexautolock.h"
-#include "jthread/jsemaphore.h"
+#include "threading/mutex_auto_lock.h"
+#include "threading/semaphore.h"
 #include "clientmap.h"
 #include "settings.h"
 #include "nodedef.h"
 #include "porting.h"
 #include "util/numeric.h"
 #include "util/string.h"
+#include <math.h>
 
 
 ////
@@ -52,7 +51,7 @@ MinimapUpdateThread::~MinimapUpdateThread()
 
 bool MinimapUpdateThread::pushBlockUpdate(v3s16 pos, MinimapMapblock *data)
 {
-       JMutexAutoLock lock(m_queue_mutex);
+       MutexAutoLock lock(m_queue_mutex);
 
        // Find if block is already in queue.
        // If it is, update the data and quit.
@@ -78,7 +77,7 @@ bool MinimapUpdateThread::pushBlockUpdate(v3s16 pos, MinimapMapblock *data)
 
 bool MinimapUpdateThread::popBlockUpdate(QueuedMinimapUpdate *update)
 {
-       JMutexAutoLock lock(m_queue_mutex);
+       MutexAutoLock lock(m_queue_mutex);
 
        if (m_update_queue.empty())
                return false;
@@ -217,6 +216,8 @@ Mapper::Mapper(IrrlichtDevice *device, Client *client)
        this->m_shdrsrc = client->getShaderSource();
        this->m_ndef    = client->getNodeDefManager();
 
+       m_angle = 0.f;
+
        // Initialize static settings
        m_enable_shaders = g_settings->getBool("enable_shaders");
        m_surface_mode_scan_height =
@@ -224,12 +225,13 @@ Mapper::Mapper(IrrlichtDevice *device, Client *client)
 
        // Initialize minimap data
        data = new MinimapData;
-       data->mode            = MINIMAP_MODE_OFF;
-       data->is_radar        = false;
-       data->map_invalidated = true;
-       data->heightmap_image = NULL;
-       data->minimap_image   = NULL;
-       data->texture         = NULL;
+       data->mode              = MINIMAP_MODE_OFF;
+       data->is_radar          = false;
+       data->map_invalidated   = true;
+       data->heightmap_image   = NULL;
+       data->minimap_image     = NULL;
+       data->texture           = NULL;
+       data->heightmap_texture = NULL;
        data->minimap_shape_round = g_settings->getBool("minimap_shape_round");
 
        // Get round minimap textures
@@ -255,13 +257,13 @@ Mapper::Mapper(IrrlichtDevice *device, Client *client)
        // Initialize and start thread
        m_minimap_update_thread = new MinimapUpdateThread();
        m_minimap_update_thread->data = data;
-       m_minimap_update_thread->Start();
+       m_minimap_update_thread->start();
 }
 
 Mapper::~Mapper()
 {
-       m_minimap_update_thread->Stop();
-       m_minimap_update_thread->Wait();
+       m_minimap_update_thread->stop();
+       m_minimap_update_thread->wait();
 
        m_meshbuffer->drop();
 
@@ -289,7 +291,7 @@ MinimapMode Mapper::getMinimapMode()
 
 void Mapper::toggleMinimapShape()
 {
-       JMutexAutoLock lock(m_mutex);
+       MutexAutoLock lock(m_mutex);
 
        data->minimap_shape_round = !data->minimap_shape_round;
        g_settings->setBool("minimap_shape_round", data->minimap_shape_round);
@@ -311,7 +313,7 @@ void Mapper::setMinimapMode(MinimapMode mode)
        if (mode >= MINIMAP_MODE_COUNT)
                return;
 
-       JMutexAutoLock lock(m_mutex);
+       MutexAutoLock lock(m_mutex);
 
        data->is_radar    = modedefs[mode].is_radar;
        data->scan_height = modedefs[mode].scan_height;
@@ -326,7 +328,7 @@ void Mapper::setPos(v3s16 pos)
        bool do_update = false;
 
        {
-               JMutexAutoLock lock(m_mutex);
+               MutexAutoLock lock(m_mutex);
 
                if (pos != data->old_pos) {
                        data->old_pos = data->pos;