diff options
Diffstat (limited to 'src/npc.cpp')
-rw-r--r-- | src/npc.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/npc.cpp b/src/npc.cpp index a79e5bac..5304bc93 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -25,14 +25,18 @@ #include "particle.h" #include "text.h" +#include "gui/buy.h" +#include "gui/buysell.h" +#include "gui/npcdialog.h" +#include "gui/npcpostdialog.h" #include "gui/palette.h" +#include "gui/sell.h" #include "net/net.h" #include "net/npchandler.h" #include "resources/npcdb.h" -bool NPC::isTalking = false; int current_npc = 0; NPC::NPC(int id, int job, Map *map): @@ -76,11 +80,9 @@ void NPC::setName(const std::string &name) void NPC::talk() { - if (isTalking) + if (isTalking()) return; - isTalking = true; - Net::getNpcHandler()->talk(mId); } @@ -88,3 +90,10 @@ void NPC::setSprite(unsigned int slot, int id, const std::string &color) { // Do nothing } + +const bool NPC::isTalking() +{ + return npcDialog->isVisible() || buyDialog->isVisible() || + sellDialog->isVisible() || buySellDialog->isVisible() || + npcPostDialog->isVisible(); +} |