summaryrefslogtreecommitdiff
path: root/src/net/tmwa/beingrecv.cpp
diff options
context:
space:
mode:
authorFedja Beader <fedja@protonmail.ch>2024-08-28 15:15:27 +0000
committerFedja Beader <fedja@protonmail.ch>2024-08-28 15:15:27 +0000
commit7929b1dc48116522b6ed82b05e864a5b15910de9 (patch)
tree9b3af9baa08a9dd500f5dbc8d11b3725420f15f2 /src/net/tmwa/beingrecv.cpp
parente304e3feb771f3e1000addce04e7557f1211192a (diff)
downloadmanaplus-7929b1dc48116522b6ed82b05e864a5b15910de9.tar.gz
manaplus-7929b1dc48116522b6ed82b05e864a5b15910de9.tar.bz2
manaplus-7929b1dc48116522b6ed82b05e864a5b15910de9.tar.xz
manaplus-7929b1dc48116522b6ed82b05e864a5b15910de9.zip
Remove silly msg.read* duplication
& shaves ~5KB from debug binary. previd=""; while read -r line; do if [[ $line =~ .*"msg.read"[^\"]*"\""([^\"]*).* ]]; then id="${BASH_REMATCH[1]}"; if [[ "$id" == "$previd" ]]; then printf "%s\n" "$line"; fi; previd="$id"; fi; done < <(grep -r 'msg.read.*' src/net/) **** mana/plus!91
Diffstat (limited to 'src/net/tmwa/beingrecv.cpp')
-rw-r--r--src/net/tmwa/beingrecv.cpp25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/net/tmwa/beingrecv.cpp b/src/net/tmwa/beingrecv.cpp
index 012042b00..ae0b8df26 100644
--- a/src/net/tmwa/beingrecv.cpp
+++ b/src/net/tmwa/beingrecv.cpp
@@ -113,16 +113,11 @@ void BeingRecv::processBeingChangeLook2(Net::MessageIn &msg)
msg.readBeingId("being id"));
const uint8_t type = msg.readUInt8("type");
- int id2 = 0;
const int16_t id = msg.readInt16("id1");
- if (type == 2)
+ int id2 = msg.readInt16("id2");
+ if (type != 2)
{
- id2 = msg.readInt16("id2");
- }
- else
- {
- msg.readInt16("id2");
id2 = 1;
}
@@ -1360,17 +1355,16 @@ void BeingRecv::processBeingSelfEffect(Net::MessageIn &msg)
}
const BeingId id = msg.readBeingId("being id");
+ const int effectType = msg.readInt32("effect type");
+
Being *const being = actorManager->findBeing(id);
if (being == nullptr)
{
- DEBUGLOGSTR("insible player?");
- msg.readInt32("effect type");
+ DEBUGLOGSTR("invisible player?");
BLOCK_END("BeingRecv::processBeingSelfEffect")
return;
}
- const int effectType = msg.readInt32("effect type");
-
if (ParticleEngine::enabled)
effectManager->trigger(effectType, being, 0);
@@ -1399,16 +1393,11 @@ void BeingRecv::processIpResponse(Net::MessageIn &msg)
Being *const dstBeing = actorManager->findBeing(
msg.readBeingId("being id"));
+ const int ipAddress = msg.readInt32("ip address");
if (dstBeing != nullptr)
- {
- const std::string ip = ipToString(msg.readInt32("ip address"));
- dstBeing->setIp(ip);
- }
+ dstBeing->setIp(ipToString(ipAddress));
else
- {
- msg.readInt32("ip address");
DEBUGLOGSTR("invisible player?");
- }
BLOCK_END("BeingRecv::processIpResponse")
}