/* gets called in BuildingClass::Update_Powered_State:
 *
 * this->OwningPlayer->LostPoweredCenter(this->PowersUnit);
 *
 */
void HouseClass::LostPoweredCenter(UnitTypeClass *PowerUnit) {

  --this->countPoweredCenters; // powered center count is per-house
  if ( this->countPoweredCenters ) {
    return;
  }

  if ( !PowerUnit ) {
    return;
  }

  bool didShutdownSomething = 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 shutting down, but then UnitClass::UpdatePosition shuts them down anyway
        if ( !Techno->ignore ) {
          Techno->Deactivate();
          didShutdownSomething = 1;
        }
      }
    }
    --idxTechno;
  } while ( idxTechno >= 0 );

  if ( !didShutdownSomething ) {
    return;
  }

  if ( GameData.idxGameMode != gmSingleplayerCampaign && this != PlayerHouse ) {
    return;
  }

  if ( !this->IsHuman && !this->IsPlayer ) {
    return;
  }

  if ( RadioMutexoid ) {
    return;
  }

  VoxClass::PlayFromName("EVA_RobotTanksOffline", -1, -1);
}