summaryrefslogtreecommitdiff
path: root/src/net/ea
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/ea')
-rw-r--r--src/net/ea/npchandler.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/net/ea/npchandler.cpp b/src/net/ea/npchandler.cpp
index d35cc5d60..40c6b5256 100644
--- a/src/net/ea/npchandler.cpp
+++ b/src/net/ea/npchandler.cpp
@@ -122,6 +122,9 @@ void NpcHandler::processNpcCommand(Net::MessageIn &msg)
mRequestLang = false;
const int cmd = msg.readInt16("cmd");
+ const int id = msg.readInt32("id");
+ const int x = msg.readInt16("x");
+ const int y = msg.readInt16("y");
switch (cmd)
{
case 0:
@@ -136,9 +139,6 @@ void NpcHandler::processNpcCommand(Net::MessageIn &msg)
case 2:
if (viewport)
{
- const int id = msg.readInt32("id");
- const int x = msg.readInt16("x");
- const int y = msg.readInt16("y");
if (!id)
viewport->moveCameraToPosition(x, y);
else
@@ -154,9 +154,6 @@ void NpcHandler::processNpcCommand(Net::MessageIn &msg)
case 4:
if (viewport)
{
- msg.readInt32("id");
- const int x = msg.readInt16("x");
- const int y = msg.readInt16("y");
viewport->moveCameraRelative(x, y);
}
break;
@@ -168,8 +165,7 @@ void NpcHandler::processNpcCommand(Net::MessageIn &msg)
case 6: // show avatar
if (mDialog)
{
- mDialog->showAvatar(static_cast<uint16_t>(
- msg.readInt32("avatar id")));
+ mDialog->showAvatar(static_cast<uint16_t>(id));
}
break;
case 7: // set avatar direction
@@ -177,12 +173,12 @@ void NpcHandler::processNpcCommand(Net::MessageIn &msg)
{
mDialog->setAvatarDirection(
Net::MessageIn::fromServerDirection(
- static_cast<uint8_t>(msg.readInt32("avatar direction"))));
+ static_cast<uint8_t>(id)));
}
break;
case 8: // set avatar action
if (mDialog)
- mDialog->setAvatarAction(msg.readInt32("avatar action"));
+ mDialog->setAvatarAction(id);
break;
case 9: // clear npc dialog
if (mDialog)
@@ -190,7 +186,7 @@ void NpcHandler::processNpcCommand(Net::MessageIn &msg)
break;
case 10: // send selected item id
{
- int invSize = msg.readInt32("npc inventory size");
+ int invSize = id;
if (!invSize)
invSize = 1;
if (mDialog)