sources » HouseClass » GotPoweredCenter
/* gets called in BuildingClass::Update_Powered_State:
*
* this->OwningPlayer->GoPoweredCenter(this->PowersUnit);
*
*/
void HouseClass::GotPoweredCenter(UnitTypeClass *PowerUnit) {
++this->countPoweredCenters; // powered center count is per-house
if ( this->countPoweredCenters != 1 ) {
return;
}
if ( !PowerUnit ) {
return;
}
bool didWakeupSomething = 0;
int idxTechno = vec_Technoes.length - 1; // vec_Technoes is a vector containing all the instances of TechnoTypes currently on the map
if ( vec_Technoes.length - 1 < 0 ) {
return;
}
do {
TechnoClass *Techno = vec_Technoes[idxTechno];
if ( Techno->OwningPlayer == this ) {
if ( Techno->GetTechnoType() == PowerUnit ) { // this check prevents other powered units from waking up
if ( !Techno->ignore ) {
Techno->Activate();
didWakeupSomething = 1;
}
}
}
--idxTechno;
} while ( idxTechno >= 0 );
if ( !didWakeupSomething ) {
return;
}
if ( GameData.idxGameMode != gmSingleplayerCampaign && this != PlayerHouse ) {
return;
} else if ( !this->IsHuman && !this->IsPlayer ) {
return;
}
if ( RadioMutexoid ) {
return;
}
VoxClass::PlayFromName("EVA_RobotTanksBackOnline", -1, -1);
}