summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp73
1 files changed, 37 insertions, 36 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 1f8b9caca..03a710599 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -2042,35 +2042,35 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
}
else if(command == TOCLIENT_HUDADD)
{
- std::string datastring((char*)&data[2], datasize-2);
+ std::string datastring((char *)&data[2], datasize - 2);
std::istringstream is(datastring, std::ios_base::binary);
- u32 id = readU32(is);
- u8 type = readU8(is);
- core::vector2df pos = readV2F1000(is);
- std::string name = deSerializeString(is);
- core::vector2df scale = readV2F1000(is);
- std::string text = deSerializeString(is);
- u32 number = readU32(is);
- u32 item = readU32(is);
- u32 dir = readU32(is);
+ u32 id = readU32(is);
+ u8 type = readU8(is);
+ v2f pos = readV2F1000(is);
+ std::string name = deSerializeString(is);
+ v2f scale = readV2F1000(is);
+ std::string text = deSerializeString(is);
+ u32 number = readU32(is);
+ u32 item = readU32(is);
+ u32 dir = readU32(is);
ClientEvent event;
event.type = CE_HUDADD;
- event.hudadd.id = id;
- event.hudadd.type = type;
- event.hudadd.pos = new v2f(pos);
- event.hudadd.name = new std::string(name);
- event.hudadd.scale = new v2f(scale);
- event.hudadd.text = new std::string(text);
+ event.hudadd.id = id;
+ event.hudadd.type = type;
+ event.hudadd.pos = new v2f(pos);
+ event.hudadd.name = new std::string(name);
+ event.hudadd.scale = new v2f(scale);
+ event.hudadd.text = new std::string(text);
event.hudadd.number = number;
- event.hudadd.item = item;
- event.hudadd.dir = dir;
+ event.hudadd.item = item;
+ event.hudadd.dir = dir;
m_client_event_queue.push_back(event);
}
else if(command == TOCLIENT_HUDRM)
{
- std::string datastring((char*)&data[2], datasize-2);
+ std::string datastring((char *)&data[2], datasize - 2);
std::istringstream is(datastring, std::ios_base::binary);
u32 id = readU32(is);
@@ -2081,30 +2081,31 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
m_client_event_queue.push_back(event);
}
else if(command == TOCLIENT_HUDCHANGE)
- {
- std::string datastring((char*)&data[2], datasize-2);
+ {
+ std::string sdata;
+ v2f v2fdata;
+ u32 intdata = 0;
+
+ std::string datastring((char *)&data[2], datasize - 2);
std::istringstream is(datastring, std::ios_base::binary);
- u32 id = readU32(is);
- u8 stat = readU8(is);
- core::vector2df v2fdata;
- std::string sdata;
- u32 data = 0;
- if(stat == 0 || stat == 2) {
+ u32 id = readU32(is);
+ u8 stat = (HudElementStat)readU8(is);
+
+ if (stat == HUD_STAT_POS || stat == HUD_STAT_SCALE)
v2fdata = readV2F1000(is);
- } else if(stat == 1 || stat == 3) {
+ else if (stat == HUD_STAT_NAME || stat == HUD_STAT_TEXT)
sdata = deSerializeString(is);
- } else {
- data = readU32(is);
- }
-
+ else
+ intdata = readU32(is);
+
ClientEvent event;
event.type = CE_HUDCHANGE;
- event.hudchange.id = id;
- event.hudchange.stat = stat;
+ event.hudchange.id = id;
+ event.hudchange.stat = (HudElementStat)stat;
event.hudchange.v2fdata = new v2f(v2fdata);
- event.hudchange.sdata = new std::string(sdata);
- event.hudchange.data = data;
+ event.hudchange.sdata = new std::string(sdata);
+ event.hudchange.data = intdata;
m_client_event_queue.push_back(event);
}
else