summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/npc_text.cpp8
-rw-r--r--src/gui/npc_text.h2
-rw-r--r--src/gui/npclistdialog.cpp4
-rw-r--r--src/net/npchandler.cpp1
-rw-r--r--src/net/protocol.h18
5 files changed, 23 insertions, 10 deletions
diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp
index b94e8aa4..ec8a4b6e 100644
--- a/src/gui/npc_text.cpp
+++ b/src/gui/npc_text.cpp
@@ -38,6 +38,7 @@ NpcTextDialog::NpcTextDialog(Network *network):
Window(_("NPC")), mNetwork(network)
{
setResizable(true);
+ setCloseButton(true);
setMinWidth(200);
setMinHeight(150);
@@ -103,6 +104,13 @@ void NpcTextDialog::nextDialog(int npcID)
outMsg.writeInt32(npcID);
}
+void NpcTextDialog::closeDialog(int npcID)
+{
+ MessageOut outMsg(mNetwork);
+ outMsg.writeInt16(CMSG_NPC_CLOSE);
+ outMsg.writeInt32(npcID);
+}
+
void NpcTextDialog::widgetResized(const gcn::Event &event)
{
Window::widgetResized(event);
diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h
index a72de5d0..615902db 100644
--- a/src/gui/npc_text.h
+++ b/src/gui/npc_text.h
@@ -76,6 +76,8 @@ class NpcTextDialog : public Window, public gcn::ActionListener
void nextDialog(int npcID = current_npc);
+ void closeDialog(int npcID = current_npc);
+
/**
* Called when resizing the window.
*
diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp
index 73b00239..c639411d 100644
--- a/src/gui/npclistdialog.cpp
+++ b/src/gui/npclistdialog.cpp
@@ -58,8 +58,8 @@ NpcListDialog::NpcListDialog(Network *network):
scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
place(0, 0, scrollArea, 5).setPadding(3);
- place(3, 1, okButton);
- place(4, 1, cancelButton);
+ place(3, 1, cancelButton);
+ place(4, 1, okButton);
Layout &layout = getLayout();
layout.setRowHeight(0, Layout::AUTO_SET);
diff --git a/src/net/npchandler.cpp b/src/net/npchandler.cpp
index 1161bc36..41af4467 100644
--- a/src/net/npchandler.cpp
+++ b/src/net/npchandler.cpp
@@ -76,6 +76,7 @@ void NPCHandler::handleMessage(MessageIn *msg)
id = msg->readInt32();
if (current_npc == id)
current_npc = 0;
+ npcTextDialog->closeDialog(id);
break;
case SMSG_NPC_NEXT:
diff --git a/src/net/protocol.h b/src/net/protocol.h
index 081f8873..645d667f 100644
--- a/src/net/protocol.h
+++ b/src/net/protocol.h
@@ -122,30 +122,32 @@
#define CMSG_TRADE_RESPONSE 0x00e6
#define CMSG_ITEM_PICKUP 0x009f
#define CMSG_MAP_LOADED 0x007d
-#define CMSG_NPC_BUY_REQUEST 0x00c8
-#define CMSG_NPC_BUY_SELL_REQUEST 0x00c5
#define CMSG_CHAT_MESSAGE 0x008c
#define CMSG_CHAT_WHISPER 0x0096
#define CMSG_CHAT_ANNOUNCE 0x0099
#define CMSG_CHAT_WHO 0x00c1
-#define CMSG_NPC_LIST_CHOICE 0x00b8
-#define CMSG_NPC_NEXT_REQUEST 0x00b9
-#define CMSG_NPC_SELL_REQUEST 0x00c9
-#define CMSG_NPC_INT_RESPONSE 0x0143
-#define CMSG_NPC_STR_RESPONSE 0x01d5
#define CMSG_SKILL_LEVELUP_REQUEST 0x0112
#define CMSG_STAT_UPDATE_REQUEST 0x00bb
#define CMSG_TRADE_ITEM_ADD_REQUEST 0x00e8
#define CMSG_TRADE_CANCEL_REQUEST 0x00ed
#define CMSG_TRADE_ADD_COMPLETE 0x00eb
#define CMSG_TRADE_OK 0x00ef
-#define CMSG_NPC_TALK 0x0090
#define CMSG_TRADE_REQUEST 0x00e4
#define CMSG_PLAYER_INVENTORY_USE 0x00a7
#define CMSG_PLAYER_INVENTORY_DROP 0x00a2
#define CMSG_PLAYER_EQUIP 0x00a9
#define CMSG_PLAYER_UNEQUIP 0x00ab
+#define CMSG_NPC_TALK 0x0090
+#define CMSG_NPC_NEXT_REQUEST 0x00b9
+#define CMSG_NPC_CLOSE 0x0146
+#define CMSG_NPC_LIST_CHOICE 0x00b8
+#define CMSG_NPC_INT_RESPONSE 0x0143
+#define CMSG_NPC_STR_RESPONSE 0x01d5
+#define CMSG_NPC_BUY_SELL_REQUEST 0x00c5
+#define CMSG_NPC_BUY_REQUEST 0x00c8
+#define CMSG_NPC_SELL_REQUEST 0x00c9
+
#define CMSG_PARTY_CREATE 0x00f9
#define CMSG_PARTY_INVITE 0x00fc
#define CMSG_PARTY_INVITED 0x00ff