summaryrefslogtreecommitdiff
path: root/src/net/ea
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-27 20:27:18 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-27 20:33:18 +0200
commit55ee3f8a67132b6f6542b21e69d9ccab064256ca (patch)
treedc7b59b8099b21975648c8641ccb748013992753 /src/net/ea
parent58bc517e0bb41a761b9cd8df75883ff3aa90365e (diff)
downloadmana-55ee3f8a67132b6f6542b21e69d9ccab064256ca.tar.gz
mana-55ee3f8a67132b6f6542b21e69d9ccab064256ca.tar.bz2
mana-55ee3f8a67132b6f6542b21e69d9ccab064256ca.tar.xz
mana-55ee3f8a67132b6f6542b21e69d9ccab064256ca.zip
Moved special coordinates packing into MessageOut
Is a better place. The reading part was already in MessageIn.
Diffstat (limited to 'src/net/ea')
-rw-r--r--src/net/ea/playerhandler.cpp4
-rw-r--r--src/net/ea/protocol.cpp77
-rw-r--r--src/net/ea/protocol.h3
3 files changed, 1 insertions, 83 deletions
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 55d54af8..4ff480d6 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -499,10 +499,8 @@ void PlayerHandler::setDirection(char direction)
void PlayerHandler::setDestination(int x, int y, int direction)
{
- char temp[4] = "";
- set_coordinates(temp, x, y, direction);
MessageOut outMsg(CMSG_PLAYER_CHANGE_DEST);
- outMsg.writeString(temp, 3);
+ outMsg.writeCoordinates(x, y, direction);
}
void PlayerHandler::changeAction(Being::Action action)
diff --git a/src/net/ea/protocol.cpp b/src/net/ea/protocol.cpp
deleted file mode 100644
index 9d9db56f..00000000
--- a/src/net/ea/protocol.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * The Mana World
- * Copyright (C) 2004 The Mana World Development Team
- *
- * This file is part of The Mana World.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "net/ea/protocol.h"
-
-#define LOBYTE(w) ((unsigned char)(w))
-#define HIBYTE(w) ((unsigned char)(((unsigned short)(w)) >> 8))
-
-void set_coordinates(char *data,
- unsigned short x,
- unsigned short y,
- unsigned char direction)
-{
- short temp;
- temp = x;
- temp <<= 6;
- data[0] = 0;
- data[1] = 1;
- data[2] = 2;
- data[0] = HIBYTE(temp);
- data[1] = (unsigned char)(temp);
- temp = y;
- temp <<= 4;
- data[1] |= HIBYTE(temp);
- data[2] = LOBYTE(temp);
-
- // Translate direction to eAthena format
- switch (direction)
- {
- case 1:
- direction = 0;
- break;
- case 3:
- direction = 1;
- break;
- case 2:
- direction = 2;
- break;
- case 6:
- direction = 3;
- break;
- case 4:
- direction = 4;
- break;
- case 12:
- direction = 5;
- break;
- case 8:
- direction = 6;
- break;
- case 9:
- direction = 7;
- break;
- default:
- // OOPSIE! Impossible or unknown
- direction = (unsigned char)-1;
- }
- data[2] |= direction;
-}
diff --git a/src/net/ea/protocol.h b/src/net/ea/protocol.h
index c96b1734..0373dd8a 100644
--- a/src/net/ea/protocol.h
+++ b/src/net/ea/protocol.h
@@ -207,7 +207,4 @@ static const int STORAGE_OFFSET = 1;
#define CMSG_ADMIN_KICK 0x00CC
#define CMSG_ADMIN_MUTE 0x0149
-/** Encodes coords and direction in 3 bytes data */
-void set_coordinates(char *data, unsigned short x, unsigned short y, unsigned char direction);
-
#endif