summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/beingrecv.cpp25
-rw-r--r--src/net/tmwa/charserverrecv.cpp19
-rw-r--r--src/net/tmwa/chatrecv.cpp12
-rw-r--r--src/net/tmwa/partyrecv.cpp8
4 files changed, 18 insertions, 46 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")
}
diff --git a/src/net/tmwa/charserverrecv.cpp b/src/net/tmwa/charserverrecv.cpp
index 6b8cf27c6..15f9ccdb7 100644
--- a/src/net/tmwa/charserverrecv.cpp
+++ b/src/net/tmwa/charserverrecv.cpp
@@ -207,15 +207,13 @@ void CharServerRecv::processCharMapInfo(Net::MessageIn &restrict msg)
BLOCK_START("CharServerRecv::processCharMapInfo")
PlayerInfo::setCharId(msg.readInt32("char id?"));
GameHandler::setMap(msg.readString(16, "map name"));
+
+ const int ipAddress = msg.readInt32("ip address");
if (config.getBoolValue("usePersistentIP") || settings.persistentIp)
- {
- msg.readInt32("ip address");
server.hostname = settings.serverName;
- }
else
- {
- server.hostname = ipToString(msg.readInt32("ip address"));
- }
+ server.hostname = ipToString(ipAddress);
+
server.port = msg.readInt16("port");
server.althostname = charServer.althostname;
@@ -247,15 +245,12 @@ void CharServerRecv::processChangeMapServer(Net::MessageIn &msg)
GameHandler::setMap(msg.readString(16, "map name"));
const int x = msg.readInt16("x");
const int y = msg.readInt16("y");
+ const int ipAddress = msg.readInt32("ip address");
if (config.getBoolValue("usePersistentIP") || settings.persistentIp)
- {
- msg.readInt32("ip address");
server.hostname = settings.serverName;
- }
else
- {
- server.hostname = ipToString(msg.readInt32("ip address"));
- }
+ server.hostname = ipToString(ipAddress);
+
server.port = msg.readInt16("port");
network->disconnect();
diff --git a/src/net/tmwa/chatrecv.cpp b/src/net/tmwa/chatrecv.cpp
index 920676827..d16cd1c61 100644
--- a/src/net/tmwa/chatrecv.cpp
+++ b/src/net/tmwa/chatrecv.cpp
@@ -132,16 +132,10 @@ void ChatRecv::processGmChat(Net::MessageIn &msg)
return;
}
- if (localChatTab != nullptr &&
- chatWindow != nullptr)
- {
- std::string chatMsg = msg.readRawString(chatMsgLength, "message");
+ std::string chatMsg = msg.readRawString(chatMsgLength, "message");
+ if (localChatTab != nullptr && chatWindow != nullptr)
chatWindow->addGlobalMessage(chatMsg);
- }
- else
- {
- msg.readRawString(chatMsgLength, "message");
- }
+
BLOCK_END("ChatRecv::processChat")
}
diff --git a/src/net/tmwa/partyrecv.cpp b/src/net/tmwa/partyrecv.cpp
index 1f5990377..19245ef34 100644
--- a/src/net/tmwa/partyrecv.cpp
+++ b/src/net/tmwa/partyrecv.cpp
@@ -237,15 +237,9 @@ void PartyRecv::processPartyInvited(Net::MessageIn &msg)
}
}
+ const std::string partyName = msg.readString(24, "party name");
if (socialWindow != nullptr)
- {
- const std::string partyName = msg.readString(24, "party name");
socialWindow->showPartyInvite(partyName, nick, 0);
- }
- else
- {
- msg.readString(24, "party name");
- }
}
void PartyRecv::processPartyMove(Net::MessageIn &msg)