From 061b9e817ffe73acca163510b276e6ca7dd8f6c2 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 3 Dec 2006 17:00:07 +0000 Subject: Made NPC names visible. Windows are now invisible by default. --- src/net/beinghandler.cpp | 23 ++++++++++++++++------- src/net/npchandler.cpp | 8 ++++++-- src/net/playerhandler.cpp | 20 +++++++++++++------- 3 files changed, 35 insertions(+), 16 deletions(-) (limited to 'src/net') diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index 5a1ed1e5..3fe3059d 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -107,7 +107,8 @@ void BeingHandler::handleMessage(MessageIn *msg) dstBeing->mJob = job; dstBeing->setHairStyle(msg->readInt16()); dstBeing->setWeapon(msg->readInt16()); - dstBeing->setVisibleEquipment(Being::BOTTOMCLOTHES_SPRITE, msg->readInt16()); // head bottom + dstBeing->setVisibleEquipment( + Being::BOTTOMCLOTHES_SPRITE, msg->readInt16()); if (msg->getId() == SMSG_BEING_MOVE) { @@ -115,8 +116,9 @@ void BeingHandler::handleMessage(MessageIn *msg) } msg->readInt16(); // shield - dstBeing->setVisibleEquipment(Being::HAT_SPRITE, msg->readInt16()); // head top - dstBeing->setVisibleEquipment(Being::TOPCLOTHES_SPRITE, msg->readInt16()); // head mid + dstBeing->setVisibleEquipment(Being::HAT_SPRITE, msg->readInt16()); + dstBeing->setVisibleEquipment( + Being::TOPCLOTHES_SPRITE, msg->readInt16()); dstBeing->setHairColor(msg->readInt16()); msg->readInt16(); // unknown msg->readInt16(); // head dir @@ -255,13 +257,19 @@ void BeingHandler::handleMessage(MessageIn *msg) switch (msg->readInt8()) { case 3: - dstBeing->setVisibleEquipment(Being::BOTTOMCLOTHES_SPRITE, msg->readInt8()); + dstBeing->setVisibleEquipment( + Being::BOTTOMCLOTHES_SPRITE, + msg->readInt8()); break; case 4: - dstBeing->setVisibleEquipment(Being::HAT_SPRITE, msg->readInt8()); + dstBeing->setVisibleEquipment( + Being::HAT_SPRITE, + msg->readInt8()); break; case 5: - dstBeing->setVisibleEquipment(Being::TOPCLOTHES_SPRITE, msg->readInt8()); + dstBeing->setVisibleEquipment( + Being::TOPCLOTHES_SPRITE, + msg->readInt8()); break; } break; @@ -322,7 +330,8 @@ void BeingHandler::handleMessage(MessageIn *msg) msg->readInt16(); // manner msg->readInt8(); // karma dstBeing->setSex(1 - msg->readInt8()); // sex - dstBeing->setVisibleEquipment(Being::BOTTOMCLOTHES_SPRITE, headBottom); + dstBeing->setVisibleEquipment( + Being::BOTTOMCLOTHES_SPRITE, headBottom); dstBeing->setVisibleEquipment(Being::HAT_SPRITE, headTop); dstBeing->setVisibleEquipment(Being::TOPCLOTHES_SPRITE, headMid); diff --git a/src/net/npchandler.cpp b/src/net/npchandler.cpp index a803710e..da21b2a5 100644 --- a/src/net/npchandler.cpp +++ b/src/net/npchandler.cpp @@ -49,18 +49,22 @@ NPCHandler::NPCHandler() void NPCHandler::handleMessage(MessageIn *msg) { + int id; + switch (msg->getId()) { case SMSG_NPC_CHOICE: msg->readInt16(); // length - current_npc = dynamic_cast(beingManager->findBeing(msg->readInt32())); + id = msg->readInt32(); + current_npc = dynamic_cast(beingManager->findBeing(id)); npcListDialog->parseItems(msg->readString(msg->getLength() - 8)); npcListDialog->setVisible(true); break; case SMSG_NPC_MESSAGE: msg->readInt16(); // length - current_npc = dynamic_cast(beingManager->findBeing(msg->readInt32())); + id = msg->readInt32(); + current_npc = dynamic_cast(beingManager->findBeing(id)); npcTextDialog->addText(msg->readString(msg->getLength() - 8)); npcListDialog->setVisible(false); npcTextDialog->setVisible(true); diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp index 3786cd0b..e83bcce8 100644 --- a/src/net/playerhandler.cpp +++ b/src/net/playerhandler.cpp @@ -46,7 +46,10 @@ OkDialog *deathNotice = NULL; namespace { struct WeightListener : public gcn::ActionListener { - void action(const std::string& eventId, gcn::Widget* widget) { weightNotice = NULL; } + void action(const std::string &eventId, gcn::Widget *widget) + { + weightNotice = NULL; + } } weightListener; } @@ -55,8 +58,10 @@ namespace { */ // TODO Move somewhere else namespace { - struct DeathListener : public gcn::ActionListener { - void action(const std::string& eventId, gcn::Widget* widget) { + struct DeathListener : public gcn::ActionListener + { + void action(const std::string &eventId, gcn::Widget *widget) + { player_node->revive(); deathNotice = NULL; } @@ -137,10 +142,11 @@ void PlayerHandler::handleMessage(MessageIn *msg) player_node->mMaxWeight / 2) { weightNotice = new OkDialog("Message", - "You are carrying more then half your " - "weight. You are unable to regain " - "health."); - weightNotice->addActionListener(&weightListener); + "You are carrying more then half " + "your weight. You are unable to " + "regain health."); + weightNotice->addActionListener( + &weightListener); } player_node->mTotalWeight = value; break; -- cgit v1.2.3-60-g2f50