1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Fix issues with earlier CSM HUD commit (#6940)

The CSM HUD PR caused some strange behavior including aborts due to parts of it using some slightly hacky code, the event refactor changing how events are processed and a minor oversight.
This commit is contained in:
red-001 2018-01-26 15:05:47 +00:00 committed by Loïc Blot
parent 3a5959ae6b
commit 4f688d5616
4 changed files with 15 additions and 15 deletions

View file

@ -1062,12 +1062,10 @@ void Client::handleCommand_HudAdd(NetworkPacket* pkt)
try {
*pkt >> size;
} catch(SerializationError &e) {};
u32 client_id = getEnv().getLocalPlayer()->getFreeHudID();
m_hud_server_to_client[server_id] = client_id;
ClientEvent *event = new ClientEvent();
event->type = CE_HUDADD;
event->hudadd.id = client_id;
event->hudadd.server_id = server_id;
event->hudadd.type = type;
event->hudadd.pos = new v2f(pos);
event->hudadd.name = new std::string(name);
@ -1089,7 +1087,7 @@ void Client::handleCommand_HudRemove(NetworkPacket* pkt)
*pkt >> server_id;
std::unordered_map<u32, u32>::const_iterator i = m_hud_server_to_client.find(server_id);
auto i = m_hud_server_to_client.find(server_id);
if (i != m_hud_server_to_client.end()) {
int client_id = i->second;
m_hud_server_to_client.erase(i);