Skip to content

Commit 51bdeb1

Browse files
committed
refactor: Only evaluate animation conditions if provide-feedback is true
1 parent f099e4d commit 51bdeb1

File tree

2 files changed

+27
-17
lines changed
  • GeneralsMD/Code/GameEngine/Source/GameLogic/Object
  • Generals/Code/GameEngine/Source/GameLogic/Object

2 files changed

+27
-17
lines changed

Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2776,16 +2776,21 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne
27762776
body->onVeterancyLevelChanged(oldLevel, newLevel, provideFeedback);
27772777

27782778
Bool hideAnimationForStealth = FALSE;
2779-
if( !isLocallyControlled() &&
2780-
testStatus( OBJECT_STATUS_STEALTHED ) &&
2781-
!testStatus( OBJECT_STATUS_DETECTED ) )
2779+
Bool doAnimation = FALSE;
2780+
2781+
if (provideFeedback)
27822782
{
2783-
hideAnimationForStealth = TRUE;
2784-
}
2783+
if( !isLocallyControlled() &&
2784+
testStatus( OBJECT_STATUS_STEALTHED ) &&
2785+
!testStatus( OBJECT_STATUS_DETECTED ) )
2786+
{
2787+
hideAnimationForStealth = TRUE;
2788+
}
27852789

2786-
Bool doAnimation = ( ! hideAnimationForStealth
2787-
&& (newLevel > oldLevel)
2788-
&& ( ! isKindOf(KINDOF_IGNORED_IN_GUI))); //First, we plan to do the animation if the level went up
2790+
doAnimation = ( ! hideAnimationForStealth
2791+
&& (newLevel > oldLevel)
2792+
&& ( ! isKindOf(KINDOF_IGNORED_IN_GUI))); //First, we plan to do the animation if the level went up
2793+
}
27892794

27902795
switch (newLevel)
27912796
{

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3091,17 +3091,22 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne
30913091
body->onVeterancyLevelChanged( oldLevel, newLevel, provideFeedback );
30923092

30933093
Bool hideAnimationForStealth = FALSE;
3094-
if( !isLocallyControlled() &&
3095-
testStatus( OBJECT_STATUS_STEALTHED ) &&
3096-
!testStatus( OBJECT_STATUS_DETECTED ) &&
3097-
!testStatus( OBJECT_STATUS_DISGUISED ) )
3094+
Bool doAnimation = FALSE;
3095+
3096+
if (provideFeedback)
30983097
{
3099-
hideAnimationForStealth = TRUE;
3100-
}
3098+
if( !isLocallyControlled() &&
3099+
testStatus( OBJECT_STATUS_STEALTHED ) &&
3100+
!testStatus( OBJECT_STATUS_DETECTED ) &&
3101+
!testStatus( OBJECT_STATUS_DISGUISED ) )
3102+
{
3103+
hideAnimationForStealth = TRUE;
3104+
}
31013105

3102-
Bool doAnimation = ( ! hideAnimationForStealth
3103-
&& (newLevel > oldLevel)
3104-
&& ( ! isKindOf(KINDOF_IGNORED_IN_GUI))); //First, we plan to do the animation if the level went up
3106+
doAnimation = ( ! hideAnimationForStealth
3107+
&& (newLevel > oldLevel)
3108+
&& ( ! isKindOf(KINDOF_IGNORED_IN_GUI))); //First, we plan to do the animation if the level went up
3109+
}
31053110

31063111
switch (newLevel)
31073112
{

0 commit comments

Comments
 (0)