summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-27 18:27:56 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-27 18:27:56 +0000
commitb4c187739022b9c2cec149c00f6291bde982b567 (patch)
tree655121a52a3534da1c0d4ab8153d3964fa39b71b
parentef571e7244d94237e59fc95317343da95efea6ce (diff)
downloadmana-b4c187739022b9c2cec149c00f6291bde982b567.tar.gz
mana-b4c187739022b9c2cec149c00f6291bde982b567.tar.bz2
mana-b4c187739022b9c2cec149c00f6291bde982b567.tar.xz
mana-b4c187739022b9c2cec149c00f6291bde982b567.zip
Update stats and status window contents at a single location.
-rw-r--r--ChangeLog4
-rw-r--r--src/engine.cpp9
-rw-r--r--src/game.cpp2
-rw-r--r--src/gui/stats.cpp7
-rw-r--r--src/gui/stats.h7
-rw-r--r--src/gui/status.cpp7
-rw-r--r--src/gui/status.h7
7 files changed, 30 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index cd5fb93c..2086bd54 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2005-08-27 Björn Steinbrink <B.Steinbrink@gmx.de>
+ * src/engine.cpp, src/game.cpp, src/gui/stats.cpp, src/gui/stats.h,
+ src/gui/status.cpp, src/gui/status.h: Update the stats and status
+ window contents only at a single location and let them do it
+ automagically.
* src/gui/updatewindow.cpp, src/gui/updatewindow.h: Small cleanups.
2005-08-25 Ferreira Yohann <bertram@cegetel.net>
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
@@ -53,11 +53,16 @@ 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
@@ -56,11 +56,16 @@ 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;