Got rid of the unused 'filename' attribute in SaveStateDescriptor

svn-id: r34905
This commit is contained in:
Max Horn 2008-11-05 15:41:12 +00:00
parent 79614d28b6
commit fe2935ad4b
15 changed files with 21 additions and 32 deletions

View File

@ -2184,7 +2184,7 @@ SaveStateList AgiMetaEngine::listSaves(const char *target) const {
uint32 type = in->readUint32BE(); uint32 type = in->readUint32BE();
if (type == AGIflag) if (type == AGIflag)
in->read(saveDesc, 31); in->read(saveDesc, 31);
saveList.push_back(SaveStateDescriptor(slotNum, Common::String(saveDesc), *file)); saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
delete in; delete in;
} }
} }

View File

@ -182,7 +182,7 @@ SaveStateList AgosMetaEngine::listSaves(const char *target) const {
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
if (in) { if (in) {
saveDesc = file->c_str(); saveDesc = file->c_str();
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc, *file)); saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
delete in; delete in;
} }
} }

View File

@ -590,7 +590,7 @@ SaveStateList CineMetaEngine::listSaves(const char *target) const {
} }
} while (ch >= 32 && !in->eos()); } while (ch >= 32 && !in->eos());
if (saveDesc[0] != 0) { if (saveDesc[0] != 0) {
saveList.push_back(SaveStateDescriptor(slotNum, Common::String(saveDesc), *file)); saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
file++; file++;
} }
} while (!in->eos()); } while (!in->eos());

View File

