diff options
author | Stijn Buys <ingar@osirion.org> | 2013-11-09 13:31:30 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2013-11-09 13:31:30 +0000 |
commit | d0b6e591fbaf3db5fc9898e75913e57a3c32169a (patch) | |
tree | 7be122da56f6aca03755ad9b6a272a9c4d2125ba | |
parent | be06560334a8f9b5e290a5a5ef1dc4916c55b691 (diff) |
Update player statistics while the reputation menu is open.
-rw-r--r-- | src/client/reputationwindow.cc | 21 | ||||
-rw-r--r-- | src/client/reputationwindow.h | 11 |
2 files changed, 31 insertions, 1 deletions
diff --git a/src/client/reputationwindow.cc b/src/client/reputationwindow.cc index bc1217c..2d15319 100644 --- a/src/client/reputationwindow.cc +++ b/src/client/reputationwindow.cc @@ -85,6 +85,9 @@ private: ReputationWindow::ReputationWindow(ui::Widget *parent) : ui::Window(parent) { + reputationwindow_info = 0; + reputationwindow_timestamp = 0; + // window title reputationwindow_titlelabel = new ui::Label(this); reputationwindow_titlelabel->set_label("title"); @@ -181,8 +184,11 @@ void ReputationWindow::set_info(const core::Info *info) { reputationwindow_infotext.clear(); reputationwindow_targetlabel->clear(); + reputationwindow_info = info; if (!info) { + reputationwindow_timestamp = 0; + // player name reputationwindow_targetlabel->set_text(core::localplayer()->name()); @@ -248,6 +254,7 @@ void ReputationWindow::set_info(const core::Info *info) core::game()->request_info(info->id()); reputationwindow_targetlabel->set_text(info->name()); + reputationwindow_timestamp = info->timestamp(); for (core::Info::Text::const_iterator it = info->text().begin(); it != info->text().end(); it++) { reputationwindow_infotext.push_back((*it)); @@ -255,6 +262,20 @@ void ReputationWindow::set_info(const core::Info *info) } } +void ReputationWindow::draw() +{ + if (!reputationwindow_info) { + // update player info + set_info(0); + + } else if (reputationwindow_timestamp != reputationwindow_info->timestamp()) { + // update faction info if we received updates from the server + set_info(reputationwindow_info); + } + + ui::Window::draw(); +} + void ReputationWindow::resize() { const float padding = ui::root()->font_large()->height(); diff --git a/src/client/reputationwindow.h b/src/client/reputationwindow.h index ca0c56b..b6c95c7 100644 --- a/src/client/reputationwindow.h +++ b/src/client/reputationwindow.h @@ -39,7 +39,12 @@ public: * */ virtual void show(); -protected: +protected: + /** + * @brief draw event handler + * */ + virtual void draw(); + /** * @brief resize event handler * */ @@ -73,6 +78,10 @@ private: ui::Widget *reputationwindow_pane_right; + const core::Info *reputationwindow_info; + + unsigned long reputationwindow_timestamp; + }; // class ReputationWindow } // namespace client |