From b4c187739022b9c2cec149c00f6291bde982b567 Mon Sep 17 00:00:00 2001 From: Björn Steinbrink Date: Sat, 27 Aug 2005 18:27:56 +0000 Subject: Update stats and status window contents at a single location. --- src/engine.cpp | 9 --------- src/game.cpp | 2 -- src/gui/stats.cpp | 7 +++++++ src/gui/stats.h | 7 ++++++- src/gui/status.cpp | 7 +++++++ src/gui/status.h | 7 ++++++- 6 files changed, 26 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/engine.cpp b/src/engine.cpp index 50e271de..97ba1c2c 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -43,8 +43,6 @@ #include "gui/gui.h" #include "gui/minimap.h" -#include "gui/stats.h" -#include "gui/status.h" #include "gui/windowcontainer.h" #include "resources/image.h" @@ -467,13 +465,6 @@ void Engine::draw() gcn::Graphics::CENTER); } - if (statsWindow->isVisible()) { - statsWindow->update(); - } - if (statusWindow->isVisible()) { - statusWindow->update(); - } - std::stringstream debugStream; debugStream << "[" << fps << " fps] " << mouseTileX << ", " << mouseTileY; diff --git a/src/game.cpp b/src/game.cpp index bbfbee9e..c40a052c 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1460,7 +1460,6 @@ void do_parse() player_node->aspd = RFIFOW(4); break; } - statusWindow->update(); if (char_info->hp == 0 && deathNotice == NULL) { deathNotice = new OkDialog("Message", "You're now dead, press ok to restart", @@ -1849,7 +1848,6 @@ void do_parse() char_info->DEXUp = RFIFOB(13); char_info->LUK = RFIFOB(14); char_info->LUKUp = RFIFOB(15); - statusWindow->update(); break; // Updates status point case 0x00be: diff --git a/src/gui/stats.cpp b/src/gui/stats.cpp index c5afe82d..f03d2bfc 100644 --- a/src/gui/stats.cpp +++ b/src/gui/stats.cpp @@ -142,6 +142,13 @@ StatsWindow::~StatsWindow() { delete remainingStatsPointsLabel; } +void StatsWindow::draw(gcn::Graphics *graphics) +{ + update(); + + Window::draw(graphics); +} + void StatsWindow::action(const std::string& eventId) { WFIFOW(0) = net_w_value(0x00bb); diff --git a/src/gui/stats.h b/src/gui/stats.h index 54bd892b..3d7d0f52 100644 --- a/src/gui/stats.h +++ b/src/gui/stats.h @@ -52,12 +52,17 @@ class StatsWindow : public Window, public gcn::ActionListener { */ void action(const std::string& eventId); + /** + * Draw this window + */ + void draw(gcn::Graphics *graphics); + + private: /** * Updates stats in window. */ void update(); - private: int i; /** diff --git a/src/gui/status.cpp b/src/gui/status.cpp index c903261c..7ba14fc7 100644 --- a/src/gui/status.cpp +++ b/src/gui/status.cpp @@ -206,6 +206,13 @@ void StatusWindow::update() delete[] tempstr; } +void StatusWindow::draw(gcn::Graphics *graphics) +{ + update(); + + Window::draw(graphics); +} + void StatusWindow::action(const std::string& eventId) { if (eventId == "Stats") { diff --git a/src/gui/status.h b/src/gui/status.h index 7ef57ed9..45ccb75d 100644 --- a/src/gui/status.h +++ b/src/gui/status.h @@ -55,12 +55,17 @@ class StatusWindow : public Window, public gcn::ActionListener { */ void action(const std::string& eventId); + /** + * Draw this window + */ + void draw(gcn::Graphics *graphics); + + private: /** * Updates this dialog with values from PLAYER_INFO *char_info */ void update(); - private: gcn::Label *hp, *sp; gcn::Label *hpValue, *spValue; gcn::Label *expLabel, *jobExpLabel; -- cgit v1.2.3-70-g09d2