aboutsummaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorWuzzy <wuzzy2@mail.ru>2020-05-11 21:40:45 +0200
committerGitHub <noreply@github.com>2020-05-11 21:40:45 +0200
commit6e1372bd894d955300c40d69e5c882e9cc7d7523 (patch)
tree6273a8c2ddfec5efbc5b69fa49b088368dd78c15 /src/network
parent88bb8e57e6780130df1877e7a89bb56c9561ea6a (diff)
downloadminetest-6e1372bd894d955300c40d69e5c882e9cc7d7523.tar.gz
minetest-6e1372bd894d955300c40d69e5c882e9cc7d7523.tar.bz2
minetest-6e1372bd894d955300c40d69e5c882e9cc7d7523.zip
Add support for statbar “off state” icons (#9462)
This adds support for optional “off state” icons for statbars. “off state icons” can be used to denote the lack of something, like missing hearts or bubbles. Add "off state" textures to the builtin statbars. Co-authored-by: SmallJoker <mk939@ymail.com>
Diffstat (limited to 'src/network')
-rw-r--r--src/network/clientpackethandler.cpp15
-rw-r--r--src/network/networkprotocol.h6
2 files changed, 9 insertions, 12 deletions
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp
index 8d0225a3d..7b1b1368c 100644
--- a/src/network/clientpackethandler.cpp
+++ b/src/network/clientpackethandler.cpp
@@ -1102,22 +1102,16 @@ void Client::handleCommand_HudAdd(NetworkPacket* pkt)
v3f world_pos;
v2s32 size;
s16 z_index = 0;
+ std::string text2;
*pkt >> server_id >> type >> pos >> name >> scale >> text >> number >> item
>> dir >> align >> offset;
try {
*pkt >> world_pos;
- }
- catch(SerializationError &e) {};
-
- try {
*pkt >> size;
- } catch(SerializationError &e) {};
-
- try {
*pkt >> z_index;
- }
- catch(PacketError &e) {}
+ *pkt >> text2;
+ } catch(PacketError &e) {};
ClientEvent *event = new ClientEvent();
event->type = CE_HUDADD;
@@ -1135,6 +1129,7 @@ void Client::handleCommand_HudAdd(NetworkPacket* pkt)
event->hudadd.world_pos = new v3f(world_pos);
event->hudadd.size = new v2s32(size);
event->hudadd.z_index = z_index;
+ event->hudadd.text2 = new std::string(text2);
m_client_event_queue.push(event);
}
@@ -1171,7 +1166,7 @@ void Client::handleCommand_HudChange(NetworkPacket* pkt)
if (stat == HUD_STAT_POS || stat == HUD_STAT_SCALE ||
stat == HUD_STAT_ALIGN || stat == HUD_STAT_OFFSET)
*pkt >> v2fdata;
- else if (stat == HUD_STAT_NAME || stat == HUD_STAT_TEXT)
+ else if (stat == HUD_STAT_NAME || stat == HUD_STAT_TEXT || stat == HUD_STAT_TEXT2)
*pkt >> sdata;
else if (stat == HUD_STAT_WORLD_POS)
*pkt >> v3fdata;
diff --git a/src/network/networkprotocol.h b/src/network/networkprotocol.h
index 527ebba7c..ab924f1db 100644
--- a/src/network/networkprotocol.h
+++ b/src/network/networkprotocol.h
@@ -560,10 +560,10 @@ enum ToClientCommand
u32 id
u8 type
v2f1000 pos
- u32 len
+ u16 len
u8[len] name
v2f1000 scale
- u32 len2
+ u16 len2
u8[len2] text
u32 number
u32 item
@@ -573,6 +573,8 @@ enum ToClientCommand
v3f1000 world_pos
v2s32 size
s16 z_index
+ u16 len3
+ u8[len3] text2
*/
TOCLIENT_HUDRM = 0x4a,