summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/beinghandler.cpp7
-rw-r--r--src/net/buysellhandler.cpp23
-rw-r--r--src/net/npchandler.cpp11
-rw-r--r--src/net/playerhandler.cpp7
4 files changed, 22 insertions, 26 deletions
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index 982667d1..b706b088 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -211,7 +211,7 @@ void BeingHandler::handleMessage(MessageIn *msg)
id = msg->readInt32();
if (id == current_npc)
- npcTextDialog->showCloseButton();
+ npcTextDialog->showCloseButton();
dstBeing = beingManager->findBeing(id);
@@ -456,11 +456,6 @@ void BeingHandler::handleMessage(MessageIn *msg)
{
switch (msg->readInt8())
{
- case 1:
- if (dstBeing->getType() != Being::NPC)
- dstBeing->setAction(Being::DEAD);
- break;
-
case 2:
dstBeing->setAction(Being::SIT);
break;
diff --git a/src/net/buysellhandler.cpp b/src/net/buysellhandler.cpp
index 714bc0ea..65f8498a 100644
--- a/src/net/buysellhandler.cpp
+++ b/src/net/buysellhandler.cpp
@@ -88,7 +88,8 @@ void BuySellHandler::handleMessage(MessageIn *msg)
case SMSG_NPC_SELL:
msg->readInt16(); // length
n_items = (msg->getLength() - 4) / 10;
- if (n_items > 0) {
+ if (n_items > 0)
+ {
sellDialog->setMoney(player_node->mGp);
sellDialog->reset();
sellDialog->setVisible(true);
@@ -100,21 +101,25 @@ void BuySellHandler::handleMessage(MessageIn *msg)
msg->readInt32(); // OCvalue
Item *item = player_node->getInventory()->getItem(index);
- if (item && !(item->isEquipped())) {
+
+ if (item && !(item->isEquipped()))
sellDialog->addItem(item, value);
- }
}
}
- else {
+ else
+ {
chatWindow->chatLog(_("Nothing to sell"), BY_SERVER);
current_npc = 0;
}
break;
case SMSG_NPC_BUY_RESPONSE:
- if (msg->readInt8() == 0) {
+ if (msg->readInt8() == 0)
+ {
chatWindow->chatLog(_("Thanks for buying"), BY_SERVER);
- } else {
+ }
+ else
+ {
// Reset player money since buy dialog already assumed purchase
// would go fine
buyDialog->setMoney(player_node->mGp);
@@ -123,11 +128,11 @@ void BuySellHandler::handleMessage(MessageIn *msg)
break;
case SMSG_NPC_SELL_RESPONSE:
- if (msg->readInt8() == 0) {
+ if (msg->readInt8() == 0)
chatWindow->chatLog(_("Thanks for selling"), BY_SERVER);
- } else {
+ else
chatWindow->chatLog(_("Unable to sell"), BY_SERVER);
- }
+
break;
}
}
diff --git a/src/net/npchandler.cpp b/src/net/npchandler.cpp
index 405217bb..2ecd4726 100644
--- a/src/net/npchandler.cpp
+++ b/src/net/npchandler.cpp
@@ -19,6 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <SDL_types.h>
+
#include "messagein.h"
#include "npchandler.h"
#include "protocol.h"
@@ -32,11 +34,6 @@
#include "../gui/npclistdialog.h"
#include "../gui/npcstringdialog.h"
-extern NpcIntegerDialog *npcIntegerDialog;
-extern NpcListDialog *npcListDialog;
-extern NpcTextDialog *npcTextDialog;
-extern NpcStringDialog *npcStringDialog;
-
NPCHandler::NPCHandler()
{
static const Uint16 _messages[] = {
@@ -53,7 +50,7 @@ NPCHandler::NPCHandler()
void NPCHandler::handleMessage(MessageIn *msg)
{
- int id;
+ Uint32 id;
switch (msg->getId())
{
@@ -63,6 +60,7 @@ void NPCHandler::handleMessage(MessageIn *msg)
player_node->setAction(LocalPlayer::STAND);
npcListDialog->parseItems(msg->readString(msg->getLength() - 8));
npcListDialog->setVisible(true);
+ npcListDialog->requestFocus();
break;
case SMSG_NPC_MESSAGE:
@@ -70,7 +68,6 @@ void NPCHandler::handleMessage(MessageIn *msg)
current_npc = msg->readInt32();
player_node->setAction(LocalPlayer::STAND);
npcTextDialog->addText(msg->readString(msg->getLength() - 8));
- npcListDialog->setVisible(false);
npcTextDialog->setVisible(true);
break;
diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp
index 550753b7..7790cdd0 100644
--- a/src/net/playerhandler.cpp
+++ b/src/net/playerhandler.cpp
@@ -48,10 +48,6 @@
OkDialog *weightNotice = NULL;
OkDialog *deathNotice = NULL;
-extern NpcIntegerDialog *npcIntegerDialog;
-extern NpcListDialog *npcListDialog;
-extern NpcStringDialog *npcStringDialog;
-extern NpcTextDialog *npcTextDialog;
extern BuyDialog *buyDialog;
extern SellDialog *sellDialog;
extern Window *buySellDialog;
@@ -85,8 +81,11 @@ namespace {
{
player_node->revive();
deathNotice = NULL;
+ npcIntegerDialog->reset();
npcIntegerDialog->setVisible(false);
+ npcListDialog->reset();
npcListDialog->setVisible(false);
+ npcStringDialog->setValue("");
npcStringDialog->setVisible(false);
npcTextDialog->clearText();
npcTextDialog->setVisible(false);