summaryrefslogtreecommitdiff
path: root/src/game-server/gamehandler.cpp
diff options
context:
space:
mode:
authorDavid Athay <ko2fan@gmail.com>2008-07-24 15:06:10 +0000
committerDavid Athay <ko2fan@gmail.com>2008-07-24 15:06:10 +0000
commit2eb6a5a2c1c9ddfc86aabed037abb6fe696f4b8c (patch)
tree7949fc66bbba1cdb73ec7426a156d2fed94887f3 /src/game-server/gamehandler.cpp
parent26d4751d4d382bfcfb7196e355f85d584c335a6c (diff)
downloadmanaserv-2eb6a5a2c1c9ddfc86aabed037abb6fe696f4b8c.tar.gz
manaserv-2eb6a5a2c1c9ddfc86aabed037abb6fe696f4b8c.tar.bz2
manaserv-2eb6a5a2c1c9ddfc86aabed037abb6fe696f4b8c.tar.xz
manaserv-2eb6a5a2c1c9ddfc86aabed037abb6fe696f4b8c.zip
Added error message when NPC is too far away.
Diffstat (limited to 'src/game-server/gamehandler.cpp')
-rw-r--r--src/game-server/gamehandler.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/game-server/gamehandler.cpp b/src/game-server/gamehandler.cpp
index 0b0a795e..cfa6ad5f 100644
--- a/src/game-server/gamehandler.cpp
+++ b/src/game-server/gamehandler.cpp
@@ -199,7 +199,11 @@ void GameHandler::processMessage(NetComputer *comp, MessageIn &message)
{
int id = message.readShort();
MovingObject *o = findBeingNear(computer.character, id);
- if (!o || o->getType() != OBJECT_NPC) break;
+ if (!o || o->getType() != OBJECT_NPC)
+ {
+ sendError(comp, id, "Not close enough to NPC\n");
+ break;
+ }
NPC *q = static_cast< NPC * >(o);
if (message.getId() == PGMSG_NPC_SELECT)
@@ -562,3 +566,11 @@ GameClient *GameHandler::getClientByNameSlow(std::string const &name)
}
return NULL;
}
+
+void GameHandler::sendError(NetComputer *computer, int id, std::string errorMsg)
+{
+ MessageOut msg(GPMSG_NPC_ERROR);
+ msg.writeShort(id);
+ msg.writeString(errorMsg, errorMsg.size());
+ computer->send(msg);
+}