[Scummvm-cvs-logs] scummvm master -> 827cdbd22ea5b9d66848ddc1cdf9cee0afaea0f4
lordhoto
lordhoto at gmail.com
Fri Jan 27 20:38:51 CET 2012
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a231f9d5dd AGOS: Rename ArchiveMan's open to createReadStreamForMember to match our Archive API.
827cdbd22e AGOS: Make ArchiveMan a proper sub-type of SearchSet.
Commit: a231f9d5ddb685a5a4817c5ff89e493825f12148
https://github.com/scummvm/scummvm/commit/a231f9d5ddb685a5a4817c5ff89e493825f12148
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-01-27T11:30:02-08:00
Commit Message:
AGOS: Rename ArchiveMan's open to createReadStreamForMember to match our Archive API.
Changed paths:
engines/agos/agos.h
engines/agos/animation.cpp
engines/agos/res.cpp
engines/agos/res_snd.cpp
engines/agos/saveload.cpp
engines/agos/subroutine.cpp
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index d171902..9b9cbce 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -198,7 +198,7 @@ public:
#endif
virtual bool hasFile(const Common::String &name) const;
- Common::SeekableReadStream *open(const Common::String &filename);
+ virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &filename) const;
private:
bool _fallBack;
diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp
index db2cff3..c7176fe 100644
--- a/engines/agos/animation.cpp
+++ b/engines/agos/animation.cpp
@@ -251,7 +251,7 @@ bool MoviePlayerDXA::load() {
}
Common::String videoName = Common::String::format("%s.dxa", baseName);
- Common::SeekableReadStream *videoStream = _vm->_archives.open(videoName);
+ Common::SeekableReadStream *videoStream = _vm->_archives.createReadStreamForMember(videoName);
if (!videoStream)
error("Failed to load video file %s", videoName.c_str());
if (!loadStream(videoStream))
@@ -415,7 +415,7 @@ MoviePlayerSMK::MoviePlayerSMK(AGOSEngine_Feeble *vm, const char *name)
bool MoviePlayerSMK::load() {
Common::String videoName = Common::String::format("%s.smk", baseName);
- Common::SeekableReadStream *videoStream = _vm->_archives.open(videoName);
+ Common::SeekableReadStream *videoStream = _vm->_archives.createReadStreamForMember(videoName);
if (!videoStream)
error("Failed to load video file %s", videoName.c_str());
if (!loadStream(videoStream))
diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp
index 284b252..03acb0a 100644
--- a/engines/agos/res.cpp
+++ b/engines/agos/res.cpp
@@ -54,12 +54,12 @@ bool ArchiveMan::hasFile(const Common::String &name) const {
return Common::SearchSet::hasFile(name);
}
-Common::SeekableReadStream *ArchiveMan::open(const Common::String &filename) {
+Common::SeekableReadStream *ArchiveMan::createReadStreamForMember(const Common::String &filename) const {
if (_fallBack && SearchMan.hasFile(filename)) {
return SearchMan.createReadStreamForMember(filename);
}
- return createReadStreamForMember(filename);
+ return Common::SearchSet::createReadStreamForMember(filename);
}
#ifdef ENABLE_AGOS2
@@ -180,7 +180,7 @@ void AGOSEngine_PN::loadGamePcFile() {
if (getFileName(GAME_BASEFILE) != NULL) {
// Read dataBase
- in = _archives.open(getFileName(GAME_BASEFILE));
+ in = _archives.createReadStreamForMember(getFileName(GAME_BASEFILE));
if (!in) {
error("loadGamePcFile: Can't load database file '%s'", getFileName(GAME_BASEFILE));
}
@@ -198,7 +198,7 @@ void AGOSEngine_PN::loadGamePcFile() {
if (getFileName(GAME_TEXTFILE) != NULL) {
// Read textBase
- in = _archives.open(getFileName(GAME_TEXTFILE));
+ in = _archives.createReadStreamForMember(getFileName(GAME_TEXTFILE));
if (!in) {
error("loadGamePcFile: Can't load textbase file '%s'", getFileName(GAME_TEXTFILE));
}
@@ -221,7 +221,7 @@ void AGOSEngine::loadGamePcFile() {
if (getFileName(GAME_BASEFILE) != NULL) {
/* Read main gamexx file */
- in = _archives.open(getFileName(GAME_BASEFILE));
+ in = _archives.createReadStreamForMember(getFileName(GAME_BASEFILE));
if (!in) {
error("loadGamePcFile: Can't load gamexx file '%s'", getFileName(GAME_BASEFILE));
}
@@ -247,7 +247,7 @@ void AGOSEngine::loadGamePcFile() {
if (getFileName(GAME_TBLFILE) != NULL) {
/* Read list of TABLE resources */
- in = _archives.open(getFileName(GAME_TBLFILE));
+ in = _archives.createReadStreamForMember(getFileName(GAME_TBLFILE));
if (!in) {
error("loadGamePcFile: Can't load table resources file '%s'", getFileName(GAME_TBLFILE));
}
@@ -268,7 +268,7 @@ void AGOSEngine::loadGamePcFile() {
if (getFileName(GAME_STRFILE) != NULL) {
/* Read list of TEXT resources */
- in = _archives.open(getFileName(GAME_STRFILE));
+ in = _archives.createReadStreamForMember(getFileName(GAME_STRFILE));
if (!in)
error("loadGamePcFile: Can't load text resources file '%s'", getFileName(GAME_STRFILE));
@@ -282,7 +282,7 @@ void AGOSEngine::loadGamePcFile() {
if (getFileName(GAME_STATFILE) != NULL) {
/* Read list of ROOM STATE resources */
- in = _archives.open(getFileName(GAME_STATFILE));
+ in = _archives.createReadStreamForMember(getFileName(GAME_STATFILE));
if (!in) {
error("loadGamePcFile: Can't load state resources file '%s'", getFileName(GAME_STATFILE));
}
@@ -305,7 +305,7 @@ void AGOSEngine::loadGamePcFile() {
if (getFileName(GAME_RMSLFILE) != NULL) {
/* Read list of ROOM ITEMS resources */
- in = _archives.open(getFileName(GAME_RMSLFILE));
+ in = _archives.createReadStreamForMember(getFileName(GAME_RMSLFILE));
if (!in) {
error("loadGamePcFile: Can't load room resources file '%s'", getFileName(GAME_RMSLFILE));
}
@@ -321,7 +321,7 @@ void AGOSEngine::loadGamePcFile() {
if (getFileName(GAME_XTBLFILE) != NULL) {
/* Read list of XTABLE resources */
- in = _archives.open(getFileName(GAME_XTBLFILE));
+ in = _archives.createReadStreamForMember(getFileName(GAME_XTBLFILE));
if (!in) {
error("loadGamePcFile: Can't load xtable resources file '%s'", getFileName(GAME_XTBLFILE));
}
@@ -822,7 +822,7 @@ void AGOSEngine::loadVGABeardFile(uint16 id) {
sprintf(filename, "0%d.VGA", id);
}
- in = _archives.open(filename);
+ in = _archives.createReadStreamForMember(filename);
if (!in)
error("loadSimonVGAFile: Can't load %s", filename);
@@ -900,7 +900,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
}
}
- in = _archives.open(filename);
+ in = _archives.createReadStreamForMember(filename);
if (!in) {
if (useError)
error("loadVGAVideoFile: Can't load %s", filename);
diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp
index e9a7ea4..2777d4f 100644
--- a/engines/agos/res_snd.cpp
+++ b/engines/agos/res_snd.cpp
@@ -452,7 +452,7 @@ static const char *const dimpSoundList[32] = {
void AGOSEngine::loadSoundFile(const char* filename) {
Common::SeekableReadStream *in;
- in = _archives.open(filename);
+ in = _archives.createReadStreamForMember(filename);
if (!in)
error("loadSound: Can't load %s", filename);
@@ -475,7 +475,7 @@ void AGOSEngine::loadSound(uint16 sound, int16 pan, int16 vol, uint16 type) {
assert(sound >= 1 && sound <= 32);
sprintf(filename, "%s.wav", dimpSoundList[sound - 1]);
- in = _archives.open(filename);
+ in = _archives.createReadStreamForMember(filename);
if (!in)
error("loadSound: Can't load %s", filename);
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index 920dbb0..4fbde09 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -1019,7 +1019,7 @@ bool AGOSEngine::loadGame(const char *filename, bool restartMode) {
if (restartMode) {
// Load restart state
- f = _archives.open(filename);
+ f = _archives.createReadStreamForMember(filename);
} else {
f = _saveFileMan->openForLoading(filename);
}
@@ -1193,7 +1193,7 @@ bool AGOSEngine_Elvira2::loadGame(const char *filename, bool restartMode) {
if (restartMode) {
// Load restart state
- f = _archives.open(filename);
+ f = _archives.createReadStreamForMember(filename);
} else {
f = _saveFileMan->openForLoading(filename);
}
diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp
index a319153..f5aad2d 100644
--- a/engines/agos/subroutine.cpp
+++ b/engines/agos/subroutine.cpp
@@ -266,7 +266,7 @@ Common::SeekableReadStream *AGOSEngine::openTablesFile(const char *filename) {
}
Common::SeekableReadStream *AGOSEngine::openTablesFile_simon1(const char *filename) {
- Common::SeekableReadStream *in = _archives.open(filename);
+ Common::SeekableReadStream *in = _archives.createReadStreamForMember(filename);
if (!in)
error("openTablesFile: Can't open '%s'", filename);
return in;
Commit: 827cdbd22ea5b9d66848ddc1cdf9cee0afaea0f4
https://github.com/scummvm/scummvm/commit/827cdbd22ea5b9d66848ddc1cdf9cee0afaea0f4
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-01-27T11:35:34-08:00
Commit Message:
AGOS: Make ArchiveMan a proper sub-type of SearchSet.
Now all of the Archive API is implemented to avoid possibly inconsistent
behavior when an ArchiveMan object is accessed via a class type higher in the
class hierachy.
Changed paths:
engines/agos/agos.h
engines/agos/res.cpp
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 9b9cbce..d9f982a 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -198,6 +198,10 @@ public:
#endif
virtual bool hasFile(const Common::String &name) const;
+ virtual int listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern) const;
+ virtual int listMembers(Common::ArchiveMemberList &list) const;
+
+ virtual const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &filename) const;
private:
diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp
index 03acb0a..0305879 100644
--- a/engines/agos/res.cpp
+++ b/engines/agos/res.cpp
@@ -54,6 +54,24 @@ bool ArchiveMan::hasFile(const Common::String &name) const {
return Common::SearchSet::hasFile(name);
}
+int ArchiveMan::listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern) const {
+ const int matches = _fallBack ? SearchMan.listMatchingMembers(list, pattern) : 0;
+ return matches + Common::SearchSet::listMatchingMembers(list, pattern);
+}
+
+int ArchiveMan::listMembers(Common::ArchiveMemberList &list) const {
+ const int matches = _fallBack ? SearchMan.listMembers(list) : 0;
+ return matches + Common::SearchSet::listMembers(list);
+}
+
+const Common::ArchiveMemberPtr ArchiveMan::getMember(const Common::String &name) const {
+ Common::ArchiveMemberPtr ptr = _fallBack ? SearchMan.getMember(name) : Common::ArchiveMemberPtr();
+ if (ptr)
+ return ptr;
+
+ return Common::SearchSet::getMember(name);
+}
+
Common::SeekableReadStream *ArchiveMan::createReadStreamForMember(const Common::String &filename) const {
if (_fallBack && SearchMan.hasFile(filename)) {
return SearchMan.createReadStreamForMember(filename);
More information about the Scummvm-git-logs
mailing list