summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/npc_text.cpp1
-rw-r--r--src/npc.cpp7
-rw-r--r--src/npc.h2
3 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp
index db0015e9..520efad4 100644
--- a/src/gui/npc_text.cpp
+++ b/src/gui/npc_text.cpp
@@ -108,6 +108,7 @@ void NpcTextDialog::action(const gcn::ActionEvent &event)
if (current_npc) nextDialog();
setVisible(false);
current_npc = 0;
+ NPC::isTalking = false;
} else return;
}
else return;
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);
diff --git a/src/npc.h b/src/npc.h
index ef9fdc7d..182da3e5 100644
--- a/src/npc.h
+++ b/src/npc.h
@@ -42,6 +42,8 @@ class NPC : public Player
virtual Type getType() const;
void talk();
+
+ static bool isTalking;
protected:
Network *mNetwork;
void updateCoords();