aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/save
diff options
context:
space:
mode:
Diffstat (limited to 'engines/gob/save')
-rw-r--r--engines/gob/save/savehandler.cpp14
-rw-r--r--engines/gob/save/savehandler.h2
-rw-r--r--engines/gob/save/saveload_v6.cpp2
3 files changed, 15 insertions, 3 deletions
diff --git a/engines/gob/save/savehandler.cpp b/engines/gob/save/savehandler.cpp
index 848578abce..68f1f22b78 100644
--- a/engines/gob/save/savehandler.cpp
+++ b/engines/gob/save/savehandler.cpp
@@ -77,10 +77,13 @@ int32 SlotFileIndexed::tallyUpFiles(uint32 slotSize, uint32 indexSize) const {
}
void SlotFileIndexed::buildIndex(byte *buffer, SavePartInfo &info,
- SaveConverter *converter) const {
+ SaveConverter *converter, bool setLongest) const {
uint32 descLength = info.getDescMaxLength();
+ uint32 longest = 0;
+ byte *bufferStart = buffer;
+
// Iterate over all files
for (uint32 i = 0; i < _slotCount; i++, buffer += descLength) {
Common::String slotFile = build(i);
@@ -100,10 +103,19 @@ void SlotFileIndexed::buildIndex(byte *buffer, SavePartInfo &info,
delete[] desc;
+ longest = MAX<uint32>(longest, strlen((const char *) buffer));
+
} else
// No valid slot, fill with 0
memset(buffer, 0, descLength);
}
+
+ if (setLongest) {
+ uint32 slot0Len;
+ for (slot0Len = strlen((const char *) bufferStart); slot0Len < longest; slot0Len++)
+ buffer[slot0Len] = ' ';
+ buffer[slot0Len] = '\0';
+ }
}
bool SlotFileIndexed::exists(int slot) const {
diff --git a/engines/gob/save/savehandler.h b/engines/gob/save/savehandler.h
index 51fbad0b98..a5ae1f5c21 100644
--- a/engines/gob/save/savehandler.h
+++ b/engines/gob/save/savehandler.h
@@ -78,7 +78,7 @@ public:
/** Creates an index in buffer. */
virtual void buildIndex(byte *buffer, SavePartInfo &info,
- SaveConverter *converter = 0) const;
+ SaveConverter *converter = 0, bool setLongest = false) const;
virtual bool exists(int slot) const;
virtual Common::InSaveFile *openRead(int slot) const;
diff --git a/engines/gob/save/saveload_v6.cpp b/engines/gob/save/saveload_v6.cpp
index b196881167..a499e34f3f 100644
--- a/engines/gob/save/saveload_v6.cpp
+++ b/engines/gob/save/saveload_v6.cpp
@@ -547,7 +547,7 @@ void SaveLoad_v6::GameHandler::buildIndex(byte *buffer) const {
SavePartInfo info(kSlotNameLength, (uint32) _vm->getGameType(),
0, _vm->getEndianness(), varSize);
- _slotFile->buildIndex(buffer, info);
+ _slotFile->buildIndex(buffer, info, 0, true);
}
void SaveLoad_v6::GameHandler::refreshProps() {