1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-25 05:35:25 +02:00

Simplify HUD handling in Player class

This commit is contained in:
sfan5
2025-08-14 17:10:07 +02:00
parent bb74b9d488
commit 36b5374715
6 changed files with 35 additions and 65 deletions

View File

@@ -9,8 +9,6 @@
#include "constants.h"
#include "util/basic_macros.h"
#include "util/string.h"
#include <mutex>
#include <functional>
#include <string>
#define PLAYERNAME_SIZE 20
@@ -219,8 +217,8 @@ public:
return m_fov_override_spec;
}
const auto &getHudElements() const { return hud; }
HudElement* getHud(u32 id);
void hudApply(std::function<void(const std::vector<HudElement*>&)> f);
u32 addHud(HudElement* hud);
HudElement* removeHud(u32 id);
void clearHud();
@@ -237,12 +235,6 @@ protected:
u16 m_wield_index = 0;
PlayerFovSpec m_fov_override_spec = { 0.0f, false, 0.0f };
std::vector<HudElement *> hud;
private:
// Protect some critical areas
// hud for example can be modified by EmergeThread
// and ServerThread
// FIXME: ^ this sounds like nonsense. should be checked.
std::mutex m_mutex;
std::vector<HudElement *> hud;
};