From 6221d74644922ea4bbba3ed9cd8bbec42398f77b Mon Sep 17 00:00:00 2001 From: smatz Date: Sat, 16 May 2009 23:34:14 +0000 Subject: (svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index) --- src/ai/api/ai_town.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/ai/api/ai_town.cpp') diff --git a/src/ai/api/ai_town.cpp b/src/ai/api/ai_town.cpp index f7584c979..a37d065e5 100644 --- a/src/ai/api/ai_town.cpp +++ b/src/ai/api/ai_town.cpp @@ -39,21 +39,21 @@ /* static */ int32 AITown::GetPopulation(TownID town_id) { if (!IsValidTown(town_id)) return -1; - const Town *t = ::GetTown(town_id); + const Town *t = ::Town::Get(town_id); return t->population; } /* static */ int32 AITown::GetHouseCount(TownID town_id) { if (!IsValidTown(town_id)) return -1; - const Town *t = ::GetTown(town_id); + const Town *t = ::Town::Get(town_id); return t->num_houses; } /* static */ TileIndex AITown::GetLocation(TownID town_id) { if (!IsValidTown(town_id)) return INVALID_TILE; - const Town *t = ::GetTown(town_id); + const Town *t = ::Town::Get(town_id); return t->xy; } @@ -62,7 +62,7 @@ if (!IsValidTown(town_id)) return -1; if (!AICargo::IsValidCargo(cargo_id)) return -1; - const Town *t = ::GetTown(town_id); + const Town *t = ::Town::Get(town_id); switch(AICargo::GetTownEffect(cargo_id)) { case AICargo::TE_PASSENGERS: return t->act_pass; @@ -76,7 +76,7 @@ if (!IsValidTown(town_id)) return -1; if (!AICargo::IsValidCargo(cargo_id)) return -1; - const Town *t = ::GetTown(town_id); + const Town *t = ::Town::Get(town_id); switch(AICargo::GetTownEffect(cargo_id)) { case AICargo::TE_PASSENGERS: return t->pct_pass_transported; @@ -90,7 +90,7 @@ if (!IsValidTown(town_id)) return -1; if (!AICargo::IsValidCargo(cargo_id)) return -1; - const Town *t = ::GetTown(town_id); + const Town *t = ::Town::Get(town_id); switch(AICargo::GetTownEffect(cargo_id)) { case AICargo::TE_PASSENGERS: return t->max_pass; @@ -113,7 +113,7 @@ { if (!IsValidTown(town_id)) return false; - const Town *t = ::GetTown(town_id); + const Town *t = ::Town::Get(town_id); return ((uint32)GetDistanceSquareToTile(town_id, tile) <= t->squared_town_zone_radius[0]); } @@ -121,35 +121,35 @@ { if (!IsValidTown(town_id)) return false; - return ::HasBit(::GetTown(town_id)->statues, _current_company); + return ::HasBit(::Town::Get(town_id)->statues, _current_company); } /* static */ int AITown::GetRoadReworkDuration(TownID town_id) { if (!IsValidTown(town_id)) return -1; - return ::GetTown(town_id)->road_build_months; + return ::Town::Get(town_id)->road_build_months; } /* static */ AICompany::CompanyID AITown::GetExclusiveRightsCompany(TownID town_id) { if (!IsValidTown(town_id)) return AICompany::COMPANY_INVALID; - return (AICompany::CompanyID)(int8)::GetTown(town_id)->exclusivity; + return (AICompany::CompanyID)(int8)::Town::Get(town_id)->exclusivity; } /* static */ int32 AITown::GetExclusiveRightsDuration(TownID town_id) { if (!IsValidTown(town_id)) return -1; - return ::GetTown(town_id)->exclusive_counter; + return ::Town::Get(town_id)->exclusive_counter; } /* static */ bool AITown::IsActionAvailable(TownID town_id, TownAction town_action) { if (!IsValidTown(town_id)) return false; - return HasBit(::GetMaskOfTownActions(NULL, _current_company, ::GetTown(town_id)), town_action); + return HasBit(::GetMaskOfTownActions(NULL, _current_company, ::Town::Get(town_id)), town_action); } /* static */ bool AITown::PerformTownAction(TownID town_id, TownAction town_action) @@ -157,7 +157,7 @@ EnforcePrecondition(false, IsValidTown(town_id)); EnforcePrecondition(false, IsActionAvailable(town_id, town_action)); - return AIObject::DoCommand(::GetTown(town_id)->xy, town_id, town_action, CMD_DO_TOWN_ACTION); + return AIObject::DoCommand(::Town::Get(town_id)->xy, town_id, town_action, CMD_DO_TOWN_ACTION); } /* static */ AITown::TownRating AITown::GetRating(TownID town_id, AICompany::CompanyID company_id) @@ -166,7 +166,7 @@ AICompany::CompanyID company = AICompany::ResolveCompanyID(company_id); if (company == AICompany::COMPANY_INVALID) return TOWN_RATING_INVALID; - const Town *t = ::GetTown(town_id); + const Town *t = ::Town::Get(town_id); if (!HasBit(t->have_ratings, company)) return TOWN_RATING_NONE; return max(TOWN_RATING_APPALLING, (TownRating)((t->ratings[company] / 200) + 3)); } @@ -175,7 +175,7 @@ { if (!IsValidTown(town_id)) return -1; - const Town *t = ::GetTown(town_id); + const Town *t = ::Town::Get(town_id); if (_settings_game.economy.station_noise_level) { return t->MaxTownNoise() - t->noise_reached; } @@ -192,5 +192,5 @@ { if (!IsValidTown(town_id)) return ROAD_LAYOUT_INVALID; - return (AITown::RoadLayout)((TownLayout)::GetTown(town_id)->layout); + return (AITown::RoadLayout)((TownLayout)::Town::Get(town_id)->layout); } -- cgit v1.2.3-54-g00ecf