From 565a9f5b0d4528b09531e1c381f81587546a0580 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Mon, 22 Jun 2009 16:29:31 +0000 Subject: Don't assert on pop when no script is loaded svn-id: r41770 --- engines/gob/game_v1.cpp | 3 +-- engines/gob/game_v2.cpp | 3 +-- engines/gob/script.cpp | 13 +++++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) (limited to 'engines/gob') diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index 1a530fa4f6..f038c7edc3 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -242,8 +242,7 @@ void Game_v1::playTot(int16 skipPlay) { _vm->_inter->_breakFromLevel = oldBreakFrom; _vm->_scenery->_pCaptureCounter = oldCaptureCounter; - if (_script->isLoaded()) - _script->pop(); + _script->pop(); } void Game_v1::clearCollisions() { diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index e170a1c9d0..ace842f18e 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -293,8 +293,7 @@ void Game_v2::playTot(int16 skipPlay) { _vm->_inter->_breakFromLevel = oldBreakFrom; _vm->_scenery->_pCaptureCounter = oldCaptureCounter; - if (_script->isLoaded()) - _script->pop(); + _script->pop(); } void Game_v2::clearCollisions() { diff --git a/engines/gob/script.cpp b/engines/gob/script.cpp index ab2d8cdaf2..e4808cf9ce 100644 --- a/engines/gob/script.cpp +++ b/engines/gob/script.cpp @@ -419,6 +419,10 @@ bool Script::isFinished() const { } void Script::push() { + if (!isLoaded()) + // Nothing to do + return; + CallEntry currentCall; currentCall.totPtr = _totPtr; @@ -428,6 +432,11 @@ void Script::push() { } void Script::pop(bool ret) { + if (!isLoaded()) + // Nothing to do + return; + + // Unmatched pop? assert(!_callStack.empty()); CallEntry lastCall = _callStack.pop(); @@ -439,6 +448,10 @@ void Script::pop(bool ret) { } void Script::call(uint32 offset) { + if (!isLoaded()) + // Nothing to do + return; + push(); seek(offset); } -- cgit v1.2.3