From 90cc1c54dc36574f56cde0306c11d3abc43fc893 Mon Sep 17 00:00:00 2001 From: Duane Bailey Date: Sun, 18 Sep 2005 15:22:30 +0000 Subject: 2005-09-18 Duane Bailey * src/game.cpp: added code so that wehn someone starts carrying more then half thier max weight. --- ChangeLog | 6 ++++++ src/game.cpp | 24 +++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 103a0a9a..8899a100 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-09-18 Duane Bailey + + * game.cpp: added weight notice; now notifies person when they + are carrying more then half their weight + 2005-09-18 Yohann Ferreira * src/game.cpp, src/graphics.cpp, src/graphics.h, @@ -30,6 +35,7 @@ png. 2005-09-17 Duane Bailey +>>>>>>> 1.203 * src/net/messagin.cpp, src/net/messageout.cpp, src/net/network.cpp: removed replaced MACOSX defines with big endian defines diff --git a/src/game.cpp b/src/game.cpp index 98dbb318..88990ee1 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -91,6 +91,7 @@ Being *autoTarget = NULL; Engine *engine = NULL; SDL_Joystick *joypad = NULL; /**< Joypad object */ +OkDialog *weightNotice = NULL; OkDialog *deathNotice = NULL; ConfirmDialog *exitConfirm = NULL; @@ -120,10 +121,20 @@ Inventory *inventory = NULL; const int EMOTION_TIME = 150; /**< Duration of emotion icon */ const int MAX_TIME = 10000; +class WeightNoticeListener : public gcn::ActionListener +{ +public: + void action(const std::string &eventId) + { + weightNotice = NULL; + } +} weightNoticeListener; + + /** * Listener used for handling death message. */ -class DeatchNoticeListener : public gcn::ActionListener { +class DeathNoticeListener : public gcn::ActionListener { public: void action(const std::string &eventId) { MessageOut outMsg; @@ -511,6 +522,10 @@ void do_input() { deathNotice->action("ok"); } + else if (weightNotice) + { + weightNotice->action("ok"); + } // Close the Browser if opened else if (helpWindow->isVisible()) { @@ -1561,6 +1576,13 @@ void do_parse() break; case 0x0018: player_info->totalWeight = msg.readLong(); + if (player_info->totalWeight >= player_info->maxWeight) + { + weightNotice = new OkDialog("Message", + "You are carrying more then half your weight. You are unable to regain health.", + &weightNoticeListener); + weightNotice->releaseModalFocus(); + } break; case 0x0019: player_info->maxWeight = msg.readLong(); -- cgit v1.2.3-70-g09d2