@ -102,7 +102,7 @@ public:
/** /**
* A hashmap describing details about a given save state. * A hashmap describing details about a given save state.
* TODO * TODO
* Guaranteed to contain save_slot, filename and description values. * Guaranteed to contain save_slot and description values.
* Additional ideas: Playtime, creation date, thumbnail, ... * Additional ideas: Playtime, creation date, thumbnail, ...
*/ */
class SaveStateDescriptor : public Common::StringMap { class SaveStateDescriptor : public Common::StringMap {
@ -113,21 +113,18 @@ public:
SaveStateDescriptor() : _thumbnail() { SaveStateDescriptor() : _thumbnail() {
setVal("save_slot", "-1"); // FIXME: default to 0 (first slot) or to -1 (invalid slot) ? setVal("save_slot", "-1"); // FIXME: default to 0 (first slot) or to -1 (invalid slot) ?
setVal("description", ""); setVal("description", "");
setVal("filename", "");
} }
SaveStateDescriptor(int s, const Common::String &d, const Common::String &f) : _thumbnail() { SaveStateDescriptor(int s, const Common::String &d) : _thumbnail() {
char buf[16]; char buf[16];
sprintf(buf, "%d", s); sprintf(buf, "%d", s);
setVal("save_slot", buf); setVal("save_slot", buf);
setVal("description", d); setVal("description", d);
setVal("filename", f);
} }
SaveStateDescriptor(const Common::String &s, const Common::String &d, const Common::String &f) : _thumbnail() { SaveStateDescriptor(const Common::String &s, const Common::String &d) : _thumbnail() {
setVal("save_slot", s); setVal("save_slot", s);
setVal("description", d); setVal("description", d);
setVal("filename", f);
} }
/** The saveslot id, as it would be passed to the "-x" command line switch. */ /** The saveslot id, as it would be passed to the "-x" command line switch. */
@ -142,12 +139,6 @@ public:
/** A human readable description of the save state (read-only variant). */ /** A human readable description of the save state (read-only variant). */
const Common::String &description() const { return getVal("description"); } const Common::String &description() const { return getVal("description"); }
/** The filename of the savestate, for use with the SaveFileManager API. */
Common::String &filename() { return getVal("filename"); }
/** The filename of the savestate, for use with the SaveFileManager API (read-only variant). */
const Common::String &filename() const { return getVal("filename"); }
/** Optional entries only included when querying via MetaEngine::querySaveMetaInfo */ /** Optional entries only included when querying via MetaEngine::querySaveMetaInfo */
/** /**

View File

@ -1151,7 +1151,7 @@ SaveStateList KyraMetaEngine::listSaves(const char *target) const {
if (slotNum == 0 && header.gameID == Kyra::GI_KYRA3) if (slotNum == 0 && header.gameID == Kyra::GI_KYRA3)
header.description = "New Game"; header.description = "New Game";
saveList.push_back(SaveStateDescriptor(slotNum, header.description, *file)); saveList.push_back(SaveStateDescriptor(slotNum, header.description));
} }
delete in; delete in;
} }
@ -1209,7 +1209,7 @@ SaveStateDescriptor KyraMetaEngine::querySaveMetaInfos(const char *target, int s
delete in; delete in;
if (error == Kyra::KyraEngine_v1::kRSHENoError) { if (error == Kyra::KyraEngine_v1::kRSHENoError) {
SaveStateDescriptor desc(slot, header.description, filename); SaveStateDescriptor desc(slot, header.description);
desc.setDeletableFlag(slot != 0); desc.setDeletableFlag(slot != 0);
desc.setThumbnail(header.thumbnail); desc.setThumbnail(header.thumbnail);

View File

@ -230,7 +230,7 @@ SaveStateList LureMetaEngine::listSaves(const char *target) const {
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
if (in) { if (in) {
saveDesc = Lure::getSaveName(in); saveDesc = Lure::getSaveName(in);
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc, *file)); saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
delete in; delete in;
} }
} }

View File

@ -299,7 +299,7 @@ SaveStateList ParallactionMetaEngine::listSaves(const char *target) const {
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
if (in) { if (in) {
Common::String saveDesc = in->readLine(); Common::String saveDesc = in->readLine();
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc, *file)); saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
delete in; delete in;
} }
} }

View File

@ -155,7 +155,7 @@ SaveStateList QueenMetaEngine::listSaves(const char *target) const {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
in->readUint32BE(); in->readUint32BE();
in->read(saveDesc, 32); in->read(saveDesc, 32);
saveList.push_back(SaveStateDescriptor(slotNum, Common::String(saveDesc), *file)); saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
delete in; delete in;
} }
} }

View File

@ -197,7 +197,7 @@ SaveStateList SagaMetaEngine::listSaves(const char *target) const {
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
in->readUint32BE(); in->readUint32BE();
in->read(saveDesc, SAVE_TITLE_SIZE); in->read(saveDesc, SAVE_TITLE_SIZE);
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc, *file)); saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
delete in; delete in;
} }
} }

View File

@ -978,7 +978,7 @@ SaveStateList ScummMetaEngine::listSaves(const char *target) const {
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
if (in) { if (in) {
Scumm::getSavegameName(in, saveDesc, 0); // FIXME: heversion?!? Scumm::getSavegameName(in, saveDesc, 0); // FIXME: heversion?!?
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc, *file)); saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
delete in; delete in;
} }
} }
@ -1006,7 +1006,7 @@ SaveStateDescriptor ScummMetaEngine::querySaveMetaInfos(const char *target, int
// TODO: Cleanup // TODO: Cleanup
Graphics::Surface *thumbnail = ScummEngine::loadThumbnailFromSlot(target, slot); Graphics::Surface *thumbnail = ScummEngine::loadThumbnailFromSlot(target, slot);
SaveStateDescriptor desc(slot, saveDesc, filename); SaveStateDescriptor desc(slot, saveDesc);
desc.setDeletableFlag(true); desc.setDeletableFlag(true);
desc.setThumbnail(thumbnail); desc.setThumbnail(thumbnail);

View File

@ -239,7 +239,7 @@ SaveStateList SkyMetaEngine::listSaves(const char *target) const {
// Slot 0 is the autosave, if it exists. // Slot 0 is the autosave, if it exists.
// TODO: Check for the existence of the autosave -- but this require us // TODO: Check for the existence of the autosave -- but this require us
// to know which SKY variant we are looking at. // to know which SKY variant we are looking at.
saveList.insert_at(0, SaveStateDescriptor(0, "*AUTOSAVE*", "")); saveList.insert_at(0, SaveStateDescriptor(0, "*AUTOSAVE*"));
// Prepare the list of savestates by looping over all matching savefiles // Prepare the list of savestates by looping over all matching savefiles
for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++) { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++) {
@ -250,7 +250,7 @@ SaveStateList SkyMetaEngine::listSaves(const char *target) const {
int slotNum = atoi(ext.c_str()); int slotNum = atoi(ext.c_str());
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
if (in) { if (in) {
saveList.push_back(SaveStateDescriptor(slotNum+1, savenames[slotNum], *file)); saveList.push_back(SaveStateDescriptor(slotNum+1, savenames[slotNum]));
delete in; delete in;
} }
} }

View File

@ -259,7 +259,7 @@ SaveStateList SwordMetaEngine::listSaves(const char *target) const {
// FIXME: The in-game dialog shows the first save slot as 1, not 0, // FIXME: The in-game dialog shows the first save slot as 1, not 0,
// but if we change the numbering here, the launcher won̈́t set // but if we change the numbering here, the launcher won̈́t set
// "save_slot" correctly. // "save_slot" correctly.
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc, *file)); saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
file++; file++;
} }
} }

View File

@ -192,7 +192,7 @@ SaveStateList Sword2MetaEngine::listSaves(const char *target) const {
if (in) { if (in) {
in->readUint32LE(); in->readUint32LE();
in->read(saveDesc, SAVE_DESCRIPTION_LEN); in->read(saveDesc, SAVE_DESCRIPTION_LEN);
saveList.push_back(SaveStateDescriptor(slotNum, Common::String(saveDesc), *file)); saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
delete in; delete in;
} }
} }

View File

@ -359,9 +359,7 @@ SaveStateList TinselMetaEngine::listSaves(const char *target) const {
SaveStateList saveList; SaveStateList saveList;
for (int i = 0; i < numStates; i++) { for (int i = 0; i < numStates; i++) {
SaveStateDescriptor sd(i, SaveStateDescriptor sd(i, Tinsel::ListEntry(i, Tinsel::LE_DESC));
Tinsel::ListEntry(i, Tinsel::LE_DESC),
Tinsel::ListEntry(i, Tinsel::LE_NAME));
// TODO: Also add savedFiles[i].dateTime to the SaveStateDescriptor // TODO: Also add savedFiles[i].dateTime to the SaveStateDescriptor
saveList.push_back(sd); saveList.push_back(sd);
} }

View File

@ -184,7 +184,7 @@ SaveStateList ToucheMetaEngine::listSaves(const char *target) const {
in->readUint16LE(); in->readUint16LE();
in->readUint16LE(); in->readUint16LE();
in->read(saveDesc, Touche::kGameStateDescriptionLen); in->read(saveDesc, Touche::kGameStateDescriptionLen);
saveList.push_back(SaveStateDescriptor(slotNum, Common::String(saveDesc), *file)); saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
delete in; delete in;
} }
} }
@ -205,7 +205,7 @@ SaveStateList ToucheMetaEngine::listSaves(const char *target) const {
in->readUint16LE(); in->readUint16LE();
in->readUint16LE(); in->readUint16LE();
in->read(saveDesc, Touche::kGameStateDescriptionLen); in->read(saveDesc, Touche::kGameStateDescriptionLen);
saveList.push_back(SaveStateDescriptor(slotNum, Common::String(saveDesc), *file)); saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
delete in; delete in;
} }
} }