summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-30 22:51:23 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-30 22:51:23 +0300
commitef8ef35d28daa3ea7dd542078ac9c0d3f7a9a5e2 (patch)
treec3d7c79fca18ac387d0c90512ef3201c92da5890 /src/net/eathena
parent22b64d16b613c1e5b26632237879b167024788ab (diff)
downloadManaVerse-ef8ef35d28daa3ea7dd542078ac9c0d3f7a9a5e2.tar.gz
ManaVerse-ef8ef35d28daa3ea7dd542078ac9c0d3f7a9a5e2.tar.bz2
ManaVerse-ef8ef35d28daa3ea7dd542078ac9c0d3f7a9a5e2.tar.xz
ManaVerse-ef8ef35d28daa3ea7dd542078ac9c0d3f7a9a5e2.zip
Move some variables to better scope.
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/beingrecv.cpp9
-rw-r--r--src/net/eathena/buyingstorerecv.cpp9
-rw-r--r--src/net/eathena/chatrecv.cpp9
-rw-r--r--src/net/eathena/guildrecv.cpp17
-rw-r--r--src/net/eathena/mailrecv.cpp1
-rw-r--r--src/net/eathena/npcrecv.cpp14
-rw-r--r--src/net/eathena/partyrecv.cpp14
-rw-r--r--src/net/eathena/vendingrecv.cpp9
8 files changed, 69 insertions, 13 deletions
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp
index ce2b3a581..8d986797b 100644
--- a/src/net/eathena/beingrecv.cpp
+++ b/src/net/eathena/beingrecv.cpp
@@ -2079,9 +2079,12 @@ void BeingRecv::processSkillCancel(Net::MessageIn &msg)
void BeingRecv::processSolveCharName(Net::MessageIn &msg)
{
const int id = msg.readInt32("char id");
- const std::string name = msg.readString(24, "name");
- if (actorManager != nullptr)
- actorManager->addChar(id, name);
+ if (actorManager == nullptr)
+ {
+ msg.readString(24, "name");
+ return;
+ }
+ actorManager->addChar(id, msg.readString(24, "name"));
}
void BeingRecv::processGraffiti(Net::MessageIn &msg)
diff --git a/src/net/eathena/buyingstorerecv.cpp b/src/net/eathena/buyingstorerecv.cpp
index 55c1624f9..bf5d2032b 100644
--- a/src/net/eathena/buyingstorerecv.cpp
+++ b/src/net/eathena/buyingstorerecv.cpp
@@ -94,10 +94,15 @@ void BuyingStoreRecv::processBuyingStoreOwnItems(Net::MessageIn &msg)
void BuyingStoreRecv::processBuyingStoreShowBoard(Net::MessageIn &msg)
{
const BeingId id = msg.readBeingId("owner id");
- const std::string shopName = msg.readString(80, "shop name");
Being *const dstBeing = actorManager->findBeing(id);
if (dstBeing != nullptr)
- dstBeing->setBuyBoard(shopName);
+ {
+ dstBeing->setBuyBoard(msg.readString(80, "shop name"));
+ }
+ else
+ {
+ msg.readString(80, "shop name");
+ }
}
void BuyingStoreRecv::processBuyingStoreHideBoard(Net::MessageIn &msg)
diff --git a/src/net/eathena/chatrecv.cpp b/src/net/eathena/chatrecv.cpp
index d52183962..97f0de803 100644
--- a/src/net/eathena/chatrecv.cpp
+++ b/src/net/eathena/chatrecv.cpp
@@ -295,9 +295,16 @@ void ChatRecv::processGmChat2(Net::MessageIn &msg)
msg.readInt16("font size");
msg.readInt16("font align");
msg.readInt16("font y");
- const std::string chatMsg = msg.readRawString(chatMsgLength, "message");
if (chatWindow != nullptr)
+ {
+ const std::string chatMsg = msg.readRawString(chatMsgLength,
+ "message");
chatWindow->addGlobalMessage(chatMsg);
+ }
+ else
+ {
+ msg.readRawString(chatMsgLength, "message");
+ }
}
void ChatRecv::processWhisper(Net::MessageIn &msg)
diff --git a/src/net/eathena/guildrecv.cpp b/src/net/eathena/guildrecv.cpp
index 7f17f57db..d235c23bb 100644
--- a/src/net/eathena/guildrecv.cpp
+++ b/src/net/eathena/guildrecv.cpp
@@ -377,22 +377,33 @@ void GuildRecv::processGuildSkillInfo(Net::MessageIn &msg)
void GuildRecv::processGuildNotice(Net::MessageIn &msg)
{
- const std::string msg1 = msg.readString(60, "msg1");
- const std::string msg2 = msg.readString(120, "msg2");
if (guildTab != nullptr)
{
+ const std::string msg1 = msg.readString(60, "msg1");
+ const std::string msg2 = msg.readString(120, "msg2");
guildTab->chatLog(msg1, ChatMsgType::BY_SERVER);
guildTab->chatLog(msg2, ChatMsgType::BY_SERVER);
}
+ else
+ {
+ msg.readString(60, "msg1");
+ msg.readString(120, "msg2");
+ }
}
void GuildRecv::processGuildInvite(Net::MessageIn &msg)
{
const int guildId = msg.readInt32("guild id");
- const std::string guildName = msg.readString(24, "guild name");
if (socialWindow != nullptr)
+ {
+ const std::string guildName = msg.readString(24, "guild name");
socialWindow->showGuildInvite(guildName, guildId, "");
+ }
+ else
+ {
+ msg.readString(24, "guild name");
+ }
}
void GuildRecv::processGuildInviteAck(Net::MessageIn &msg)
diff --git a/src/net/eathena/mailrecv.cpp b/src/net/eathena/mailrecv.cpp
index 5e5f0939a..b51e418a6 100644
--- a/src/net/eathena/mailrecv.cpp
+++ b/src/net/eathena/mailrecv.cpp
@@ -123,6 +123,7 @@ void MailRecv::processReadMail(Net::MessageIn &msg)
if (!mailWindow)
{
reportAlways("Mail window not created");
+ delete mail;
return;
}
mailWindow->showMessage(mail, itemId != 0 ? 1 : 0);
diff --git a/src/net/eathena/npcrecv.cpp b/src/net/eathena/npcrecv.cpp
index 875718768..535e57d7c 100644
--- a/src/net/eathena/npcrecv.cpp
+++ b/src/net/eathena/npcrecv.cpp
@@ -45,6 +45,12 @@ namespace NpcRecv
void NpcRecv::processNpcCutin(Net::MessageIn &msg)
{
Ea::NpcRecv::mRequestLang = false;
+ if (cutInWindow == nullptr)
+ {
+ msg.readString(64, "image name");
+ msg.readUInt8("type");
+ return;
+ }
const std::string image = msg.readString(64, "image name");
const CutInT cutin = static_cast<CutInT>(msg.readUInt8("type"));
if (cutInWindow != nullptr)
@@ -112,9 +118,15 @@ void NpcRecv::processNpcSkin(Net::MessageIn &msg)
{
const int len = msg.readInt16("len");
npcHandler->getNpc(msg, NpcAction::Other);
- const std::string skin = msg.readString(len - 8, "skin");
if (Ea::NpcRecv::mDialog != nullptr)
+ {
+ const std::string skin = msg.readString(len - 8, "skin");
Ea::NpcRecv::mDialog->setSkin(skin);
+ }
+ else
+ {
+ msg.readString(len - 8, "skin");
+ }
}
} // namespace EAthena
diff --git a/src/net/eathena/partyrecv.cpp b/src/net/eathena/partyrecv.cpp
index 2f6482ac1..9ce0dbdce 100644
--- a/src/net/eathena/partyrecv.cpp
+++ b/src/net/eathena/partyrecv.cpp
@@ -176,9 +176,15 @@ void PartyRecv::processPartyInfo(Net::MessageIn &msg)
Ea::taParty->clearMembers();
const int length = msg.readInt16("len");
- const std::string name = msg.readString(24, "party name");
if (Ea::taParty != nullptr)
+ {
+ const std::string name = msg.readString(24, "party name");
Ea::taParty->setName(name);
+ }
+ else
+ {
+ msg.readString(24, "party name");
+ }
int partySize = 0;
int offset = 0;
@@ -370,6 +376,12 @@ void PartyRecv::processPartyLeader(Net::MessageIn &msg)
void PartyRecv::processPartyInvited(Net::MessageIn &msg)
{
+ if (socialWindow == nullptr)
+ {
+ msg.readInt32("party id");
+ msg.readString(24, "party name");
+ return;
+ }
const int id = msg.readInt32("party id");
const std::string partyName = msg.readString(24, "party name");
diff --git a/src/net/eathena/vendingrecv.cpp b/src/net/eathena/vendingrecv.cpp
index 33494fd33..d4f14bc87 100644
--- a/src/net/eathena/vendingrecv.cpp
+++ b/src/net/eathena/vendingrecv.cpp
@@ -75,10 +75,15 @@ void VendingRecv::processOpenReq(Net::MessageIn &msg)
void VendingRecv::processShowBoard(Net::MessageIn &msg)
{
const BeingId id = msg.readBeingId("owner id");
- const std::string shopName = msg.readString(80, "shop name");
Being *const dstBeing = actorManager->findBeing(id);
if (dstBeing != nullptr)
- dstBeing->setSellBoard(shopName);
+ {
+ dstBeing->setSellBoard(msg.readString(80, "shop name"));
+ }
+ else
+ {
+ msg.readString(80, "shop name");
+ }
}
void VendingRecv::processHideBoard(Net::MessageIn &msg)