diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-01-23 05:21:34 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-01-23 05:21:34 +0200 |
commit | 675463a45fcbfb05482a4f9398a6cfd9c052043b (patch) | |
tree | dfd91e43142a2f4eda9e9094203754ef70558177 | |
parent | 63112267be277e38224b510ec5745421dd7d4917 (diff) | |
download | manaplus-675463a45fcbfb05482a4f9398a6cfd9c052043b.tar.gz manaplus-675463a45fcbfb05482a4f9398a6cfd9c052043b.tar.bz2 manaplus-675463a45fcbfb05482a4f9398a6cfd9c052043b.tar.xz manaplus-675463a45fcbfb05482a4f9398a6cfd9c052043b.zip |
Recover job level from job experience.
-rw-r--r-- | src/gui/statuswindow.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 853ea1789..ed29be119 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -324,8 +324,18 @@ void StatusWindow::event(Channels channel _UNUSED_, { if (mJobLvlLabel) { - mJobLvlLabel->setCaption(strprintf(_("Job: %d"), - PlayerInfo::getStatBase(id))); + int lvl = PlayerInfo::getStatBase(id); + if (!lvl) + { + // possible server corrupted and dont send job level, + // then we fixing it :) + std::pair<int, int> exp + = PlayerInfo::getStatExperience(id); + lvl = (exp.second - 20000) / 150; + PlayerInfo::setStatBase(id, lvl); + } + + mJobLvlLabel->setCaption(strprintf(_("Job: %d"), lvl)); mJobLvlLabel->adjustSize(); updateProgressBar(mJobBar, id, false); |