SAGA2: Implement FactionTallies save/loading

This commit is contained in:
a/ 2021-07-12 10:00:11 +09:00
parent 09a416c4ff
commit 5cc7b8803c
3 changed files with 26 additions and 3 deletions

View File

@ -3884,6 +3884,18 @@ void saveFactionTallies(SaveFileConstructor &saveGame) {
sizeof(factionTable));
}
void saveFactionTallies(Common::OutSaveFile *out) {
debugC(2, kDebugSaveload, "Saving Faction Tallies");
out->write("FACT", 4);
out->writeUint32LE(maxFactions * factionNumColumns * sizeof(int16));
for (int i = 0; i < maxFactions; ++i) {
for (int j = 0; j < factionNumColumns; ++j)
out->writeSint16LE(factionTable[i][j]);
}
}
//-------------------------------------------------------------------
// Load the faction tallies from a save file
@ -3891,4 +3903,13 @@ void loadFactionTallies(SaveFileReader &saveGame) {
saveGame.read(&factionTable, sizeof(factionTable));
}
void loadFactionTallies(Common::InSaveFile *in) {
debugC(2, kDebugSaveload, "Loading Faction Tallies");
for (int i = 0; i < maxFactions; ++i) {
for (int j = 0; j < factionNumColumns; ++j)
factionTable[i][j] = in->readSint16LE();
}
}
}

View File

@ -1125,9 +1125,11 @@ void initFactionTallies(void);
// Save the faction tallies to a save file
void saveFactionTallies(SaveFileConstructor &saveGame);
void saveFactionTallies(Common::OutSaveFile *out);
// Load the faction tallies from a save file
void loadFactionTallies(SaveFileReader &saveGame);
void loadFactionTallies(Common::InSaveFile *in);
// Cleanup the faction tally table
inline void cleanupFactionTallies(void) { /* Nothing to do */ }

View File

@ -166,9 +166,9 @@ Common::Error saveGameState(int16 saveNo, char *saveName) {
saveSensors(out);
saveTempActorCount(out);
saveMissions(out);
saveFactionTallies(out);
#if 0
saveFactionTallies(saveGame);
saveTileModeState(saveGame);
saveSpellState(saveGame);
saveAutoMap(saveGame);
@ -377,12 +377,12 @@ void loadSavedGameState(int16 saveNo) {
loadMissions(in);
loadFlags |= loadMissionsFlag;
break;
#if 0
case MKTAG('F', 'A', 'C', 'T'):
loadFactionTallies(saveGame);
loadFactionTallies(in);
loadFlags |= loadFactionTalliesFlag;
break;
#if 0
case MKTAG('T', 'M', 'S', 'T'):
if (loadFlags & loadActorsFlag) {