[Scummvm-git-logs] scummvm master -> 8713f3b3b3f6c471c090ead22997a7e01c56253e

bluegr noreply at scummvm.org
Wed Nov 30 21:19:12 UTC 2022


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:
8713f3b3b3 DRACI: Find max speech file using iterator


Commit: 8713f3b3b3f6c471c090ead22997a7e01c56253e
    https://github.com/scummvm/scummvm/commit/8713f3b3b3f6c471c090ead22997a7e01c56253e
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2022-11-30T23:19:08+02:00

Commit Message:
DRACI: Find max speech file using iterator

Changed paths:
    engines/draci/sound.cpp


diff --git a/engines/draci/sound.cpp b/engines/draci/sound.cpp
index 7afd90922cb..943081eb95d 100644
--- a/engines/draci/sound.cpp
+++ b/engines/draci/sound.cpp
@@ -203,6 +203,16 @@ void ZipSoundArchive::openArchive(const char *path, const char *extension, Sound
 		Common::ArchiveMemberList files;
 		_archive->listMembers(files);
 		_sampleCount = files.size();
+
+		// The sample files are in the form ####.mp3 but not all numbers are used so we need to
+		// iterate the archive and find the last file
+		for (Common::ArchiveMemberList::iterator iter = files.begin(); iter != files.end(); iter++) {
+			Common::String filename = (*iter)->getName();
+			filename.erase(filename.size() - 4);  // remove .mp3 extension
+			uint file_number = atoi(filename.c_str());
+			if(file_number > _sampleCount)		// finds the last file (numerically)
+				_sampleCount = file_number;
+		}
 		debugC(1, kDraciArchiverDebugLevel, "Capacity %d", _sampleCount);
 	} else {
 		debugC(1, kDraciArchiverDebugLevel, "Failed");




More information about the Scummvm-git-logs mailing list