[Scummvm-git-logs] scummvm master -> 07c20aa94b803cc034b6fd56f3115a2878a0b675
mduggan
noreply at scummvm.org
Sat Apr 5 10:03:59 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
07c20aa94b GUI: Partially revert c++11 iterators in saveload-dialog
Commit: 07c20aa94b803cc034b6fd56f3115a2878a0b675
https://github.com/scummvm/scummvm/commit/07c20aa94b803cc034b6fd56f3115a2878a0b675
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-04-05T21:02:48+11:00
Commit Message:
GUI: Partially revert c++11 iterators in saveload-dialog
This loop needs to update the iterator after doing an insertion to correctly
skip empty slots.
This partially reverts e157b7044e0588e0178b21cc2c6edf6b6084fe56.
This fixes #15850.
Changed paths:
gui/saveload-dialog.cpp
diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp
index a8ec970bb0e..e111a8b2bfd 100644
--- a/gui/saveload-dialog.cpp
+++ b/gui/saveload-dialog.cpp
@@ -749,9 +749,9 @@ void SaveLoadChooserSimple::updateSaveList(bool external) {
Common::U32StringArray saveNames;
ThemeEngine::FontColor color = ThemeEngine::kFontColorNormal;
Common::U32String emptyDesc;
- for (const auto &x : _saveList) {
+ for (SaveStateList::const_iterator x = _saveList.begin(); x != _saveList.end(); ++x) {
// Handle gaps in the list of save games
- saveSlot = x.getSaveSlot();
+ saveSlot = x->getSaveSlot();
if (curSlot < saveSlot) {
while (curSlot < saveSlot) {
SaveStateDescriptor dummySave(_metaEngine, curSlot, "");
@@ -761,21 +761,21 @@ void SaveLoadChooserSimple::updateSaveList(bool external) {
}
// Sync the save list iterator
- for (auto &y : _saveList) {
- if (y.getSaveSlot() == saveSlot)
+ for (x = _saveList.begin(); x != _saveList.end(); ++x) {
+ if (x->getSaveSlot() == saveSlot)
break;
}
}
// Show "Untitled saved game" for empty/whitespace saved game descriptions
- Common::U32String description = x.getDescription();
+ Common::U32String description = x->getDescription();
Common::U32String trimmedDescription = description;
trimmedDescription.trim();
if (trimmedDescription.empty()) {
description = _("Untitled saved game");
color = ThemeEngine::kFontColorAlternate;
} else {
- color = x.getLocked() ? ThemeEngine::kFontColorAlternate : ThemeEngine::kFontColorNormal;
+ color = x->getLocked() ? ThemeEngine::kFontColorAlternate : ThemeEngine::kFontColorNormal;
}
saveNames.push_back(GUI::ListWidget::getThemeColor(color) + description);
More information about the Scummvm-git-logs
mailing list