diff options
author | Ira Rice <irarice@gmail.com> | 2009-02-24 23:03:31 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-02-24 23:03:31 -0700 |
commit | a1e483913672e55704e8fbafeff5ea0ccc0c9b07 (patch) | |
tree | 47cd4487c4b3e14d3bbb1b94c25cef4c55b10ef3 /src/npc.cpp | |
parent | e85269ffe1fe91f5cf44ccfec01252343643ef1d (diff) | |
download | mana-a1e483913672e55704e8fbafeff5ea0ccc0c9b07.tar.gz mana-a1e483913672e55704e8fbafeff5ea0ccc0c9b07.tar.bz2 mana-a1e483913672e55704e8fbafeff5ea0ccc0c9b07.tar.xz mana-a1e483913672e55704e8fbafeff5ea0ccc0c9b07.zip |
Cleaned up some code, as well as removed redundant talk client requesting
(which would happen from using the keyboard instead of the mouse).
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/npc.cpp')
-rw-r--r-- | src/npc.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/npc.cpp b/src/npc.cpp index dbd7a990..eaf6b78b 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -25,12 +25,15 @@ #include "particle.h" #include "text.h" +#include "gui/npc_text.h" + #include "net/messageout.h" #include "net/protocol.h" #include "resources/npcdb.h" NPC *current_npc = 0; +bool NPC::mTalking = false; static const int NAME_X_OFFSET = 15; static const int NAME_Y_OFFSET = 30; @@ -46,7 +49,8 @@ NPC::NPC(Uint32 id, Uint16 job, Map *map, Network *network): i != info.sprites.end(); i++) { - if (c == VECTOREND_SPRITE) break; + if (c == VECTOREND_SPRITE) + break; std::string file = "graphics/sprites/" + (*i)->sprite; int variant = (*i)->variant; @@ -103,6 +107,10 @@ Being::Type NPC::getType() const void NPC::talk() { + if (mTalking) + return; + + mTalking = true; MessageOut outMsg(mNetwork); outMsg.writeInt16(CMSG_NPC_TALK); outMsg.writeInt32(mId); @@ -165,7 +173,5 @@ void NPC::sell() void NPC::updateCoords() { if (mName) - { mName->adviseXY(mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET); - } } |