sources » TechnoTypeClass » GetRefund
int TechnoTypeClass::GetRefund(HouseClass *OwnerHouse, bool OverrideLogic) {
float RefundPercent = Rules->RefundPercent;
if( OverrideLogic ) {
RefundPercent = 1.0;
}
double Refund;
if( !OwnerHouse ) {
Refund = this->GetCost();
return FloatToInt(Refund * RefundPercent);
}
double countryMult = OwnerHouse->GetCountryCostMult(this);
double typeMult = OwnerHouse->GetTypeCostMult(this);
int Soylent = this->Soylent; // [foo]Soylent = (defaults to zero)
if( Soylent ) {
return FloatToInt(Soylent * countryMult);
}
int Cost = this->GetCost();
Refund = Cost * typeMult * countryMult;
if( OwnerHouse->IsHumanControlled() ) {
Refund *= RefundPercent;
}
return FloatToInt(Refund);
}