summaryrefslogtreecommitdiff
path: root/src/npc.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-02-25 13:38:55 -0700
committerJared Adams <jaxad0127@gmail.com>2009-02-25 13:38:55 -0700
commitf04a8713ffc83db8b3dc4a472b28aad25a2b2bd1 (patch)
tree1822aa7cecfbe4ef38b55216ab82b686e3b636c7 /src/npc.cpp
parent9673149ea3c28f42f38fc9989faf76d68e72bd20 (diff)
downloadmana-f04a8713ffc83db8b3dc4a472b28aad25a2b2bd1.tar.gz
mana-f04a8713ffc83db8b3dc4a472b28aad25a2b2bd1.tar.bz2
mana-f04a8713ffc83db8b3dc4a472b28aad25a2b2bd1.tar.xz
mana-f04a8713ffc83db8b3dc4a472b28aad25a2b2bd1.zip
Fix NPC handling to not need a handle on the NPC
The Being ID is used instead, as that is all that was ever really needed.
Diffstat (limited to 'src/npc.cpp')
-rw-r--r--src/npc.cpp67
1 files changed, 2 insertions, 65 deletions
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;
-}