Don't assert on pop when no script is loaded

svn-id: r41770
This commit is contained in:
Sven Hesse 2009-06-22 16:29:31 +00:00
parent 49c46a46f7
commit 565a9f5b0d
3 changed files with 15 additions and 4 deletions

View File

@ -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() {

View File

@ -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() {

View File

@ -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);
}