From d0b6e591fbaf3db5fc9898e75913e57a3c32169a Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 9 Nov 2013 13:31:30 +0000 Subject: Update player statistics while the reputation menu is open. --- src/client/reputationwindow.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/client/reputationwindow.cc') 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(); -- cgit v1.2.3