Ticket #4248: save-iq-fix.patch

File save-iq-fix.patch, 1.9 KB (added by SF/tobigun, 15 years ago)
  • engines/scumm/script_v5.cpp

     
    10171017 */
    10181018void ScummEngine_v5::updateIQPoints() {
    10191019        int seriesIQ;
     1020        // IQString[0..72] corresponds to each puzzle's IQ.
     1021        // IQString[73] indicates that the IQ-file was loaded successfully and is always 0 when
     1022        // the IQ is calculated, hence it will be ignored here.
     1023        const int NUM_PUZZLES = 73;
     1024        byte seriesIQString[NUM_PUZZLES];
     1025        byte *episodeIQString;
    10201026        int episodeIQStringSize;
    1021         byte *episodeIQString;
    1022         byte seriesIQString[73];
    10231027
    10241028        // load string with IQ points given per puzzle in any savegame
    10251029        // IMPORTANT: the resource string STRINGID_IQ_SERIES is only valid while
     
    10321036        if (!episodeIQString)
    10331037                return;
    10341038        episodeIQStringSize = getResourceSize(rtString, STRINGID_IQ_EPISODE);
    1035         if (episodeIQStringSize < 73)
     1039        if (episodeIQStringSize < NUM_PUZZLES)
    10361040                return;
    10371041
    10381042        // merge episode and series IQ strings and calculate series IQ
    10391043        seriesIQ = 0;
    1040         // iterate over puzzles (each of the first 73 bytes corresponds to a puzzle's IQ)
    1041         for (int i = 0; i < 73 ; ++i) {
    1042                 char puzzleIQ = seriesIQString[i];
     1044        // iterate over puzzles
     1045        for (int i = 0; i < NUM_PUZZLES ; ++i) {
     1046                byte puzzleIQ = seriesIQString[i];
    10431047                // if puzzle is solved copy points to episode string
    10441048                if (puzzleIQ > 0)
    10451049                        episodeIQString[i] = puzzleIQ;
  • engines/scumm/scumm.cpp

     
    20832083}
    20842084
    20852085void ScummEngine_v5::scummLoop_handleSaveLoad() {
    2086         byte saveLoad = (_saveLoadFlag != 0);
     2086        // copy saveLoadFlag as handleSaveLoad() resets it
     2087        byte saveLoad = _saveLoadFlag;
    20872088
    20882089        ScummEngine::scummLoop_handleSaveLoad();
    20892090