mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 14:18:37 +00:00
SCI: Use reference instead of pointer for required out-data in metadata save function
This commit is contained in:
parent
b3c27c2159
commit
d17ae077dd
@ -812,7 +812,7 @@ SaveStateList SciMetaEngine::listSaves(const char *target) const {
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
|
||||
if (in) {
|
||||
SavegameMetadata meta;
|
||||
if (!get_savegame_metadata(in, &meta)) {
|
||||
if (!get_savegame_metadata(in, meta)) {
|
||||
// invalid
|
||||
delete in;
|
||||
continue;
|
||||
@ -861,7 +861,7 @@ SaveStateDescriptor SciMetaEngine::querySaveMetaInfos(const char *target, int sl
|
||||
if (in) {
|
||||
SavegameMetadata meta;
|
||||
|
||||
if (!get_savegame_metadata(in, &meta)) {
|
||||
if (!get_savegame_metadata(in, meta)) {
|
||||
// invalid
|
||||
delete in;
|
||||
|
||||
|
@ -307,7 +307,7 @@ bool fillSavegameDesc(const Common::String &filename, SavegameDesc &desc) {
|
||||
}
|
||||
|
||||
SavegameMetadata meta;
|
||||
if (!get_savegame_metadata(in.get(), &meta) || meta.name.empty()) {
|
||||
if (!get_savegame_metadata(in.get(), meta) || meta.name.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1395,22 +1395,21 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
|
||||
s->gameIsRestarting = GAMEISRESTARTING_RESTORE;
|
||||
}
|
||||
|
||||
bool get_savegame_metadata(Common::SeekableReadStream *stream, SavegameMetadata *meta) {
|
||||
bool get_savegame_metadata(Common::SeekableReadStream *stream, SavegameMetadata &meta) {
|
||||
assert(stream);
|
||||
assert(meta);
|
||||
|
||||
Common::Serializer ser(stream, 0);
|
||||
sync_SavegameMetadata(ser, *meta);
|
||||
Common::Serializer ser(stream, nullptr);
|
||||
sync_SavegameMetadata(ser, meta);
|
||||
|
||||
if (stream->eos())
|
||||
return false;
|
||||
|
||||
if ((meta->version < MINIMUM_SAVEGAME_VERSION) ||
|
||||
(meta->version > CURRENT_SAVEGAME_VERSION)) {
|
||||
if (meta->version < MINIMUM_SAVEGAME_VERSION)
|
||||
if ((meta.version < MINIMUM_SAVEGAME_VERSION) ||
|
||||
(meta.version > CURRENT_SAVEGAME_VERSION)) {
|
||||
if (meta.version < MINIMUM_SAVEGAME_VERSION)
|
||||
warning("Old savegame version detected- can't load");
|
||||
else
|
||||
warning("Savegame version is %d- maximum supported is %0d", meta->version, CURRENT_SAVEGAME_VERSION);
|
||||
warning("Savegame version is %d- maximum supported is %0d", meta.version, CURRENT_SAVEGAME_VERSION);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *save);
|
||||
/**
|
||||
* Read the header from a savegame.
|
||||
*/
|
||||
bool get_savegame_metadata(Common::SeekableReadStream* stream, SavegameMetadata* meta);
|
||||
bool get_savegame_metadata(Common::SeekableReadStream *stream, SavegameMetadata &meta);
|
||||
|
||||
|
||||
} // End of namespace Sci
|
||||
|
Loading…
Reference in New Issue
Block a user