From 856b34b446f6e9cb993de659d906fc112ad206a9 Mon Sep 17 00:00:00 2001 From: Flugente Date: Fri, 22 May 2015 19:45:59 +0000 Subject: [PATCH] Fix: endless clock as vehicle tries to cower git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7875 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Soldier Control.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index ed1ac75e0..ee450df8c 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -9583,13 +9583,19 @@ void SOLDIERTYPE::BeginSoldierGetup( void ) pStructureFileRef = GetAnimationStructureRef( this->ubID, DetermineSoldierAnimationSurface( this, ANIM_CROUCH ), ANIM_CROUCH ); break; } - fEnoughPlace = OkayToAddStructureToWorld( this->sGridNo, this->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[this->ubDirection]]), this->ubID, FALSE, NOBODY ); + + if ( pStructureFileRef ) + fEnoughPlace = OkayToAddStructureToWorld( this->sGridNo, this->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[this->ubDirection]]), this->ubID, FALSE, NOBODY ); } - else + // vehicles can't cower... + else if ( !(this->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { pStructureFileRef = GetAnimationStructureRef( this->ubID, DetermineSoldierAnimationSurface( this, END_COWER ), END_COWER ); - fEnoughPlace = OkayToAddStructureToWorld( this->sGridNo, this->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[this->ubDirection]]), this->ubID, FALSE, NOBODY ); + + if ( pStructureFileRef ) + fEnoughPlace = OkayToAddStructureToWorld( this->sGridNo, this->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[this->ubDirection]]), this->ubID, FALSE, NOBODY ); } + if ( this->stats.bLife >= OKLIFE && this->bBreath >= OKBREATH && (this->bSleepDrugCounter == 0) && fEnoughPlace ) { // get up you hoser! @@ -9624,7 +9630,8 @@ void SOLDIERTYPE::BeginSoldierGetup( void ) break; } } - else + // vehicles can't cower... + else if ( !(this->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { this->EVENT_InitNewSoldierAnim( END_COWER, 0, FALSE ); }