diff options
author | Duane Bailey <nayryeliab@gmail.com> | 2005-09-18 15:22:30 +0000 |
---|---|---|
committer | Duane Bailey <nayryeliab@gmail.com> | 2005-09-18 15:22:30 +0000 |
commit | 90cc1c54dc36574f56cde0306c11d3abc43fc893 (patch) | |
tree | ea69fdfe5c92aef0126a937c39d40c0d8ee9c069 /src/game.cpp | |
parent | f22625d0e79cd943acf117c1e5bd32e4bbef5a2a (diff) | |
download | mana-client-90cc1c54dc36574f56cde0306c11d3abc43fc893.tar.gz mana-client-90cc1c54dc36574f56cde0306c11d3abc43fc893.tar.bz2 mana-client-90cc1c54dc36574f56cde0306c11d3abc43fc893.tar.xz mana-client-90cc1c54dc36574f56cde0306c11d3abc43fc893.zip |
2005-09-18 Duane Bailey <nayryeliab@gmail.com>
* src/game.cpp: added code so that wehn someone starts carrying
more then half thier max weight.
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
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(); |