aboutsummaryrefslogtreecommitdiff
path: root/queen/queen.cpp
diff options
context:
space:
mode:
authorGregory Montoir2004-12-03 22:39:55 +0000
committerGregory Montoir2004-12-03 22:39:55 +0000
commitfb5dcffff19c8bb5c516a6ddcaea397fb709194b (patch)
tree038a2149a59e56ac9832262808e51edcbc21a305 /queen/queen.cpp
parent76bf11cbdf8a4549a9461a467d82dda12eec5d45 (diff)
downloadscummvm-rg350-fb5dcffff19c8bb5c516a6ddcaea397fb709194b.tar.gz
scummvm-rg350-fb5dcffff19c8bb5c516a6ddcaea397fb709194b.tar.bz2
scummvm-rg350-fb5dcffff19c8bb5c516a6ddcaea397fb709194b.zip
Minor cleanup, one more time.
Fixed a crash when returning to the launcher at the end of the game. I played FOTAQ (french) from the beginning to the end some hours ago, I haven't encountered any special problems/glitches (except the one mentionned above). svn-id: r15979
Diffstat (limited to 'queen/queen.cpp')
-rw-r--r--queen/queen.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/queen/queen.cpp b/queen/queen.cpp
index 353c4b7cd5..f386300696 100644
--- a/queen/queen.cpp
+++ b/queen/queen.cpp
@@ -48,12 +48,6 @@
#include "sound/mididrv.h"
-#ifdef _WIN32_WCE
-
-extern bool toolbar_drawn;
-extern bool draw_keyboard;
-
-#endif
/* Flight of the Amazon Queen */
static const GameSettings queen_setting =
@@ -173,7 +167,7 @@ void QueenEngine::update(bool checkPlayerInput) {
_input->debuggerReset();
_debugger->attach();
}
- if (!_input->cutawayRunning()) {
+ if (canLoadOrSave()) {
if (_input->quickSave()) {
_input->quickSaveReset();
saveGameState(0, "Quicksave");
@@ -182,10 +176,12 @@ void QueenEngine::update(bool checkPlayerInput) {
_input->quickLoadReset();
loadGameState(0);
}
- if (_system->getMillis() - _lastSaveTime > AUTOSAVE_INTERVAL) {
+ if (_system->getMillis() - _lastSaveTime >= AUTOSAVE_INTERVAL) {
saveGameState(AUTOSAVE_SLOT, "Autosave");
_lastSaveTime = _system->getMillis();
}
+ }
+ if (!_input->cutawayRunning()) {
if (checkPlayerInput) {
_command->updatePlayer();
}
@@ -195,6 +191,10 @@ void QueenEngine::update(bool checkPlayerInput) {
}
}
+bool QueenEngine::canLoadOrSave() {
+ return !_input->cutawayRunning() && !(_resource->isDemo() || _resource->isInterview());
+}
+
void QueenEngine::saveGameState(uint16 slot, const char *desc) {
debug(3, "Saving game to slot %d", slot);
char name[20];
@@ -245,7 +245,9 @@ void QueenEngine::loadGameState(uint16 slot) {
_grid->loadState(header.version, p);
_logic->loadState(header.version, p);
_sound->loadState(header.version, p);
- assert(header.dataSize == (uint32)(p - saveData));
+ if (header.dataSize != (uint32)(p - saveData)) {
+ error("Corrupted savegame file");
+ }
_logic->setupRestoredGame();
}
delete[] saveData;
@@ -298,13 +300,12 @@ void QueenEngine::errorString(const char *buf1, char *buf2) {
int QueenEngine::go() {
_logic->start();
- if (ConfMan.hasKey("save_slot") && !(_resource->isDemo() || _resource->isInterview())) {
+ if (ConfMan.hasKey("save_slot") && canLoadOrSave()) {
loadGameState(ConfMan.getInt("save_slot"));
}
_lastSaveTime = _system->getMillis();
_quit = false;
while (!_quit) {
- // queen.c lines 4080-4104
if (_logic->newRoom() > 0) {
_logic->update();
_logic->oldRoom(_logic->currentRoom());