diff options
author | Thomas Fach-Pedersen | 2018-03-07 21:39:30 +0100 |
---|---|---|
committer | Thomas Fach-Pedersen | 2018-03-07 21:39:30 +0100 |
commit | 568d0264095f1d767441ab7885a7289f9b75ffe0 (patch) | |
tree | 8dfd3bbda3d58968d4c18202ae31e45a2b7c0ef4 /engines/bladerunner/script | |
parent | c85201caf5524f3c0106c52fba4bd7a2ebfd1dc1 (diff) | |
download | scummvm-rg350-568d0264095f1d767441ab7885a7289f9b75ffe0.tar.gz scummvm-rg350-568d0264095f1d767441ab7885a7289f9b75ffe0.tar.bz2 scummvm-rg350-568d0264095f1d767441ab7885a7289f9b75ffe0.zip |
BLADERUNNER: Don't assert when using mainframe
Actor 99 stands in for mainframe when moving clues
Diffstat (limited to 'engines/bladerunner/script')
-rw-r--r-- | engines/bladerunner/script/ai_script.cpp | 70 |
1 files changed, 56 insertions, 14 deletions
diff --git a/engines/bladerunner/script/ai_script.cpp b/engines/bladerunner/script/ai_script.cpp index 06d91689b6..a2c6682199 100644 --- a/engines/bladerunner/script/ai_script.cpp +++ b/engines/bladerunner/script/ai_script.cpp @@ -61,14 +61,20 @@ AIScripts::~AIScripts() { } void AIScripts::initialize(int actor) { - assert(actor < _actorCount); + if (actor >= _actorCount) { + return; + } + if (_AIScripts[actor]) { _AIScripts[actor]->Initialize(); } } void AIScripts::update(int actor) { - assert(actor < _actorCount); + if (actor >= _actorCount) { + return; + } + if (!_actorUpdating[actor]) { _actorUpdating[actor] = true; ++_inScriptCounter; @@ -81,7 +87,10 @@ void AIScripts::update(int actor) { } void AIScripts::timerExpired(int actor, int timer) { - assert(actor < _actorCount); + if (actor >= _actorCount) { + return; + } + _inScriptCounter++; if (_AIScripts[actor]) { _AIScripts[actor]->TimerExpired(timer); @@ -90,7 +99,10 @@ void AIScripts::timerExpired(int actor, int timer) { } void AIScripts::completedMovementTrack(int actor) { - assert(actor < _actorCount); + if (actor >= _actorCount) { + return; + } + if (!_vm->_actors[actor]->inCombat()) { _inScriptCounter++; if (_AIScripts[actor]) { @@ -101,7 +113,10 @@ void AIScripts::completedMovementTrack(int actor) { } void AIScripts::receivedClue(int actor, int clueId, int fromActorId) { - assert(actor < _actorCount); + if (actor >= _actorCount) { + return; + } + _inScriptCounter++; if (_AIScripts[actor]) { _AIScripts[actor]->ReceivedClue(clueId, fromActorId); @@ -110,7 +125,10 @@ void AIScripts::receivedClue(int actor, int clueId, int fromActorId) { } void AIScripts::clickedByPlayer(int actor) { - assert(actor < _actorCount); + if (actor >= _actorCount) { + return; + } + if(_vm->_actors[actor]->inCombat()) { return; @@ -124,7 +142,10 @@ void AIScripts::clickedByPlayer(int actor) { } void AIScripts::enteredScene(int actor, int setId) { - assert(actor < _actorCount); + if (actor >= _actorCount) { + return; + } + _inScriptCounter++; if (_AIScripts[actor]) { _AIScripts[actor]->EnteredScene(setId); @@ -133,7 +154,10 @@ void AIScripts::enteredScene(int actor, int setId) { } void AIScripts::otherAgentEnteredThisScene(int actor, int otherActorId) { - assert(actor < _actorCount); + if (actor >= _actorCount) { + return; + } + _inScriptCounter++; if (_AIScripts[actor]) { _AIScripts[actor]->OtherAgentEnteredThisScene(otherActorId); @@ -142,7 +166,10 @@ void AIScripts::otherAgentEnteredThisScene(int actor, int otherActorId) { } void AIScripts::otherAgentExitedThisScene(int actor, int otherActorId) { - assert(actor < _actorCount); + if (actor >= _actorCount) { + return; + } + _inScriptCounter++; if (_AIScripts[actor]) { _AIScripts[actor]->OtherAgentExitedThisScene(otherActorId); @@ -180,7 +207,10 @@ bool AIScripts::shotAtAndHit(int actorId) { } void AIScripts::retired(int actor, int retiredByActorId) { - assert(actor < _actorCount); + if (actor >= _actorCount) { + return; + } + _inScriptCounter++; if (_AIScripts[actor]) { _AIScripts[actor]->Retired(retiredByActorId); @@ -189,7 +219,10 @@ void AIScripts::retired(int actor, int retiredByActorId) { } void AIScripts::goalChanged(int actor, int currentGoalNumber, int newGoalNumber) { - assert(actor < _actorCount); + if (actor >= _actorCount) { + return; + } + _inScriptCounter++; if (_AIScripts[actor]) { _AIScripts[actor]->GoalChanged(currentGoalNumber, newGoalNumber); @@ -198,7 +231,10 @@ void AIScripts::goalChanged(int actor, int currentGoalNumber, int newGoalNumber) } bool AIScripts::reachedMovementTrackWaypoint(int actor, int waypointId) { - assert(actor < _actorCount); + if (actor >= _actorCount) { + return false; + } + bool result = false; if (!_vm->_actors[actor]->inCombat()) { _inScriptCounter++; @@ -211,7 +247,10 @@ bool AIScripts::reachedMovementTrackWaypoint(int actor, int waypointId) { } void AIScripts::updateAnimation(int actor, int *animation, int *frame) { - assert(actor < _actorCount); + if (actor >= _actorCount) { + return; + } + _inScriptCounter++; if (_AIScripts[actor]) { _AIScripts[actor]->UpdateAnimation(animation, frame); @@ -220,7 +259,10 @@ void AIScripts::updateAnimation(int actor, int *animation, int *frame) { } void AIScripts::changeAnimationMode(int actor, int mode) { - assert(actor < _actorCount); + if (actor >= _actorCount) { + return; + } + _inScriptCounter++; if (_AIScripts[actor]) { _AIScripts[actor]->ChangeAnimationMode(mode); |