diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp index 60f36ff172..37aaf7dd34 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp @@ -31,6 +31,7 @@ #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine #include "Common/GameAudio.h" +#include "Common/GameUtility.h" #include "Common/GlobalData.h" #include "Common/INI.h" #include "Common/Player.h" @@ -550,7 +551,8 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) // Let EVA do her thing SpecialPowerType type = getSpecialPowerModuleData()->m_specialPowerTemplate->getSpecialPowerType(); - Player *localPlayer = ThePlayerList->getLocalPlayer(); + Player *localPlayer = rts::getObservedOrLocalPlayer(); + Relationship relationship = localPlayer->getRelationship(getObject()->getTeam()); // Only play the EVA sounds if this is not the local player, and the local player doesn't consider the // person an enemy. @@ -564,7 +566,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) { TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_ParticleCannon); } - else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) + else if (relationship != ENEMIES) { // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_ParticleCannon); @@ -580,7 +582,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) { TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_Nuke); } - else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) + else if (relationship != ENEMIES) { // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_Nuke); @@ -596,7 +598,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) { TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_ScudStorm); } - else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) + else if (relationship != ENEMIES) { // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_ScudStorm); @@ -614,7 +616,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) { TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_GPS_Scrambler); } - else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) + else if (relationship != ENEMIES) { // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_GPS_Scrambler); @@ -630,7 +632,7 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) { TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_Sneak_Attack); } - else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) + else if (relationship != ENEMIES) { // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_Sneak_Attack);