Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Generals/Code/GameEngine/Include/GameLogic/Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ class Object : public Thing, public Snapshot
void removeCustomIndicatorColor();

Bool isLocallyControlled() const;
Bool isLocallyViewed() const;
Bool isNeutralControlled() const;

Bool getIsUndetectedDefector(void) const { return BitIsSet(m_privateStatus, UNDETECTED_DEFECTOR); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Bool ConvertToHijackedVehicleCrateCollide::executeCrateBehavior( Object *other )

//Before the actual defection takes place, play the "vehicle stolen" EVA
//event if the local player is the victim!
if( other->isLocallyControlled() )
if( other->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_VehicleStolen );
}
Expand Down
11 changes: 10 additions & 1 deletion Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "Common/Dict.h"
#include "Common/GameEngine.h"
#include "Common/GameState.h"
#include "Common/GameUtility.h"
#include "Common/ModuleFactory.h"
#include "Common/Player.h"
#include "Common/PlayerList.h"
Expand Down Expand Up @@ -1543,6 +1544,14 @@ Bool Object::isLocallyControlled() const
return getControllingPlayer() == ThePlayerList->getLocalPlayer();
}

//=============================================================================
// Object::isLocallyViewed
//=============================================================================
Bool Object::isLocallyViewed() const
{
return getControllingPlayer() == rts::getObservedOrLocalPlayer();
}

//=============================================================================
// Object::isLocallyControlled
//=============================================================================
Expand Down Expand Up @@ -4092,7 +4101,7 @@ void Object::onDie( DamageInfo *damageInfo )
deathSound.setPlayerIndex( index );
TheAudio->addAudioEvent(&deathSound);

if (isLocallyControlled() && !selfInflicted) // wasLocallyControlled? :-)
if (isLocallyViewed() && !selfInflicted) // wasLocallyViewed? :-)
{
if (isKindOf(KINDOF_STRUCTURE) && isKindOf(KINDOF_MP_COUNT_FOR_VICTORY))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ StateReturnType DozerActionDoActionState::update( void )
/// @todo need to write this

// do some UI stuff for the constrolling player
if( dozer->isLocallyControlled() )
if( dozer->isLocallyViewed() )
{

// message the the building player
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ UpdateSleepTime ProductionUpdate::update( void )
us->getID());

// print a message to the local player
if( us->isLocallyControlled() )
if( us->isLocallyViewed() )
{
UnicodeString msg;
UnicodeString format = TheGameText->fetch( "UPGRADE:UpgradeComplete" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ void SpecialAbilityUpdate::startPreparation()
draw->setAnimationCompletionTime(data->m_preparationFrames);

//Warn the victim so he might have a chance to react!
if( target && target->isLocallyControlled() )
if( target && target->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_BuildingBeingStolen );
}
Expand Down Expand Up @@ -954,7 +954,7 @@ void SpecialAbilityUpdate::startPreparation()
}

//Warn the victim so he might have a chance to react!
if( spTemplate->getSpecialPowerType() == SPECIAL_BLACKLOTUS_CAPTURE_BUILDING && target && target->isLocallyControlled() )
if( spTemplate->getSpecialPowerType() == SPECIAL_BLACKLOTUS_CAPTURE_BUILDING && target && target->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_BuildingBeingStolen );
}
Expand Down Expand Up @@ -1308,7 +1308,7 @@ void SpecialAbilityUpdate::triggerAbilityEffect()
}

//Play the "building stolen" EVA event if the local player is the victim!
if( target && target->isLocallyControlled() )
if( target && target->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_BuildingStolen );
}
Expand Down Expand Up @@ -1358,7 +1358,7 @@ void SpecialAbilityUpdate::triggerAbilityEffect()
controller->getScoreKeeper()->addMoneyEarned( cash );

//Play the "cash stolen" EVA event if the local player is the victim!
if( target && target->isLocallyControlled() )
if( target && target->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_CashStolen );
}
Expand Down
1 change: 1 addition & 0 deletions GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ class Object : public Thing, public Snapshot
void removeCustomIndicatorColor();

Bool isLocallyControlled() const;
Bool isLocallyViewed() const;
Bool isNeutralControlled() const;

