COMPOSER: Enable autosaving.

This commit is contained in:
upthorn 2012-06-27 00:54:50 -07:00 committed by angstsmurf
parent 582006d1cf
commit 483cad039e
3 changed files with 5 additions and 1 deletions

View file

@ -120,6 +120,7 @@ Common::Error ComposerEngine::run() {
else else
warning("FPS in book.ini is zero. Defaulting to 8..."); warning("FPS in book.ini is zero. Defaulting to 8...");
uint32 lastDrawTime = 0; uint32 lastDrawTime = 0;
_lastSaveTime = _system->getMillis();
while (!shouldQuit()) { while (!shouldQuit()) {
for (uint i = 0; i < _pendingPageChanges.size(); i++) { for (uint i = 0; i < _pendingPageChanges.size(); i++) {
@ -173,6 +174,8 @@ Common::Error ComposerEngine::run() {
loadGameState(ConfMan.getInt("save_slot")); loadGameState(ConfMan.getInt("save_slot"));
ConfMan.removeKey("save_slot", Common::ConfigManager::kTransientDomain); ConfMan.removeKey("save_slot", Common::ConfigManager::kTransientDomain);
} }
if (shouldPerformAutoSave(_lastSaveTime))
saveGameState(0, "Autosave");
while (_eventMan->pollEvent(event)) { while (_eventMan->pollEvent(event)) {
switch (event.type) { switch (event.type) {
case Common::EVENT_LBUTTONDOWN: case Common::EVENT_LBUTTONDOWN:

View file

@ -189,7 +189,7 @@ private:
Audio::QueuingAudioStream *_audioStream; Audio::QueuingAudioStream *_audioStream;
uint16 _currSoundPriority; uint16 _currSoundPriority;
uint32 _currentTime, _lastTime, _timeDelta; uint32 _currentTime, _lastTime, _timeDelta, _lastSaveTime;
bool _needsUpdate; bool _needsUpdate;
Common::Array<Common::Rect> _dirtyRects; Common::Array<Common::Rect> _dirtyRects;

View file

@ -372,6 +372,7 @@ Common::Error ComposerEngine::loadGameState(int slot) {
Common::Error ComposerEngine::saveGameState(int slot, const Common::String &desc) { Common::Error ComposerEngine::saveGameState(int slot, const Common::String &desc) {
Common::String filename = makeSaveGameName(slot); Common::String filename = makeSaveGameName(slot);
Common::OutSaveFile *out; Common::OutSaveFile *out;
_lastSaveTime = _system->getMillis();
if (!(out = _saveFileMan->openForSaving(filename))) if (!(out = _saveFileMan->openForSaving(filename)))
return Common::kWritingFailed; return Common::kWritingFailed;