aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2008-07-14 21:00:39 +0000
committerWillem Jan Palenstijn2008-07-14 21:00:39 +0000
commitff5f3730c57a81816e3bc2e3365c4fc30701ca1f (patch)
treec0433f8c044c59776351400610ab4371207645a9 /engines/scumm
parent9c91f091ff7a389da31534bce99908ba4e856163 (diff)
downloadscummvm-rg350-ff5f3730c57a81816e3bc2e3365c4fc30701ca1f.tar.gz
scummvm-rg350-ff5f3730c57a81816e3bc2e3365c4fc30701ca1f.tar.bz2
scummvm-rg350-ff5f3730c57a81816e3bc2e3365c4fc30701ca1f.zip
Don't draw scumm saveload dialog while reflowing layout, as that would use uninitialized values
svn-id: r33063
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/dialogs.cpp33
-rw-r--r--engines/scumm/dialogs.h2
2 files changed, 24 insertions, 11 deletions
diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
index 6d1cf1bbd8..89532b8961 100644
--- a/engines/scumm/dialogs.cpp
+++ b/engines/scumm/dialogs.cpp
@@ -31,6 +31,8 @@
#include "graphics/scaler.h"
+#include "valgrind/memcheck.h"
+
#ifdef __DS__
#include "scummhelp.h"
#endif
@@ -297,7 +299,7 @@ void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 da
break;
case GUI::kListSelectionChangedCmd: {
if (_gfxWidget) {
- updateInfos();
+ updateInfos(true);
}
if (_saveMode) {
@@ -326,6 +328,10 @@ void SaveLoadChooser::reflowLayout() {
_container->resize(thumbX - hPad, thumbY - vPad, kThumbnailWidth + hPad * 2, thumbH + vPad * 2 + kLineHeight * 4);
+ VALGRIND_CHECK_VALUE_IS_DEFINED(thumbX);
+ VALGRIND_CHECK_VALUE_IS_DEFINED(thumbY);
+ VALGRIND_CHECK_VALUE_IS_DEFINED(thumbH);
+
// Add the thumbnail display
_gfxWidget->resize(thumbX, thumbY, kThumbnailWidth, thumbH);
@@ -350,7 +356,7 @@ void SaveLoadChooser::reflowLayout() {
_fillR = g_gui.evaluator()->getVar("scummsaveload_thumbnail.fillR");
_fillG = g_gui.evaluator()->getVar("scummsaveload_thumbnail.fillG");
_fillB = g_gui.evaluator()->getVar("scummsaveload_thumbnail.fillB");
- updateInfos();
+ updateInfos(false);
} else {
_container->setFlags(GUI::WIDGET_INVISIBLE);
_gfxWidget->setFlags(GUI::WIDGET_INVISIBLE);
@@ -362,7 +368,7 @@ void SaveLoadChooser::reflowLayout() {
Dialog::reflowLayout();
}
-void SaveLoadChooser::updateInfos() {
+void SaveLoadChooser::updateInfos(bool draw) {
int selItem = _list->getSelected();
Graphics::Surface *thumb;
thumb = _vm->loadThumbnailFromSlot(_saveMode ? selItem + 1 : selItem);
@@ -376,7 +382,8 @@ void SaveLoadChooser::updateInfos() {
}
delete thumb;
- _gfxWidget->draw();
+ if (draw)
+ _gfxWidget->draw();
InfoStuff infos;
memset(&infos, 0, sizeof(InfoStuff));
@@ -386,12 +393,14 @@ void SaveLoadChooser::updateInfos() {
(infos.date >> 24) & 0xFF, (infos.date >> 16) & 0xFF,
infos.date & 0xFFFF);
_date->setLabel(buffer);
- _date->draw();
+ if (draw)
+ _date->draw();
snprintf(buffer, 32, "Time: %.2d:%.2d",
(infos.time >> 8) & 0xFF, infos.time & 0xFF);
_time->setLabel(buffer);
- _time->draw();
+ if (draw)
+ _time->draw();
int minutes = infos.playtime / 60;
int hours = minutes / 60;
@@ -400,19 +409,23 @@ void SaveLoadChooser::updateInfos() {
snprintf(buffer, 32, "Playtime: %.2d:%.2d",
hours & 0xFF, minutes & 0xFF);
_playtime->setLabel(buffer);
- _playtime->draw();
+ if (draw)
+ _playtime->draw();
} else {
snprintf(buffer, 32, "No date saved");
_date->setLabel(buffer);
- _date->draw();
+ if (draw)
+ _date->draw();
snprintf(buffer, 32, "No time saved");
_time->setLabel(buffer);
- _time->draw();
+ if (draw)
+ _time->draw();
snprintf(buffer, 32, "No playtime saved");
_playtime->setLabel(buffer);
- _playtime->draw();
+ if (draw)
+ _playtime->draw();
}
}
diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h
index 7c99a0ebcc..730952676c 100644
--- a/engines/scumm/dialogs.h
+++ b/engines/scumm/dialogs.h
@@ -69,7 +69,7 @@ protected:
uint8 _fillR, _fillG, _fillB;
- void updateInfos();
+ void updateInfos(bool draw);
public:
SaveLoadChooser(const String &title, const String &buttonLabel, bool saveMode, ScummEngine *engine);
~SaveLoadChooser();