diff options
author | savilli <78875209+savilli@users.noreply.github.com> | 2021-02-26 23:21:20 +0300 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2021-04-09 22:05:22 +0200 |
commit | ae1d82c3256e25de97bf93b4fd87033bc9012159 (patch) | |
tree | 63617f2df6b9d4f8d332407081d4bf1d096b7bf8 /src/network | |
parent | 1c89a07226d069817ffd8ad4034e00b8fc1b96d5 (diff) | |
download | minetest-ae1d82c3256e25de97bf93b4fd87033bc9012159.tar.gz minetest-ae1d82c3256e25de97bf93b4fd87033bc9012159.tar.bz2 minetest-ae1d82c3256e25de97bf93b4fd87033bc9012159.zip |
Fix hud_change and hud_remove after hud_add (#10997)
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/clientpackethandler.cpp | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 65db02300..44bd81dac 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -1095,16 +1095,10 @@ void Client::handleCommand_HudRemove(NetworkPacket* pkt) *pkt >> 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); - - ClientEvent *event = new ClientEvent(); - event->type = CE_HUDRM; - event->hudrm.id = client_id; - m_client_event_queue.push(event); - } + ClientEvent *event = new ClientEvent(); + event->type = CE_HUDRM; + event->hudrm.id = server_id; + m_client_event_queue.push(event); } void Client::handleCommand_HudChange(NetworkPacket* pkt) @@ -1131,19 +1125,16 @@ void Client::handleCommand_HudChange(NetworkPacket* pkt) else *pkt >> intdata; - std::unordered_map<u32, u32>::const_iterator i = m_hud_server_to_client.find(server_id); - if (i != m_hud_server_to_client.end()) { - ClientEvent *event = new ClientEvent(); - event->type = CE_HUDCHANGE; - event->hudchange.id = i->second; - event->hudchange.stat = (HudElementStat)stat; - event->hudchange.v2fdata = new v2f(v2fdata); - event->hudchange.v3fdata = new v3f(v3fdata); - event->hudchange.sdata = new std::string(sdata); - event->hudchange.data = intdata; - event->hudchange.v2s32data = new v2s32(v2s32data); - m_client_event_queue.push(event); - } + ClientEvent *event = new ClientEvent(); + event->type = CE_HUDCHANGE; + event->hudchange.id = server_id; + event->hudchange.stat = (HudElementStat)stat; + event->hudchange.v2fdata = new v2f(v2fdata); + event->hudchange.v3fdata = new v3f(v3fdata); + event->hudchange.sdata = new std::string(sdata); + event->hudchange.data = intdata; + event->hudchange.v2s32data = new v2s32(v2s32data); + m_client_event_queue.push(event); } void Client::handleCommand_HudSetFlags(NetworkPacket* pkt) |