SCUMM: cleanup SaveLoadChooser::updateInfos code

svn-id: r33640
This commit is contained in:
Max Horn 2008-08-05 13:11:22 +00:00
parent bedebaccc3
commit 8d830effc1

View file

@ -372,30 +372,23 @@ void SaveLoadChooser::updateInfos(bool redraw) {
_gfxWidget->setGfx(thumb); _gfxWidget->setGfx(thumb);
_gfxWidget->useAlpha(256); _gfxWidget->useAlpha(256);
thumb->free(); thumb->free();
delete thumb;
} else { } else {
_gfxWidget->setGfx(-1, -1, _fillR, _fillG, _fillB); _gfxWidget->setGfx(-1, -1, _fillR, _fillG, _fillB);
} }
delete thumb;
if (redraw)
_gfxWidget->draw();
InfoStuff infos; InfoStuff infos;
memset(&infos, 0, sizeof(InfoStuff)); memset(&infos, 0, sizeof(InfoStuff));
char buffer[32];
if (selItem >= 0 && _vm->loadInfosFromSlot(_saveMode ? selItem + 1 : selItem, &infos)) { if (selItem >= 0 && _vm->loadInfosFromSlot(_saveMode ? selItem + 1 : selItem, &infos)) {
char buffer[32];
snprintf(buffer, 32, "Date: %.2d.%.2d.%.4d", snprintf(buffer, 32, "Date: %.2d.%.2d.%.4d",
(infos.date >> 24) & 0xFF, (infos.date >> 16) & 0xFF, (infos.date >> 24) & 0xFF, (infos.date >> 16) & 0xFF,
infos.date & 0xFFFF); infos.date & 0xFFFF);
_date->setLabel(buffer); _date->setLabel(buffer);
if (redraw)
_date->draw();
snprintf(buffer, 32, "Time: %.2d:%.2d", snprintf(buffer, 32, "Time: %.2d:%.2d",
(infos.time >> 8) & 0xFF, infos.time & 0xFF); (infos.time >> 8) & 0xFF, infos.time & 0xFF);
_time->setLabel(buffer); _time->setLabel(buffer);
if (redraw)
_time->draw();
int minutes = infos.playtime / 60; int minutes = infos.playtime / 60;
int hours = minutes / 60; int hours = minutes / 60;
@ -404,23 +397,17 @@ void SaveLoadChooser::updateInfos(bool redraw) {
snprintf(buffer, 32, "Playtime: %.2d:%.2d", snprintf(buffer, 32, "Playtime: %.2d:%.2d",
hours & 0xFF, minutes & 0xFF); hours & 0xFF, minutes & 0xFF);
_playtime->setLabel(buffer); _playtime->setLabel(buffer);
if (redraw)
_playtime->draw();
} else { } else {
snprintf(buffer, 32, "No date saved"); _date->setLabel("No date saved");
_date->setLabel(buffer); _time->setLabel("No time saved");
if (redraw) _playtime->setLabel("No playtime saved");
_date->draw(); }
snprintf(buffer, 32, "No time saved"); if (redraw) {
_time->setLabel(buffer); _gfxWidget->draw();
if (redraw) _date->draw();
_time->draw(); _time->draw();
_playtime->draw();
snprintf(buffer, 32, "No playtime saved");
_playtime->setLabel(buffer);
if (redraw)
_playtime->draw();
} }
} }