Skip to content

Commit fe380a8

Browse files
committed
refactor: Move animation condition closer to where it is used
1 parent 4b83d4d commit fe380a8

File tree

2 files changed

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

2 files changed

+15
-15
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2775,13 +2775,6 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne
27752775
if (body)
27762776
body->onVeterancyLevelChanged(oldLevel, newLevel, provideFeedback);
27772777

2778-
Bool doAnimation = provideFeedback
2779-
&& newLevel > oldLevel
2780-
&& !isKindOf(KINDOF_IGNORED_IN_GUI)
2781-
&& (isLocallyControlled()
2782-
|| !testStatus(OBJECT_STATUS_STEALTHED)
2783-
|| testStatus(OBJECT_STATUS_DETECTED));
2784-
27852778
switch (newLevel)
27862779
{
27872780
case LEVEL_REGULAR:
@@ -2818,6 +2811,13 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne
28182811
break;
28192812
}
28202813

2814+
Bool doAnimation = provideFeedback
2815+
&& newLevel > oldLevel
2816+
&& !isKindOf(KINDOF_IGNORED_IN_GUI)
2817+
&& (isLocallyControlled()
2818+
|| !testStatus(OBJECT_STATUS_STEALTHED)
2819+
|| testStatus(OBJECT_STATUS_DETECTED));
2820+
28212821
if( doAnimation && TheGameLogic->getDrawIconUI() )
28222822
{
28232823
if( TheAnim2DCollection && TheGlobalData->m_levelGainAnimationName.isEmpty() == FALSE )

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3090,14 +3090,6 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne
30903090
if (body)
30913091
body->onVeterancyLevelChanged( oldLevel, newLevel, provideFeedback );
30923092

3093-
Bool doAnimation = provideFeedback
3094-
&& newLevel > oldLevel
3095-
&& !isKindOf(KINDOF_IGNORED_IN_GUI)
3096-
&& (isLocallyControlled()
3097-
|| !testStatus(OBJECT_STATUS_STEALTHED)
3098-
|| testStatus(OBJECT_STATUS_DETECTED)
3099-
|| testStatus(OBJECT_STATUS_DISGUISED));
3100-
31013093
switch (newLevel)
31023094
{
31033095
case LEVEL_REGULAR:
@@ -3134,6 +3126,14 @@ void Object::onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel ne
31343126
break;
31353127
}
31363128

3129+
Bool doAnimation = provideFeedback
3130+
&& newLevel > oldLevel
3131+
&& !isKindOf(KINDOF_IGNORED_IN_GUI)
3132+
&& (isLocallyControlled()
3133+
|| !testStatus(OBJECT_STATUS_STEALTHED)
3134+
|| testStatus(OBJECT_STATUS_DETECTED)
3135+
|| testStatus(OBJECT_STATUS_DISGUISED));
3136+
31373137
if( doAnimation && TheGameLogic->getDrawIconUI() )
31383138
{
31393139
if( TheAnim2DCollection && TheGlobalData->m_levelGainAnimationName.isEmpty() == FALSE )

0 commit comments

Comments
 (0)