summaryrefslogtreecommitdiff
path: root/src/net/manaserv/beinghandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/manaserv/beinghandler.cpp')
-rw-r--r--src/net/manaserv/beinghandler.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/net/manaserv/beinghandler.cpp b/src/net/manaserv/beinghandler.cpp
index 4c91a36e..ac4a2404 100644
--- a/src/net/manaserv/beinghandler.cpp
+++ b/src/net/manaserv/beinghandler.cpp
@@ -129,6 +129,14 @@ void BeingHandler::handleBeingEnterMessage(Net::MessageIn &msg)
BeingDirection direction = (BeingDirection)msg.readInt8();
Being *being;
+ if(!Game::instance()->getCurrentMap()->containsPixel(px ,py))
+ {
+ logger->log("Warning: Received GPMSG_BEING_ENTER for being id "
+ "%i with position outside the map boundaries "
+ "(x = %i, y = %i)", id, px, py);
+ return;
+ }
+
switch (type)
{
case OBJECT_CHARACTER:
@@ -229,6 +237,14 @@ void BeingHandler::handleBeingsMoveMessage(Net::MessageIn &msg)
// the being position
if (flags & MOVING_POSITION)
{
+ if (!being->getMap()->containsPixel(sx, sy))
+ {
+ logger->log("Warning: Received GPMSG_BEINGS_MOVE for being id "
+ "%i with position outside the map boundaries "
+ "(x = %i, y = %i)", id, sx, sy);
+ return;
+ }
+
Vector serverPos(sx, sy);
if (serverPos.length()
- being->getPosition().length() > POSITION_DIFF_TOLERANCE)
@@ -236,7 +252,17 @@ void BeingHandler::handleBeingsMoveMessage(Net::MessageIn &msg)
}
if (flags & MOVING_DESTINATION)
+ {
+ if (!being->getMap()->containsPixel(dx, dy))
+ {
+ logger->log("Warning: Received GPMSG_BEINGS_MOVE for being id "
+ "%i with destination outside the map boundaries "
+ "(x = %i, y = %i)", id, dx, dy);
+ return;
+ }
+
being->setDestination(dx, dy);
+ }
}
}