summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuane Bailey <nayryeliab@gmail.com>2005-09-18 15:22:30 +0000
committerDuane Bailey <nayryeliab@gmail.com>2005-09-18 15:22:30 +0000
commit90cc1c54dc36574f56cde0306c11d3abc43fc893 (patch)
treeea69fdfe5c92aef0126a937c39d40c0d8ee9c069
parentf22625d0e79cd943acf117c1e5bd32e4bbef5a2a (diff)
downloadmana-90cc1c54dc36574f56cde0306c11d3abc43fc893.tar.gz
mana-90cc1c54dc36574f56cde0306c11d3abc43fc893.tar.bz2
mana-90cc1c54dc36574f56cde0306c11d3abc43fc893.tar.xz
mana-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.
-rw-r--r--ChangeLog6
-rw-r--r--src/game.cpp24
2 files changed, 29 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 103a0a9a..8899a100 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-09-18 Duane Bailey <nayryeliab@gmail.com>
+
+ * game.cpp: added weight notice; now notifies person when they
+ are carrying more then half their weight
+
2005-09-18 Yohann Ferreira <bertram@cegetel.net>
* src/game.cpp, src/graphics.cpp, src/graphics.h,
@@ -30,6 +35,7 @@
png.
2005-09-17 Duane Bailey <nayryeliab@gmail.com>
+>>>>>>> 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();