summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-01-23 05:29:04 +0200
committerAndrei Karas <akaras@inbox.ru>2011-01-23 05:29:04 +0200
commitd34c6e7b7048dbcead251c190fec5a7c584c0e3a (patch)
tree4246a7e299a9254c92a73903244e96d3fcd91f96
parent675463a45fcbfb05482a4f9398a6cfd9c052043b (diff)
downloadmanaplus-d34c6e7b7048dbcead251c190fec5a7c584c0e3a.tar.gz
manaplus-d34c6e7b7048dbcead251c190fec5a7c584c0e3a.tar.bz2
manaplus-d34c6e7b7048dbcead251c190fec5a7c584c0e3a.tar.xz
manaplus-d34c6e7b7048dbcead251c190fec5a7c584c0e3a.zip
Fix possible negative job level with tmw server.
-rw-r--r--src/gui/statuswindow.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index ed29be119..c4d8339e1 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -331,8 +331,15 @@ void StatusWindow::event(Channels channel _UNUSED_,
// then we fixing it :)
std::pair<int, int> exp
= PlayerInfo::getStatExperience(id);
- lvl = (exp.second - 20000) / 150;
- PlayerInfo::setStatBase(id, lvl);
+ if (exp.second < 20000)
+ {
+ lvl = 0;
+ }
+ else
+ {
+ lvl = (exp.second - 20000) / 150;
+ PlayerInfo::setStatBase(id, lvl);
+ }
}
mJobLvlLabel->setCaption(strprintf(_("Job: %d"), lvl));