Skip to content

Commit cf6bfcf

Browse files
committed
refactor: Cache relationship
1 parent 60609ab commit cf6bfcf

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location )
551551
SpecialPowerType type = getSpecialPowerModuleData()->m_specialPowerTemplate->getSpecialPowerType();
552552

553553
Player *localPlayer = TheControlBar->getCurrentlyViewedPlayer();
554+
Relationship relationship = TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam());
554555

555556
// Only play the EVA sounds if this is not the local player, and the local player doesn't consider the
556557
// person an enemy.
@@ -564,7 +565,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location )
564565
{
565566
TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_ParticleCannon);
566567
}
567-
else if ( TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam()) != ENEMIES )
568+
else if (relationship != ENEMIES)
568569
{
569570
// Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference???
570571
TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_ParticleCannon);
@@ -580,7 +581,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location )
580581
{
581582
TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_Nuke);
582583
}
583-
else if ( TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam()) != ENEMIES )
584+
else if (relationship != ENEMIES)
584585
{
585586
// Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference???
586587
TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_Nuke);
@@ -596,7 +597,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location )
596597
{
597598
TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_ScudStorm);
598599
}
599-
else if ( TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam()) != ENEMIES )
600+
else if (relationship != ENEMIES)
600601
{
601602
// Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference???
602603
TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_ScudStorm);
@@ -614,7 +615,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location )
614615
{
615616
TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_GPS_Scrambler);
616617
}
617-
else if ( TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam()) != ENEMIES )
618+
else if (relationship != ENEMIES)
618619
{
619620
// Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference???
620621
TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_GPS_Scrambler);
@@ -630,7 +631,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location )
630631
{
631632
TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_Sneak_Attack);
632633
}
633-
else if ( TheControlBar->getCurrentlyViewedPlayerRelationship(getObject()->getTeam()) != ENEMIES )
634+
else if (relationship != ENEMIES)
634635
{
635636
// Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference???
636637
TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_Sneak_Attack);

0 commit comments

Comments
 (0)