From cd46b0d57d709956b34a4ae37a87ee4767a7986f Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 19 Dec 2006 21:52:29 +0000 Subject: Added a comment to ScummEngine_v5::saveVars (we need to implement it for IQ support in Indy3), and fixed a memory leak in o5_saveLoadGame svn-id: r24892 --- engines/scumm/script_v5.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'engines/scumm/script_v5.cpp') diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp index c56ed57d32..2f2374f722 100644 --- a/engines/scumm/script_v5.cpp +++ b/engines/scumm/script_v5.cpp @@ -868,6 +868,15 @@ void ScummEngine_v5::o5_saveLoadVars() { void ScummEngine_v5::saveVars() { int a, b; + // FIXME: This opcode is currently a stub. It is needed for at least two things: + // * storing save game names in Indy 3 (and maybe others) + // * storing the global IQ (Indy Quotient) in Indy 3 + // The former is not so important as we have our own save system, but the + // latter one of course is a desirable feature. + // So implementing this would be nice indeed. Not sure what the filename + // should be -- either base it on the target name, or base it on the gameid. + // Both approaches have their merits, though. + while ((_opcode = fetchScriptByte()) != 0) { switch (_opcode & 0x1F) { case 0x01: // write a range of variables @@ -899,6 +908,8 @@ void ScummEngine_v5::saveVars() { void ScummEngine_v5::loadVars() { int a, b; + // FIXME: See ScummEngine_v5::saveVars + // Common::hexdump(_scriptPointer, 64); while ((_opcode = fetchScriptByte()) != 0) { switch (_opcode & 0x1F) { @@ -1153,14 +1164,16 @@ void ScummEngine_v5::o5_saveLoadGame() { result = 2; // failed to save break; case 0xC0: // test if save exists + Common::InSaveFile *file; bool avail_saves[100]; char filename[256]; listSavegames(avail_saves, ARRAYSIZE(avail_saves)); makeSavegameName(filename, slot, false); - if (avail_saves[slot] && (_saveFileMan->openForLoading(filename))) + if (avail_saves[slot] && (file = _saveFileMan->openForLoading(filename))) { result = 6; // save file exists - else + delete file; + } else result = 7; // save file does not exist break; default: -- cgit v1.2.3