summaryrefslogtreecommitdiff
path: root/src/gui/npclistdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/npclistdialog.cpp')
-rw-r--r--src/gui/npclistdialog.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp
index ef8b0627..968e2514 100644
--- a/src/gui/npclistdialog.cpp
+++ b/src/gui/npclistdialog.cpp
@@ -32,13 +32,24 @@
#include "../npc.h"
#include "../net/messageout.h"
-#include "../net/protocol.h"
+#ifdef TMWSERV_SUPPORT
+#include "../net/tmwserv/gameserver/player.h"
+#else
+#include "../net/ea/protocol.h"
+#endif
#include "../utils/gettext.h"
#include "../utils/strprintf.h"
-NpcListDialog::NpcListDialog(Network *network):
- Window("NPC"), mNetwork(network)
+#ifdef TMWSERV_SUPPORT
+NpcListDialog::NpcListDialog()
+#else
+NpcListDialog::NpcListDialog(Network *network)
+#endif
+ : Window("NPC")
+#ifdef EATHENA_SUPPORT
+ , mNetwork(network)
+#endif
{
setWindowName("NPCList");
setResizable(true);
@@ -80,6 +91,11 @@ std::string NpcListDialog::getElementAt(int i)
return mItems[i];
}
+void NpcListDialog::addItem(const std::string &item)
+{
+ mItems.push_back(item);
+}
+
void NpcListDialog::parseItems(const std::string &itemString)
{
std::istringstream iss(itemString);
@@ -124,10 +140,14 @@ void NpcListDialog::action(const gcn::ActionEvent &event)
saveWindowState();
reset();
+#ifdef TMWSERV_SUPPORT
+ Net::GameServer::Player::selectFromNPC(current_npc, choice);
+#else
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_NPC_LIST_CHOICE);
outMsg.writeInt32(current_npc);
outMsg.writeInt8(choice);
+#endif
}
}