Bool getIsUndetectedDefector(void) const { return BitIsSet(m_privateStatus, UNDETECTED_DEFECTOR); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Bool ConvertToHijackedVehicleCrateCollide::executeCrateBehavior( Object *other )

//Before the actual defection takes place, play the "vehicle stolen" EVA
//event if the local player is the victim!
if( other->isLocallyControlled() )
if( other->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_VehicleStolen );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Bool SabotageCommandCenterCrateCollide::executeCrateBehavior( Object *other )

//When the sabotage occurs, play the appropriate EVA
//event if the local player is the victim!
if( other->isLocallyControlled() )
if( other->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_BuildingSabotaged );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Bool SabotageFakeBuildingCrateCollide::executeCrateBehavior( Object *other )

//When the sabotage occurs, play the appropriate EVA
//event if the local player is the victim!
if( other->isLocallyControlled() )
if( other->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_BuildingSabotaged );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Bool SabotageInternetCenterCrateCollide::executeCrateBehavior( Object *other )

doSabotageFeedbackFX( other, CrateCollide::SAB_VICTIM_INTERNET_CENTER );

if( other->isLocallyControlled() )
if( other->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_BuildingSabotaged );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Bool SabotageMilitaryFactoryCrateCollide::executeCrateBehavior( Object *other )

doSabotageFeedbackFX( other, CrateCollide::SAB_VICTIM_MILITARY_FACTORY );

if( other->isLocallyControlled() )
if( other->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_BuildingSabotaged );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Bool SabotagePowerPlantCrateCollide::executeCrateBehavior( Object *other )

//When the sabotage occurs, play the appropriate EVA
//event if the local player is the victim!
if( other->isLocallyControlled() )
if( other->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_BuildingSabotaged );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Bool SabotageSuperweaponCrateCollide::executeCrateBehavior( Object *other )

//When the sabotage occurs, play the appropriate EVA
//event if the local player is the victim!
if( other->isLocallyControlled() )
if( other->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_BuildingSabotaged );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ Bool SabotageSupplyCenterCrateCollide::executeCrateBehavior( Object *other )
controller->getScoreKeeper()->addMoneyEarned( cash );

//Play the "cash stolen" EVA event if the local player is the victim!
if( other->isLocallyControlled() )
if( other->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_CashStolen );
}
Expand All @@ -173,7 +173,7 @@ Bool SabotageSupplyCenterCrateCollide::executeCrateBehavior( Object *other )
}
else
{
if( other->isLocallyControlled() )
if( other->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_BuildingSabotaged );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Bool SabotageSupplyDropzoneCrateCollide::executeCrateBehavior( Object *other )
controller->getScoreKeeper()->addMoneyEarned( cash );

//Play the "cash stolen" EVA event if the local player is the victim!
if( other->isLocallyControlled() )
if( other->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_CashStolen );
}
Expand All @@ -183,7 +183,7 @@ Bool SabotageSupplyDropzoneCrateCollide::executeCrateBehavior( Object *other )
}
else
{
if( other->isLocallyControlled() )
if( other->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_BuildingSabotaged );
}
Expand Down
11 changes: 10 additions & 1 deletion GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "Common/Dict.h"
#include "Common/GameEngine.h"
#include "Common/GameState.h"
#include "Common/GameUtility.h"
#include "Common/ModuleFactory.h"
#include "Common/Player.h"
#include "Common/PlayerList.h"
Expand Down Expand Up @@ -1698,6 +1699,14 @@ Bool Object::isLocallyControlled() const
return getControllingPlayer() == ThePlayerList->getLocalPlayer();
}

//=============================================================================
// Object::isLocallyViewed
//=============================================================================
Bool Object::isLocallyViewed() const
{
return getControllingPlayer() == rts::getObservedOrLocalPlayer();
}

//=============================================================================
// Object::isLocallyControlled
//=============================================================================
Expand Down Expand Up @@ -4595,7 +4604,7 @@ void Object::onDie( DamageInfo *damageInfo )
if(m_team)
m_team->notifyTeamOfObjectDeath();

if (isLocallyControlled() && !selfInflicted) // wasLocallyControlled? :-)
if (isLocallyViewed() && !selfInflicted) // wasLocallyViewed? :-)
{
if (isKindOf(KINDOF_STRUCTURE) && isKindOf(KINDOF_MP_COUNT_FOR_VICTORY))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ StateReturnType DozerActionDoActionState::update( void )
/// @todo need to write this

// do some UI stuff for the constrolling player
if( dozer->isLocallyControlled() )
if( dozer->isLocallyViewed() )
{

// message the the building player
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ UpdateSleepTime ProductionUpdate::update( void )
us->getID());

// print a message to the local player, if it wants one
if( us->isLocallyControlled() && !upgrade->getDisplayNameLabel().isEmpty() )
if( us->isLocallyViewed() && !upgrade->getDisplayNameLabel().isEmpty() )
{
UnicodeString msg;
UnicodeString format = TheGameText->fetch( "UPGRADE:UpgradeComplete" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ void SpecialAbilityUpdate::startPreparation()
draw->setAnimationCompletionTime(data->m_preparationFrames);

//Warn the victim so he might have a chance to react!
if( target && target->isLocallyControlled() )
if( target && target->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_BuildingBeingStolen );
}
Expand Down Expand Up @@ -1068,7 +1068,7 @@ void SpecialAbilityUpdate::startPreparation()
}

//Warn the victim so he might have a chance to react!
if( spTemplate->getSpecialPowerType() == SPECIAL_BLACKLOTUS_CAPTURE_BUILDING && target && target->isLocallyControlled() )
if( spTemplate->getSpecialPowerType() == SPECIAL_BLACKLOTUS_CAPTURE_BUILDING && target && target->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_BuildingBeingStolen );
}
Expand Down Expand Up @@ -1454,7 +1454,7 @@ void SpecialAbilityUpdate::triggerAbilityEffect()
}

//Play the "building stolen" EVA event if the local player is the victim!
if( target && target->isLocallyControlled() )
if( target && target->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_BuildingStolen );
}
Expand Down Expand Up @@ -1504,7 +1504,7 @@ void SpecialAbilityUpdate::triggerAbilityEffect()
controller->getScoreKeeper()->addMoneyEarned( cash );

//Play the "cash stolen" EVA event if the local player is the victim!
if( target && target->isLocallyControlled() )
if( target && target->isLocallyViewed() )
{
TheEva->setShouldPlay( EVA_CashStolen );
}
Expand Down
Loading