summaryrefslogtreecommitdiff
path: root/src/game-server
diff options
context:
space:
mode:
authorDavid Athay <ko2fan@gmail.com>2008-10-15 15:44:55 +0000
committerDavid Athay <ko2fan@gmail.com>2008-10-15 15:44:55 +0000
commitce23c2eecd596c3e83cb2d813889bf2a79dae2d0 (patch)
treeb6fb19466a271e28ce41d695ea9a86293406f04e /src/game-server
parent5956dd7483ceda0d9e8464440d467fc7003c9182 (diff)
downloadmanaserv-ce23c2eecd596c3e83cb2d813889bf2a79dae2d0.tar.gz
manaserv-ce23c2eecd596c3e83cb2d813889bf2a79dae2d0.tar.bz2
manaserv-ce23c2eecd596c3e83cb2d813889bf2a79dae2d0.tar.xz
manaserv-ce23c2eecd596c3e83cb2d813889bf2a79dae2d0.zip
Added communicating change of direction to clients.
Diffstat (limited to 'src/game-server')
-rw-r--r--src/game-server/gamehandler.cpp5
-rw-r--r--src/game-server/movingobject.hpp2
-rw-r--r--src/game-server/object.hpp3
-rw-r--r--src/game-server/state.cpp9
4 files changed, 17 insertions, 2 deletions
diff --git a/src/game-server/gamehandler.cpp b/src/game-server/gamehandler.cpp
index 3540ac51..d4068664 100644
--- a/src/game-server/gamehandler.cpp
+++ b/src/game-server/gamehandler.cpp
@@ -343,6 +343,11 @@ void GameHandler::processMessage(NetComputer *comp, MessageIn &message)
} break;
+ case PGMSG_DIRECTION_CHANGE:
+ {
+ computer.character->setDirection(message.readByte());
+ } break;
+
case PGMSG_DISCONNECT:
{
bool reconnectAccount = (bool) message.readByte();
diff --git a/src/game-server/movingobject.hpp b/src/game-server/movingobject.hpp
index a81212bb..025a91d5 100644
--- a/src/game-server/movingobject.hpp
+++ b/src/game-server/movingobject.hpp
@@ -80,7 +80,7 @@ class MovingObject : public Object
* Sets object direction.
*/
void setDirection(int direction)
- { mDirection = direction; }
+ { mDirection = direction; raiseUpdateFlags(UPDATEFLAG_DIRCHANGE); }
/**
* Gets object direction.
diff --git a/src/game-server/object.hpp b/src/game-server/object.hpp
index 92980d02..d94e28c6 100644
--- a/src/game-server/object.hpp
+++ b/src/game-server/object.hpp
@@ -36,7 +36,8 @@ enum
UPDATEFLAG_NEW_DESTINATION = 2,
UPDATEFLAG_ATTACK = 4,
UPDATEFLAG_ACTIONCHANGE = 8,
- UPDATEFLAG_LOOKSCHANGE = 16
+ UPDATEFLAG_LOOKSCHANGE = 16,
+ UPDATEFLAG_DIRCHANGE = 32
};
/**
diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp
index a129e889..8beb0891 100644
--- a/src/game-server/state.cpp
+++ b/src/game-server/state.cpp
@@ -216,6 +216,15 @@ static void informPlayer(MapComposite *map, Character *p)
gameHandler->sendTo(p, LooksMsg);
}
+ // Send direction change messages.
+ if (oflags & UPDATEFLAG_DIRCHANGE)
+ {
+ MessageOut DirMsg(GPMSG_BEING_DIR_CHANGE);
+ DirMsg.writeShort(oid);
+ DirMsg.writeByte(o->getDirection());
+ gameHandler->sendTo(p, DirMsg);
+ }
+
// Send damage messages.
if (o->canFight())
{