diff options
Diffstat (limited to 'src/npc.cpp')
-rw-r--r-- | src/npc.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/npc.cpp b/src/npc.cpp index 5540350a..92db9373 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,12 +24,16 @@ #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; +extern NpcTextDialog *npcTextDialog; + +NPC *current_npc = NULL; static const int NAME_X_OFFSET = 15; static const int NAME_Y_OFFSET = 30; @@ -73,6 +76,8 @@ NPC::NPC(Uint32 id, Uint16 job, Map *map, Network *network): NPC::~NPC() { delete mName; + + if (current_npc == this) handleDeath(); } void NPC::setName(const std::string &name) @@ -170,3 +175,13 @@ void NPC::updateCoords() mName->adviseXY(mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET); } } + +void NPC::handleDeath() +{ + printf("NPC::handleDeath\n"); + if (this != current_npc) return; + + if (npcTextDialog->isVisible()) + npcTextDialog->showCloseButton(); + else current_npc = NULL; +} |