summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/beingmanager.cpp21
-rw-r--r--src/beingmanager.h10
-rw-r--r--src/game.cpp10
-rw-r--r--src/gui/buy.cpp2
-rw-r--r--src/gui/buysell.cpp22
-rw-r--r--src/gui/buysell.h7
-rw-r--r--src/gui/npc_text.cpp21
-rw-r--r--src/gui/npc_text.h8
-rw-r--r--src/gui/npcintegerdialog.cpp14
-rw-r--r--src/gui/npcintegerdialog.h4
-rw-r--r--src/gui/npclistdialog.cpp12
-rw-r--r--src/gui/npclistdialog.h5
-rw-r--r--src/gui/npcstringdialog.cpp16
-rw-r--r--src/gui/npcstringdialog.h5
-rw-r--r--src/gui/sell.cpp2
-rw-r--r--src/net/beinghandler.cpp14
-rw-r--r--src/net/buysellhandler.cpp4
-rw-r--r--src/net/npchandler.cpp27
-rw-r--r--src/net/playerhandler.cpp4
-rw-r--r--src/npc.cpp67
-rw-r--r--src/npc.h15
21 files changed, 142 insertions, 148 deletions
diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp
index 3b73d29f..273436bf 100644
--- a/src/beingmanager.cpp
+++ b/src/beingmanager.cpp
@@ -96,10 +96,7 @@ Being* BeingManager::createBeing(Uint32 id, Uint16 job)
void BeingManager::destroyBeing(Being *being)
{
mBeings.remove(being);
- if (being == current_npc)
- current_npc->handleDeath();
- else
- delete being;
+ delete being;
}
Being* BeingManager::findBeing(Uint32 id)
@@ -196,12 +193,6 @@ void BeingManager::clear()
mBeings.remove(player_node);
}
- if (current_npc)
- {
- mBeings.remove(current_npc);
- current_npc->handleDeath();
- }
-
delete_all(mBeings);
mBeings.clear();
@@ -264,3 +255,13 @@ Being* BeingManager::findNearestLivingBeing(Being *aroundBeing, int maxdist,
return (maxdist >= dist) ? closestBeing : NULL;
}
+
+bool BeingManager::hasBeing(Being *being)
+{
+ for (BeingIterator i = mBeings.begin(); i != mBeings.end(); i++)
+ {
+ if (being == *i) return true;
+ }
+
+ return false;
+}
diff --git a/src/beingmanager.h b/src/beingmanager.h
index 11721709..02c83725 100644
--- a/src/beingmanager.h
+++ b/src/beingmanager.h
@@ -99,12 +99,20 @@ class BeingManager
Beings& getAll();
/**
+ * Returns true if the given being is in the manager's list, false
+ * otherwise.
+ *
+ * \param being the being to search for
+ */
+ bool hasBeing(Being *being);
+
+ /**
* Logic.
*/
void logic();
/**
- * Destroys all beings except the local player
+ * Destroys all beings except the local player and current NPC (if any)
*/
void clear();
diff --git a/src/game.cpp b/src/game.cpp
index cb85fc5c..6f9dbb88 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -198,13 +198,13 @@ void createGuiWindows(Network *network)
miniStatusWindow = new MiniStatusWindow;
buyDialog = new BuyDialog(network);
sellDialog = new SellDialog(network);
- buySellDialog = new BuySellDialog;
+ buySellDialog = new BuySellDialog(network);
inventoryWindow = new InventoryWindow;
emoteWindow = new EmoteWindow;
- npcTextDialog = new NpcTextDialog;
- npcIntegerDialog = new NpcIntegerDialog;
- npcListDialog = new NpcListDialog;
- npcStringDialog = new NpcStringDialog;
+ npcTextDialog = new NpcTextDialog(network);
+ npcIntegerDialog = new NpcIntegerDialog(network);
+ npcListDialog = new NpcListDialog(network);
+ npcStringDialog = new NpcStringDialog(network);
skillDialog = new SkillDialog;
setupWindow = new Setup;
minimap = new Minimap;
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index c084c7c2..cad21ab5 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -132,7 +132,7 @@ void BuyDialog::action(const gcn::ActionEvent &event)
if (event.getId() == "quit")
{
setVisible(false);
- if (current_npc) current_npc->handleDeath();
+ current_npc = 0;
return;
}
diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp
index 8bf5f1f4..c1c934d1 100644
--- a/src/gui/buysell.cpp
+++ b/src/gui/buysell.cpp
@@ -24,10 +24,13 @@
#include "../npc.h"
+#include "../net/messageout.h"
+#include "../net/protocol.h"
+
#include "../utils/gettext.h"
-BuySellDialog::BuySellDialog():
- Window(_("Shop"))
+BuySellDialog::BuySellDialog(Network *network):
+ Window(_("Shop")), mNetwork(network)
{
Button *buyButton = 0;
static const char *buttonNames[] = {
@@ -60,12 +63,19 @@ void BuySellDialog::logic()
void BuySellDialog::action(const gcn::ActionEvent &event)
{
+ setVisible(false);
+ int action;
if (event.getId() == "Buy") {
- current_npc->buy();
+ action = 0;
} else if (event.getId() == "Sell") {
- current_npc->sell();
+ action = 1;
} else if (event.getId() == "Cancel") {
- if (current_npc) current_npc->handleDeath();
+ current_npc = 0;
+ return;
}
- setVisible(false);
+
+ MessageOut outMsg(mNetwork);
+ outMsg.writeInt16(CMSG_NPC_BUY_SELL_REQUEST);
+ outMsg.writeInt32(current_npc);
+ outMsg.writeInt8(action);
}
diff --git a/src/gui/buysell.h b/src/gui/buysell.h
index 754bb551..197c1a2b 100644
--- a/src/gui/buysell.h
+++ b/src/gui/buysell.h
@@ -26,6 +26,8 @@
#include "window.h"
+class Network;
+
/**
* A dialog to choose between buying or selling at a shop.
*
@@ -40,7 +42,7 @@ class BuySellDialog : public Window, public gcn::ActionListener
*
* @see Window::Window
*/
- BuySellDialog();
+ BuySellDialog(Network *network);
/**
* Check for current NPC
@@ -51,6 +53,9 @@ class BuySellDialog : public Window, public gcn::ActionListener
* Called when receiving actions from the widgets.
*/
void action(const gcn::ActionEvent &event);
+
+ private:
+ Network *mNetwork;
};
#endif
diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp
index 1750cbd4..db0015e9 100644
--- a/src/gui/npc_text.cpp
+++ b/src/gui/npc_text.cpp
@@ -28,10 +28,13 @@
#include "../npc.h"
+#include "../net/messageout.h"
+#include "../net/protocol.h"
+
#include "../utils/gettext.h"
-NpcTextDialog::NpcTextDialog():
- Window(_("NPC")),
+NpcTextDialog::NpcTextDialog(Network *network):
+ Window(_("NPC")), mNetwork(network),
mState(NPC_TEXT_STATE_WAITING)
{
setResizable(true);
@@ -97,14 +100,14 @@ void NpcTextDialog::action(const gcn::ActionEvent &event)
if (event.getId() == "ok")
{
if (mState == NPC_TEXT_STATE_NEXT && current_npc) {
- current_npc->nextDialog();
+ nextDialog();
addText("\n> Next\n");
} else if (mState == NPC_TEXT_STATE_CLOSE ||
(mState == NPC_TEXT_STATE_NEXT && !current_npc)) {
setText("");
- if (current_npc) current_npc->nextDialog();
+ if (current_npc) nextDialog();
setVisible(false);
- if (current_npc) current_npc->handleDeath();
+ current_npc = 0;
} else return;
}
else return;
@@ -114,10 +117,16 @@ void NpcTextDialog::action(const gcn::ActionEvent &event)
mState = NPC_TEXT_STATE_WAITING;
}
+void NpcTextDialog::nextDialog(int npcID)
+{
+ MessageOut outMsg(mNetwork);
+ outMsg.writeInt16(CMSG_NPC_NEXT_REQUEST);
+ outMsg.writeInt32(npcID);
+}
+
void NpcTextDialog::widgetResized(const gcn::Event &event)
{
Window::widgetResized(event);
setText(mText);
}
-
diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h
index 00b11b3c..62486fff 100644
--- a/src/gui/npc_text.h
+++ b/src/gui/npc_text.h
@@ -28,6 +28,9 @@
#include "window.h"
+#include "../npc.h"
+
+class Network;
class TextBox;
/**
@@ -43,7 +46,7 @@ class NpcTextDialog : public Window, public gcn::ActionListener
*
* @see Window::Window
*/
- NpcTextDialog();
+ NpcTextDialog(Network *network);
/**
* Called when receiving actions from the widgets.
@@ -74,6 +77,8 @@ class NpcTextDialog : public Window, public gcn::ActionListener
void showCloseButton();
+ void nextDialog(int npcID = current_npc);
+
/**
* Called when resizing the window.
*
@@ -82,6 +87,7 @@ class NpcTextDialog : public Window, public gcn::ActionListener
void widgetResized(const gcn::Event &event);
private:
+ Network *mNetwork;
gcn::ScrollArea *mScrollArea;
TextBox *mTextBox;
gcn::Button *mButton;
diff --git a/src/gui/npcintegerdialog.cpp b/src/gui/npcintegerdialog.cpp
index f91b42da..f6d788df 100644
--- a/src/gui/npcintegerdialog.cpp
+++ b/src/gui/npcintegerdialog.cpp
@@ -28,13 +28,16 @@
#include "../npc.h"
+#include "../net/messageout.h"
+#include "../net/protocol.h"
+
#include "../utils/gettext.h"
#include "../utils/strprintf.h"
extern NpcTextDialog *npcTextDialog;
-NpcIntegerDialog::NpcIntegerDialog():
- Window(_("NPC Number Request"))
+NpcIntegerDialog::NpcIntegerDialog(Network *network):
+ Window(_("NPC Number Request")), mNetwork(network)
{
mValueField = new IntTextField;
@@ -104,7 +107,12 @@ void NpcIntegerDialog::action(const gcn::ActionEvent &event)
if (finish)
{
setVisible(false);
- current_npc->integerInput(mValueField->getValue());
+
+ MessageOut outMsg(mNetwork);
+ outMsg.writeInt16(CMSG_NPC_INT_RESPONSE);
+ outMsg.writeInt32(current_npc);
+ outMsg.writeInt32(mValueField->getValue());
+
mValueField->reset();
}
}
diff --git a/src/gui/npcintegerdialog.h b/src/gui/npcintegerdialog.h
index 6083338c..80a21848 100644
--- a/src/gui/npcintegerdialog.h
+++ b/src/gui/npcintegerdialog.h
@@ -26,6 +26,7 @@
#include "window.h"
+class Network;
class IntTextField;
/**
@@ -41,7 +42,7 @@ class NpcIntegerDialog : public Window, public gcn::ActionListener
*
* @see Window::Window
*/
- NpcIntegerDialog();
+ NpcIntegerDialog(Network *network);
/**
* Called when receiving actions from the widgets.
@@ -81,6 +82,7 @@ class NpcIntegerDialog : public Window, public gcn::ActionListener
void setVisible(bool visible);
private:
+ Network *mNetwork;
gcn::Button *mDecButton;
gcn::Button *mIncButton;
IntTextField *mValueField;
diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp
index 8349cb4a..fc7d2979 100644
--- a/src/gui/npclistdialog.cpp
+++ b/src/gui/npclistdialog.cpp
@@ -31,13 +31,16 @@
#include "../npc.h"
+#include "../net/messageout.h"
+#include "../net/protocol.h"
+
#include "../utils/gettext.h"
#include "../utils/strprintf.h"
extern NpcTextDialog *npcTextDialog;
-NpcListDialog::NpcListDialog():
- Window(_("NPC"))
+NpcListDialog::NpcListDialog(Network *network):
+ Window(_("NPC")), mNetwork(network)
{
setResizable(true);
@@ -115,7 +118,10 @@ void NpcListDialog::action(const gcn::ActionEvent &event)
{
setVisible(false);
reset();
- current_npc->dialogChoice(choice);
+ MessageOut outMsg(mNetwork);
+ outMsg.writeInt16(CMSG_NPC_LIST_CHOICE);
+ outMsg.writeInt32(current_npc);
+ outMsg.writeInt8(choice);
}
}
diff --git a/src/gui/npclistdialog.h b/src/gui/npclistdialog.h
index e7e2f9a9..a7b49506 100644
--- a/src/gui/npclistdialog.h
+++ b/src/gui/npclistdialog.h
@@ -29,6 +29,8 @@
#include <vector>
+class Network;
+
/**
* The npc list dialog.
*
@@ -43,7 +45,7 @@ class NpcListDialog : public Window, public gcn::ActionListener,
*
* @see Window::Window
*/
- NpcListDialog();
+ NpcListDialog(Network *network);
/**
* Called when receiving actions from the widgets.
@@ -75,6 +77,7 @@ class NpcListDialog : public Window, public gcn::ActionListener,
void setVisible(bool visible);
private:
+ Network *mNetwork;
gcn::ListBox *mItemList;
std::vector<std::string> mItems;
diff --git a/src/gui/npcstringdialog.cpp b/src/gui/npcstringdialog.cpp
index 679c93e5..7ed05288 100644
--- a/src/gui/npcstringdialog.cpp
+++ b/src/gui/npcstringdialog.cpp
@@ -28,13 +28,16 @@
#include "../npc.h"
+#include "../net/messageout.h"
+#include "../net/protocol.h"
+
#include "../utils/gettext.h"
#include "../utils/strprintf.h"
extern NpcTextDialog *npcTextDialog;
-NpcStringDialog::NpcStringDialog():
- Window(_("NPC Text Request"))
+NpcStringDialog::NpcStringDialog(Network *network):
+ Window(_("NPC Text Request")), mNetwork(network)
{
mValueField = new TextField("");
@@ -74,8 +77,15 @@ void NpcStringDialog::action(const gcn::ActionEvent &event)
}
setVisible(false);
- current_npc->stringInput(mValueField->getText());
+ std::string text = mValueField->getText();
mValueField->setText("");
+
+ MessageOut outMsg(mNetwork);
+ outMsg.writeInt16(CMSG_NPC_STR_RESPONSE);
+ outMsg.writeInt16(text.length() + 9);
+ outMsg.writeInt32(current_npc);
+ outMsg.writeString(text, text.length());
+ outMsg.writeInt8(0);
}
bool NpcStringDialog::isInputFocused()
diff --git a/src/gui/npcstringdialog.h b/src/gui/npcstringdialog.h
index 31f9c9a0..43283219 100644
--- a/src/gui/npcstringdialog.h
+++ b/src/gui/npcstringdialog.h
@@ -26,6 +26,8 @@
#include <guichan/actionlistener.hpp>
+class Network;
+
/**
* The npc integer input dialog.
*
@@ -39,7 +41,7 @@ class NpcStringDialog : public Window, public gcn::ActionListener
*
* @see Window::Window
*/
- NpcStringDialog();
+ NpcStringDialog(Network *network);
/**
* Called when receiving actions from the widgets.
@@ -71,6 +73,7 @@ class NpcStringDialog : public Window, public gcn::ActionListener
void setVisible(bool visible);
private:
+ Network *mNetwork;
gcn::TextField *mValueField;
std::string mDefault;
};
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 14620aa6..51fc8f9f 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -133,7 +133,7 @@ void SellDialog::action(const gcn::ActionEvent &event)
if (event.getId() == "quit")
{
setVisible(false);
- if (current_npc) current_npc->handleDeath();
+ current_npc = 0;
return;
}
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index 3e746eb5..982667d1 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -35,6 +35,10 @@
#include "../npc.h"
#include "../player_relations.h"
+#include "../gui/npc_text.h"
+
+extern NpcTextDialog *npcTextDialog;
+
const int EMOTION_TIME = 150; /**< Duration of emotion icon */
BeingHandler::BeingHandler(bool enableSync):
@@ -204,7 +208,12 @@ void BeingHandler::handleMessage(MessageIn *msg)
case SMSG_BEING_REMOVE:
// A being should be removed or has died
- dstBeing = beingManager->findBeing(msg->readInt32());
+ id = msg->readInt32();
+
+ if (id == current_npc)
+ npcTextDialog->showCloseButton();
+
+ dstBeing = beingManager->findBeing(id);
if (!dstBeing)
break;
@@ -213,9 +222,6 @@ void BeingHandler::handleMessage(MessageIn *msg)
if (dstBeing == player_node->getTarget())
player_node->stopAttack();
- if (dstBeing == current_npc)
- current_npc->handleDeath();
-
if (msg->readInt8() == 1)
dstBeing->setAction(Being::DEAD);
else
diff --git a/src/net/buysellhandler.cpp b/src/net/buysellhandler.cpp
index a2442d70..714bc0ea 100644
--- a/src/net/buysellhandler.cpp
+++ b/src/net/buysellhandler.cpp
@@ -65,7 +65,7 @@ void BuySellHandler::handleMessage(MessageIn *msg)
sellDialog->setVisible(false);
sellDialog->reset();
buySellDialog->setVisible(true);
- current_npc = dynamic_cast<NPC*>(beingManager->findBeing(msg->readInt32()));
+ current_npc = msg->readInt32();
break;
case SMSG_NPC_BUY:
@@ -107,7 +107,7 @@ void BuySellHandler::handleMessage(MessageIn *msg)
}
else {
chatWindow->chatLog(_("Nothing to sell"), BY_SERVER);
- if (current_npc) current_npc->handleDeath();
+ current_npc = 0;
}
break;
diff --git a/src/net/npchandler.cpp b/src/net/npchandler.cpp
index ae521bd5..405217bb 100644
--- a/src/net/npchandler.cpp
+++ b/src/net/npchandler.cpp
@@ -54,24 +54,21 @@ NPCHandler::NPCHandler()
void NPCHandler::handleMessage(MessageIn *msg)
{
int id;
- NPC *temporaryNPC;
switch (msg->getId())
{
case SMSG_NPC_CHOICE:
msg->readInt16(); // length
- id = msg->readInt32();
+ current_npc = msg->readInt32();
player_node->setAction(LocalPlayer::STAND);
- current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id));
npcListDialog->parseItems(msg->readString(msg->getLength() - 8));
npcListDialog->setVisible(true);
break;
case SMSG_NPC_MESSAGE:
msg->readInt16(); // length
- id = msg->readInt32();
+ current_npc = msg->readInt32();
player_node->setAction(LocalPlayer::STAND);
- current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id));
npcTextDialog->addText(msg->readString(msg->getLength() - 8));
npcListDialog->setVisible(false);
npcTextDialog->setVisible(true);
@@ -79,30 +76,28 @@ void NPCHandler::handleMessage(MessageIn *msg)
case SMSG_NPC_CLOSE:
id = msg->readInt32();
- temporaryNPC = dynamic_cast<NPC*>(beingManager->findBeing(id));
// If we're talking to that NPC, show the close button
- if (temporaryNPC == current_npc)
+ if (id == current_npc)
npcTextDialog->showCloseButton();
// Otherwise, move on as an empty dialog doesn't help
else
- temporaryNPC->nextDialog();
+ npcTextDialog->nextDialog(id);
break;
case SMSG_NPC_NEXT:
id = msg->readInt32();
- temporaryNPC = dynamic_cast<NPC*>(beingManager->findBeing(id));
// If we're talking to that NPC, show the next button
- if (temporaryNPC == current_npc)
+ if (id == current_npc)
npcTextDialog->showNextButton();
- else if (temporaryNPC)
// Otherwise, move on as an empty dialog doesn't help
- temporaryNPC->nextDialog();
+ else
+ npcTextDialog->nextDialog(id);
break;
case SMSG_NPC_INT_INPUT:
// Request for an integer
- id = msg->readInt32();
- current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id));
+ current_npc = msg->readInt32();
+ player_node->setAction(LocalPlayer::STAND);
npcIntegerDialog->setRange(0, 2147483647);
npcIntegerDialog->setDefaultValue(0);
npcIntegerDialog->setVisible(true);
@@ -111,8 +106,8 @@ void NPCHandler::handleMessage(MessageIn *msg)
case SMSG_NPC_STR_INPUT:
// Request for a string
- id = msg->readInt32();
- current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id));
+ current_npc = msg->readInt32();
+ player_node->setAction(LocalPlayer::STAND);
npcStringDialog->setValue("");
npcStringDialog->setVisible(true);
npcStringDialog->requestFocus();
diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp
index ee1b2fd9..550753b7 100644
--- a/src/net/playerhandler.cpp
+++ b/src/net/playerhandler.cpp
@@ -93,7 +93,7 @@ namespace {
buyDialog->setVisible(false);
sellDialog->setVisible(false);
buySellDialog->setVisible(false);
- if (current_npc) current_npc->handleDeath();
+ current_npc = 0;
}
} deathListener;
}
@@ -147,8 +147,6 @@ void PlayerHandler::handleMessage(MessageIn *msg)
// Switch the actual map, deleting the previous one if necessary
engine->changeMap(mapPath);
- if (current_npc) current_npc->handleDeath();
-
float scrollOffsetX = 0.0f;
float scrollOffsetY = 0.0f;
diff --git a/src/npc.cpp b/src/npc.cpp
index ecac2509..8fd8a86b 100644
--- a/src/npc.cpp
+++ b/src/npc.cpp
@@ -20,6 +20,7 @@
*/
#include "animatedsprite.h"
+#include "beingmanager.h"
#include "npc.h"
#include "particle.h"
#include "text.h"
@@ -33,7 +34,7 @@
extern NpcTextDialog *npcTextDialog;
-NPC *current_npc = NULL;
+int current_npc = NULL;
static const int NAME_X_OFFSET = 15;
static const int NAME_Y_OFFSET = 30;
@@ -113,60 +114,6 @@ void NPC::talk()
outMsg.writeInt8(0);
}
-void NPC::nextDialog()
-{
- if (!this || !mNetwork) return;
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_NPC_NEXT_REQUEST);
- outMsg.writeInt32(mId);
-}
-
-void NPC::dialogChoice(char choice)
-{
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_NPC_LIST_CHOICE);
- outMsg.writeInt32(mId);
- outMsg.writeInt8(choice);
-}
-
-void NPC::integerInput(int value)
-{
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_NPC_INT_RESPONSE);
- outMsg.writeInt32(mId);
- outMsg.writeInt32(value);
-}
-
-void NPC::stringInput(const std::string &value)
-{
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_NPC_STR_RESPONSE);
- outMsg.writeInt16(value.length() + 9);
- outMsg.writeInt32(mId);
- outMsg.writeString(value, value.length());
- outMsg.writeInt8(0);
-}
-
-/*
- * TODO Unify the buy() and sell() methods, without sacrificing readability of
- * the code calling the method. buy(bool buySell) would be bad...
- */
-void NPC::buy()
-{
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_NPC_BUY_SELL_REQUEST);
- outMsg.writeInt32(mId);
- outMsg.writeInt8(0);
-}
-
-void NPC::sell()
-{
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_NPC_BUY_SELL_REQUEST);
- outMsg.writeInt32(mId);
- outMsg.writeInt8(1);
-}
-
void NPC::updateCoords()
{
if (mName)
@@ -174,13 +121,3 @@ void NPC::updateCoords()
mName->adviseXY(mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET);
}
}
-
-void NPC::handleDeath()
-{
- if (this != current_npc) return;
-
- if (npcTextDialog->isVisible())
- npcTextDialog->showCloseButton();
- else
- current_npc = NULL;
-}
diff --git a/src/npc.h b/src/npc.h
index 81b6d51e..ef9fdc7d 100644
--- a/src/npc.h
+++ b/src/npc.h
@@ -42,19 +42,6 @@ class NPC : public Player
virtual Type getType() const;
void talk();
- void nextDialog();
- void dialogChoice(char choice);
- void integerInput(int value);
- void stringInput(const std::string &value);
-
- void buy();
- void sell();
-
- /**
- * Call this to ease clean up of the current NPC, without causing
- * interface problems
- */
- void handleDeath();
protected:
Network *mNetwork;
void updateCoords();
@@ -62,6 +49,6 @@ class NPC : public Player
Text *mName;
};
-extern NPC *current_npc;
+extern int current_npc;
#endif