summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-02-13 17:51:32 +0200
committerAndrei Karas <akaras@inbox.ru>2011-02-13 17:51:32 +0200
commit4a62b4f1eed406d74a998a158d442ad4cc04e5b9 (patch)
tree9062c386fd079c391cac3cc59f2be5a2781d1247 /src
parente0d746af17c486b66cdf37b5911ede05b08e9331 (diff)
downloadmanaplus-4a62b4f1eed406d74a998a158d442ad4cc04e5b9.tar.gz
manaplus-4a62b4f1eed406d74a998a158d442ad4cc04e5b9.tar.bz2
manaplus-4a62b4f1eed406d74a998a158d442ad4cc04e5b9.tar.xz
manaplus-4a62b4f1eed406d74a998a158d442ad4cc04e5b9.zip
Set weight notice message not modal and hide it after 10 seconds.
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp1
-rw-r--r--src/localplayer.cpp9
-rw-r--r--src/net/tmwa/playerhandler.cpp7
3 files changed, 15 insertions, 2 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 5984c35c7..4b133d400 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -111,6 +111,7 @@
Joystick *joystick = NULL;
OkDialog *weightNotice = NULL;
+int weightNoticeTime = 0;
OkDialog *deathNotice = NULL;
QuitDialog *quitDialog = NULL;
OkDialog *disconnectedDialog = NULL;
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index df4cad26f..b41f1d971 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -89,6 +89,8 @@ const short awayLimitTimer = 60;
LocalPlayer *player_node = NULL;
extern std::list<BeingCacheEntry*> beingInfoCache;
+extern OkDialog *weightNotice;
+extern int weightNoticeTime;
LocalPlayer::LocalPlayer(int id, int subtype):
Being(id, PLAYER, subtype, 0),
@@ -235,6 +237,13 @@ void LocalPlayer::logic()
}
}
+ if (weightNotice && weightNoticeTime < cur_time)
+ {
+ weightNotice->scheduleDelete();
+ weightNotice = 0;
+ weightNoticeTime = 0;
+ }
+
// Show XP messages
if (!mMessages.empty())
{
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index 528e727a3..ac4d42a2e 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -46,6 +46,7 @@
extern OkDialog *weightNotice;
extern OkDialog *deathNotice;
+extern int weightNoticeTime;
// Max. distance we are willing to scroll after a teleport;
// everything beyond will reset the port hard.
@@ -320,19 +321,21 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg)
= PlayerInfo::getAttribute(TOTAL_WEIGHT);
if (value >= max && total < max)
{
+ weightNoticeTime = cur_time + 10;
weightNotice = new OkDialog(_("Message"),
_("You are carrying more than "
"half your weight. You are "
- "unable to regain health."));
+ "unable to regain health."), false);
weightNotice->addActionListener(
&weightListener);
}
else if (value < max && total >= max)
{
+ weightNoticeTime = cur_time + 10;
weightNotice = new OkDialog(_("Message"),
_("You are carrying less than "
"half your weight. You are "
- "can regain health."));
+ "can regain health."), false);
weightNotice->addActionListener(
&weightListener);
}