summaryrefslogtreecommitdiff
path: root/src/npc.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-02-25 13:50:47 -0700
committerJared Adams <jaxad0127@gmail.com>2009-02-25 13:50:47 -0700
commit3ad6ac47d4967870a54fddd66aa9996724115b94 (patch)
tree6f0a5931a193e2942a0988964f9324f715f303db /src/npc.cpp
parentf04a8713ffc83db8b3dc4a472b28aad25a2b2bd1 (diff)
downloadmana-3ad6ac47d4967870a54fddd66aa9996724115b94.tar.gz
mana-3ad6ac47d4967870a54fddd66aa9996724115b94.tar.bz2
mana-3ad6ac47d4967870a54fddd66aa9996724115b94.tar.xz
mana-3ad6ac47d4967870a54fddd66aa9996724115b94.zip
Prevent duplicate NPC talking when using keyboard
Based on commit a1e483913672e55704e8fbafeff5ea0ccc0c9b07 from Aethyra.
Diffstat (limited to 'src/npc.cpp')
-rw-r--r--src/npc.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/npc.cpp b/src/npc.cpp
index 8fd8a86b..5132e0dc 100644
--- a/src/npc.cpp
+++ b/src/npc.cpp
@@ -34,7 +34,8 @@
extern NpcTextDialog *npcTextDialog;
-int current_npc = NULL;
+int current_npc = 0;
+bool NPC::isTalking = false;
static const int NAME_X_OFFSET = 15;
static const int NAME_Y_OFFSET = 30;
@@ -107,7 +108,9 @@ Being::Type NPC::getType() const
void NPC::talk()
{
- if (!this || !mNetwork) return;
+ if (isTalking || !this || !mNetwork) return;
+
+ isTalking = true;
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_NPC_TALK);
outMsg.writeInt32(mId);