(svn r17294) -Add [NoAI]: AITown::GetLastMonthTransportedPercentage and AIIndustry::GetLastMonthTransportedPercentage

This commit is contained in:
smatz
2009-08-27 13:50:07 +00:00
parent 15242b3ac8
commit e126e1e9c6
7 changed files with 91 additions and 37 deletions

View File

@@ -98,6 +98,20 @@
return -1;
}
/* static */ int32 AIIndustry::GetLastMonthTransportedPercentage(IndustryID industry_id, CargoID cargo_id)
{
if (!IsValidIndustry(industry_id)) return -1;
if (!AICargo::IsValidCargo(cargo_id)) return -1;
const Industry *i = ::Industry::Get(industry_id);
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
if (i->produced_cargo[j] == cargo_id) return ::ToPercent8(i->last_month_pct_transported[j]);
}
return -1;
}
/* static */ TileIndex AIIndustry::GetLocation(IndustryID industry_id)
{
if (!IsValidIndustry(industry_id)) return INVALID_TILE;