#include "irrlichttypes_extrabloated.h"
#include "client.h"
#include "voxel.h"
-#include "threading/mutex.h"
#include "threading/semaphore.h"
#include <map>
#include <string>
MINIMAP_MODE_COUNT,
};
+enum MinimapShape {
+ MINIMAP_SHAPE_SQUARE,
+ MINIMAP_SHAPE_ROUND,
+};
+
struct MinimapModeDef {
bool is_radar;
u16 scan_height;
};
struct MinimapMapblock {
- void getMinimapNodes(VoxelManipulator *vmanip, v3s16 pos);
+ void getMinimapNodes(VoxelManipulator *vmanip, const v3s16 &pos);
MinimapPixel data[MAP_BLOCKSIZE * MAP_BLOCKSIZE];
};
MinimapPixel minimap_scan[MINIMAP_MAX_SX * MINIMAP_MAX_SY];
bool map_invalidated;
bool minimap_shape_round;
- video::IImage *minimap_image;
- video::IImage *heightmap_image;
- video::IImage *minimap_mask_round;
- video::IImage *minimap_mask_square;
- video::ITexture *texture;
- video::ITexture *heightmap_texture;
- video::ITexture *minimap_overlay_round;
- video::ITexture *minimap_overlay_square;
- video::ITexture *player_marker;
- video::ITexture *object_marker_red;
+ video::IImage *minimap_mask_round = nullptr;
+ video::IImage *minimap_mask_square = nullptr;
+ video::ITexture *texture = nullptr;
+ video::ITexture *heightmap_texture = nullptr;
+ video::ITexture *minimap_overlay_round = nullptr;
+ video::ITexture *minimap_overlay_square = nullptr;
+ video::ITexture *player_marker = nullptr;
+ video::ITexture *object_marker_red = nullptr;
};
struct QueuedMinimapUpdate {
v3s16 pos;
- MinimapMapblock *data;
+ MinimapMapblock *data = nullptr;
};
class MinimapUpdateThread : public UpdateThread {
bool pushBlockUpdate(v3s16 pos, MinimapMapblock *data);
bool popBlockUpdate(QueuedMinimapUpdate *update);
- MinimapData *data;
+ MinimapData *data = nullptr;
protected:
virtual void doUpdate();
private:
- Mutex m_queue_mutex;
+ std::mutex m_queue_mutex;
std::deque<QueuedMinimapUpdate> m_update_queue;
std::map<v3s16, MinimapMapblock *> m_blocks_cache;
};
class Minimap {
public:
- Minimap(IrrlichtDevice *device, Client *client);
+ Minimap(Client *client);
~Minimap();
void addBlock(v3s16 pos, MinimapMapblock *data);
void setMinimapMode(MinimapMode mode);
MinimapMode getMinimapMode() const { return data->mode; }
void toggleMinimapShape();
+ void setMinimapShape(MinimapShape shape);
+ MinimapShape getMinimapShape();
video::ITexture *getMinimapTexture();
bool m_enable_shaders;
u16 m_surface_mode_scan_height;
f32 m_angle;
- Mutex m_mutex;
+ std::mutex m_mutex;
std::list<v2f> m_active_markers;
};