diff options
author | smatz <smatz@openttd.org> | 2009-05-16 23:34:14 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-05-16 23:34:14 +0000 |
commit | 6221d74644922ea4bbba3ed9cd8bbec42398f77b (patch) | |
tree | 0069bbd6bb7525754c5d9353132f5dc64a0996cc /src/ai/api | |
parent | 814f153b5a98e0030cbd221e6a89e083ce62bb1d (diff) | |
download | openttd-6221d74644922ea4bbba3ed9cd8bbec42398f77b.tar.xz |
(svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
Diffstat (limited to 'src/ai/api')
-rw-r--r-- | src/ai/api/ai_airport.cpp | 2 | ||||
-rw-r--r-- | src/ai/api/ai_cargolist.cpp | 4 | ||||
-rw-r--r-- | src/ai/api/ai_company.cpp | 14 | ||||
-rw-r--r-- | src/ai/api/ai_controller.cpp | 2 | ||||
-rw-r--r-- | src/ai/api/ai_engine.cpp | 28 | ||||
-rw-r--r-- | src/ai/api/ai_event_types.cpp | 12 | ||||
-rw-r--r-- | src/ai/api/ai_group.cpp | 10 | ||||
-rw-r--r-- | src/ai/api/ai_industry.cpp | 24 | ||||
-rw-r--r-- | src/ai/api/ai_order.cpp | 42 | ||||
-rw-r--r-- | src/ai/api/ai_sign.cpp | 4 | ||||
-rw-r--r-- | src/ai/api/ai_station.cpp | 18 | ||||
-rw-r--r-- | src/ai/api/ai_stationlist.cpp | 2 | ||||
-rw-r--r-- | src/ai/api/ai_subsidy.cpp | 2 | ||||
-rw-r--r-- | src/ai/api/ai_tilelist.cpp | 6 | ||||
-rw-r--r-- | src/ai/api/ai_town.cpp | 32 | ||||
-rw-r--r-- | src/ai/api/ai_vehicle.cpp | 82 | ||||
-rw-r--r-- | src/ai/api/ai_vehiclelist.cpp | 2 | ||||
-rw-r--r-- | src/ai/api/ai_waypoint.cpp | 4 | ||||
-rw-r--r-- | src/ai/api/ai_waypointlist.cpp | 2 |
19 files changed, 146 insertions, 146 deletions
diff --git a/src/ai/api/ai_airport.cpp b/src/ai/api/ai_airport.cpp index 819880f97..1a5ea04ee 100644 --- a/src/ai/api/ai_airport.cpp +++ b/src/ai/api/ai_airport.cpp @@ -110,7 +110,7 @@ if (!AIStation::HasStationType(station_id, AIStation::STATION_AIRPORT)) return AT_INVALID; - return (AirportType)::GetStation(station_id)->airport_type; + return (AirportType)::Station::Get(station_id)->airport_type; } diff --git a/src/ai/api/ai_cargolist.cpp b/src/ai/api/ai_cargolist.cpp index fe92a3886..d35e54e30 100644 --- a/src/ai/api/ai_cargolist.cpp +++ b/src/ai/api/ai_cargolist.cpp @@ -22,7 +22,7 @@ AICargoList_IndustryAccepting::AICargoList_IndustryAccepting(IndustryID industry { if (!AIIndustry::IsValidIndustry(industry_id)) return; - Industry *ind = ::GetIndustry(industry_id); + Industry *ind = ::Industry::Get(industry_id); for (uint i = 0; i < lengthof(ind->accepts_cargo); i++) { CargoID cargo_id = ind->accepts_cargo[i]; if (cargo_id != CT_INVALID) { @@ -35,7 +35,7 @@ AICargoList_IndustryProducing::AICargoList_IndustryProducing(IndustryID industry { if (!AIIndustry::IsValidIndustry(industry_id)) return; - Industry *ind = ::GetIndustry(industry_id); + Industry *ind = ::Industry::Get(industry_id); for (uint i = 0; i < lengthof(ind->produced_cargo); i++) { CargoID cargo_id = ind->produced_cargo[i]; if (cargo_id != CT_INVALID) { diff --git a/src/ai/api/ai_company.cpp b/src/ai/api/ai_company.cpp index 89ad2d728..075ef6b51 100644 --- a/src/ai/api/ai_company.cpp +++ b/src/ai/api/ai_company.cpp @@ -76,7 +76,7 @@ company = ResolveCompanyID(company); if (company == COMPANY_INVALID) return -1; - return ::CalculateCompanyValue(::GetCompany((CompanyID)company)); + return ::CalculateCompanyValue(::Company::Get((CompanyID)company)); } /* static */ Money AICompany::GetBankBalance(AICompany::CompanyID company) @@ -84,12 +84,12 @@ company = ResolveCompanyID(company); if (company == COMPANY_INVALID) return -1; - return ::GetCompany((CompanyID)company)->money; + return ::Company::Get((CompanyID)company)->money; } /* static */ Money AICompany::GetLoanAmount() { - return ::GetCompany(_current_company)->current_loan; + return ::Company::Get(_current_company)->current_loan; } /* static */ Money AICompany::GetMaxLoanAmount() @@ -142,7 +142,7 @@ company = ResolveCompanyID(company); if (company == COMPANY_INVALID) return INVALID_TILE; - TileIndex loc = ::GetCompany((CompanyID)company)->location_of_HQ; + TileIndex loc = ::Company::Get((CompanyID)company)->location_of_HQ; return (loc == 0) ? INVALID_TILE : loc; } @@ -156,7 +156,7 @@ company = ResolveCompanyID(company); if (company == COMPANY_INVALID) return false; - return ::GetCompany((CompanyID)company)->settings.engine_renew; + return ::Company::Get((CompanyID)company)->settings.engine_renew; } /* static */ bool AICompany::SetAutoRenewMonths(int16 months) @@ -169,7 +169,7 @@ company = ResolveCompanyID(company); if (company == COMPANY_INVALID) return 0; - return ::GetCompany((CompanyID)company)->settings.engine_renew_months; + return ::Company::Get((CompanyID)company)->settings.engine_renew_months; } /* static */ bool AICompany::SetAutoRenewMoney(uint32 money) @@ -182,5 +182,5 @@ company = ResolveCompanyID(company); if (company == COMPANY_INVALID) return 0; - return ::GetCompany((CompanyID)company)->settings.engine_renew_money; + return ::Company::Get((CompanyID)company)->settings.engine_renew_money; } diff --git a/src/ai/api/ai_controller.cpp b/src/ai/api/ai_controller.cpp index f9ef2ab16..24510b7e7 100644 --- a/src/ai/api/ai_controller.cpp +++ b/src/ai/api/ai_controller.cpp @@ -59,7 +59,7 @@ AIController::~AIController() /* static */ uint AIController::GetTick() { - return ::GetCompany(_current_company)->ai_instance->GetController()->ticks; + return ::Company::Get(_current_company)->ai_instance->GetController()->ticks; } /* static */ int AIController::GetSetting(const char *name) diff --git a/src/ai/api/ai_engine.cpp b/src/ai/api/ai_engine.cpp index 669c44ec5..5e0ac5b4a 100644 --- a/src/ai/api/ai_engine.cpp +++ b/src/ai/api/ai_engine.cpp @@ -15,7 +15,7 @@ /* static */ bool AIEngine::IsValidEngine(EngineID engine_id) { - return ::IsEngineIndex(engine_id) && HasBit(::GetEngine(engine_id)->company_avail, _current_company); + return ::IsEngineIndex(engine_id) && HasBit(::Engine::Get(engine_id)->company_avail, _current_company); } /* static */ char *AIEngine::GetName(EngineID engine_id) @@ -34,7 +34,7 @@ { if (!IsValidEngine(engine_id)) return CT_INVALID; - const Engine *e = ::GetEngine(engine_id); + const Engine *e = ::Engine::Get(engine_id); if (!e->CanCarryCargo()) return CT_INVALID; return e->GetDefaultCargoType(); @@ -46,8 +46,8 @@ if (!AICargo::IsValidCargo(cargo_id)) return false; if (GetCargoType(engine_id) == cargo_id) return true; - if (cargo_id == CT_MAIL && ::GetEngine(engine_id)->type == VEH_AIRCRAFT) return true; - if (::GetEngine(engine_id)->type == VEH_SHIP && !ShipVehInfo(engine_id)->refittable) return false; + if (cargo_id == CT_MAIL && ::Engine::Get(engine_id)->type == VEH_AIRCRAFT) return true; + if (::Engine::Get(engine_id)->type == VEH_SHIP && !ShipVehInfo(engine_id)->refittable) return false; return ::CanRefitTo(engine_id, cargo_id); } @@ -65,7 +65,7 @@ { if (!IsValidEngine(engine_id)) return -1; - const Engine *e = ::GetEngine(engine_id); + const Engine *e = ::Engine::Get(engine_id); switch (e->type) { case VEH_ROAD: case VEH_TRAIN: { @@ -91,14 +91,14 @@ if (!IsValidEngine(engine_id)) return -1; if (GetVehicleType(engine_id) == AIVehicle::VT_RAIL && IsWagon(engine_id)) return -1; - return (::GetEngine(engine_id)->reliability * 100 >> 16); + return (::Engine::Get(engine_id)->reliability * 100 >> 16); } /* static */ int32 AIEngine::GetMaxSpeed(EngineID engine_id) { if (!IsValidEngine(engine_id)) return -1; - const Engine *e = ::GetEngine(engine_id); + const Engine *e = ::Engine::Get(engine_id); int32 max_speed = e->GetDisplayMaxSpeed(); // km-ish/h if (e->type == VEH_AIRCRAFT) max_speed /= _settings_game.vehicle.plane_speed; return max_speed; @@ -108,7 +108,7 @@ { if (!IsValidEngine(engine_id)) return -1; - return ::GetEngine(engine_id)->GetCost(); + return ::Engine::Get(engine_id)->GetCost(); } /* static */ int32 AIEngine::GetMaxAge(EngineID engine_id) @@ -116,14 +116,14 @@ if (!IsValidEngine(engine_id)) return -1; if (GetVehicleType(engine_id) == AIVehicle::VT_RAIL && IsWagon(engine_id)) return -1; - return ::GetEngine(engine_id)->lifelength * DAYS_IN_LEAP_YEAR; + return ::Engine::Get(engine_id)->lifelength * DAYS_IN_LEAP_YEAR; } /* static */ Money AIEngine::GetRunningCost(EngineID engine_id) { if (!IsValidEngine(engine_id)) return -1; - return ::GetEngine(engine_id)->GetRunningCost(); + return ::Engine::Get(engine_id)->GetRunningCost(); } /* static */ int32 AIEngine::GetPower(EngineID engine_id) @@ -132,7 +132,7 @@ if (GetVehicleType(engine_id) != AIVehicle::VT_RAIL) return -1; if (IsWagon(engine_id)) return -1; - return ::GetEngine(engine_id)->GetPower(); + return ::Engine::Get(engine_id)->GetPower(); } /* static */ int32 AIEngine::GetWeight(EngineID engine_id) @@ -140,7 +140,7 @@ if (!IsValidEngine(engine_id)) return -1; if (GetVehicleType(engine_id) != AIVehicle::VT_RAIL) return -1; - return ::GetEngine(engine_id)->GetDisplayWeight(); + return ::Engine::Get(engine_id)->GetDisplayWeight(); } /* static */ int32 AIEngine::GetMaxTractiveEffort(EngineID engine_id) @@ -149,14 +149,14 @@ if (GetVehicleType(engine_id) != AIVehicle::VT_RAIL) return -1; if (IsWagon(engine_id)) return -1; - return ::GetEngine(engine_id)->GetDisplayMaxTractiveEffort(); + return ::Engine::Get(engine_id)->GetDisplayMaxTractiveEffort(); } /* static */ AIVehicle::VehicleType AIEngine::GetVehicleType(EngineID engine_id) { if (!IsValidEngine(engine_id)) return AIVehicle::VT_INVALID; - switch (::GetEngine(engine_id)->type) { + switch (::Engine::Get(engine_id)->type) { case VEH_ROAD: return AIVehicle::VT_ROAD; case VEH_TRAIN: return AIVehicle::VT_RAIL; case VEH_SHIP: return AIVehicle::VT_WATER; diff --git a/src/ai/api/ai_event_types.cpp b/src/ai/api/ai_event_types.cpp index bf6bfeb88..80607220d 100644 --- a/src/ai/api/ai_event_types.cpp +++ b/src/ai/api/ai_event_types.cpp @@ -24,14 +24,14 @@ char *AIEventEnginePreview::GetName() CargoID AIEventEnginePreview::GetCargoType() { - const Engine *e = ::GetEngine(engine); + const Engine *e = ::Engine::Get(engine); if (!e->CanCarryCargo()) return CT_INVALID; return e->GetDefaultCargoType(); } int32 AIEventEnginePreview::GetCapacity() { - const Engine *e = ::GetEngine(engine); + const Engine *e = ::Engine::Get(engine); switch (e->type) { case VEH_ROAD: case VEH_TRAIN: { @@ -54,7 +54,7 @@ int32 AIEventEnginePreview::GetCapacity() int32 AIEventEnginePreview::GetMaxSpeed() { - const Engine *e = ::GetEngine(engine); + const Engine *e = ::Engine::Get(engine); int32 max_speed = e->GetDisplayMaxSpeed(); // km-ish/h if (e->type == VEH_AIRCRAFT) max_speed /= _settings_game.vehicle.plane_speed; return max_speed; @@ -62,17 +62,17 @@ int32 AIEventEnginePreview::GetMaxSpeed() Money AIEventEnginePreview::GetPrice() { - return ::GetEngine(engine)->GetCost(); + return ::Engine::Get(engine)->GetCost(); } Money AIEventEnginePreview::GetRunningCost() { - return ::GetEngine(engine)->GetRunningCost(); + return ::Engine::Get(engine)->GetRunningCost(); } int32 AIEventEnginePreview::GetVehicleType() { - switch (::GetEngine(engine)->type) { + switch (::Engine::Get(engine)->type) { case VEH_ROAD: return AIVehicle::VT_ROAD; case VEH_TRAIN: return AIVehicle::VT_RAIL; case VEH_SHIP: return AIVehicle::VT_WATER; diff --git a/src/ai/api/ai_group.cpp b/src/ai/api/ai_group.cpp index 71df52a43..165b1028e 100644 --- a/src/ai/api/ai_group.cpp +++ b/src/ai/api/ai_group.cpp @@ -16,7 +16,7 @@ /* static */ bool AIGroup::IsValidGroup(GroupID group_id) { - return ::IsValidGroupID(group_id) && ::GetGroup(group_id)->owner == _current_company; + return ::IsValidGroupID(group_id) && ::Group::Get(group_id)->owner == _current_company; } /* static */ AIGroup::GroupID AIGroup::CreateGroup(AIVehicle::VehicleType vehicle_type) @@ -38,7 +38,7 @@ { if (!IsValidGroup(group_id)) return AIVehicle::VT_INVALID; - return (AIVehicle::VehicleType)((::VehicleType)::GetGroup(group_id)->vehicle_type); + return (AIVehicle::VehicleType)((::VehicleType)::Group::Get(group_id)->vehicle_type); } /* static */ bool AIGroup::SetName(GroupID group_id, const char *name) @@ -73,7 +73,7 @@ { if (!IsValidGroup(group_id)) return false; - return ::GetGroup(group_id)->replace_protection; + return ::Group::Get(group_id)->replace_protection; } /* static */ int32 AIGroup::GetNumEngines(GroupID group_id, EngineID engine_id) @@ -100,7 +100,7 @@ /* static */ bool AIGroup::HasWagonRemoval() { - return ::GetCompany(_current_company)->settings.renew_keep_length; + return ::Company::Get(_current_company)->settings.renew_keep_length; } /* static */ bool AIGroup::SetAutoReplace(GroupID group_id, EngineID engine_id_old, EngineID engine_id_new) @@ -115,7 +115,7 @@ { if (!IsValidGroup(group_id) && group_id != GROUP_ALL) return ::INVALID_ENGINE; - return ::EngineReplacementForCompany(GetCompany(_current_company), engine_id, group_id); + return ::EngineReplacementForCompany(Company::Get(_current_company), engine_id, group_id); } /* static */ bool AIGroup::StopAutoReplace(GroupID group_id, EngineID engine_id) diff --git a/src/ai/api/ai_industry.cpp b/src/ai/api/ai_industry.cpp index 7c0753502..3a1acb213 100644 --- a/src/ai/api/ai_industry.cpp +++ b/src/ai/api/ai_industry.cpp @@ -38,7 +38,7 @@ if (!IsValidIndustry(industry_id)) return false; if (!AICargo::IsValidCargo(cargo_id)) return false; - const Industry *i = ::GetIndustry(industry_id); + const Industry *i = ::Industry::Get(industry_id); for (byte j = 0; j < lengthof(i->accepts_cargo); j++) { if (i->accepts_cargo[j] == cargo_id) return true; @@ -52,7 +52,7 @@ if (!IsValidIndustry(industry_id)) return -1; if (!AICargo::IsValidCargo(cargo_id)) return -1; - Industry *ind = ::GetIndustry(industry_id); + Industry *ind = ::Industry::Get(industry_id); for (uint i = 0; i < lengthof(ind->accepts_cargo); i++) { CargoID cid = ind->accepts_cargo[i]; if (cid == cargo_id) { @@ -68,7 +68,7 @@ if (!IsValidIndustry(industry_id)) return -1; if (!AICargo::IsValidCargo(cargo_id)) return -1; - const Industry *i = ::GetIndustry(industry_id); + 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 i->last_month_production[j]; @@ -82,7 +82,7 @@ if (!IsValidIndustry(industry_id)) return -1; if (!AICargo::IsValidCargo(cargo_id)) return -1; - const Industry *i = ::GetIndustry(industry_id); + 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 i->last_month_transported[j]; @@ -95,14 +95,14 @@ { if (!IsValidIndustry(industry_id)) return INVALID_TILE; - return ::GetIndustry(industry_id)->xy; + return ::Industry::Get(industry_id)->xy; } /* static */ int32 AIIndustry::GetAmountOfStationsAround(IndustryID industry_id) { if (!IsValidIndustry(industry_id)) return -1; - Industry *ind = ::GetIndustry(industry_id); + Industry *ind = ::Industry::Get(industry_id); StationList stations; ::FindStationsAroundTiles(ind->xy, ind->width, ind->height, &stations); return (int32)stations.Length(); @@ -126,14 +126,14 @@ { if (!IsValidIndustry(industry_id)) return false; - return (::GetIndustrySpec(::GetIndustry(industry_id)->type)->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0; + return (::GetIndustrySpec(::Industry::Get(industry_id)->type)->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0; } /* static */ bool AIIndustry::HasHeliport(IndustryID industry_id) { if (!IsValidIndustry(industry_id)) return false; - return (::GetIndustrySpec(::GetIndustry(industry_id)->type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0; + return (::GetIndustrySpec(::Industry::Get(industry_id)->type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0; } /* static */ TileIndex AIIndustry::GetHeliportLocation(IndustryID industry_id) @@ -141,7 +141,7 @@ if (!IsValidIndustry(industry_id)) return INVALID_TILE; if (!HasHeliport(industry_id)) return INVALID_TILE; - const Industry *ind = ::GetIndustry(industry_id); + const Industry *ind = ::Industry::Get(industry_id); BEGIN_TILE_LOOP(tile_cur, ind->width, ind->height, ind->xy); if (IsTileType(tile_cur, MP_STATION) && IsOilRig(tile_cur)) { return tile_cur; @@ -155,7 +155,7 @@ { if (!IsValidIndustry(industry_id)) return false; - return (::GetIndustrySpec(::GetIndustry(industry_id)->type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0; + return (::GetIndustrySpec(::Industry::Get(industry_id)->type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0; } /* static */ TileIndex AIIndustry::GetDockLocation(IndustryID industry_id) @@ -163,7 +163,7 @@ if (!IsValidIndustry(industry_id)) return INVALID_TILE; if (!HasDock(industry_id)) return INVALID_TILE; - const Industry *ind = ::GetIndustry(industry_id); + const Industry *ind = ::Industry::Get(industry_id); BEGIN_TILE_LOOP(tile_cur, ind->width, ind->height, ind->xy); if (IsTileType(tile_cur, MP_STATION) && IsOilRig(tile_cur)) { return tile_cur; @@ -177,5 +177,5 @@ { if (!IsValidIndustry(industry_id)) return INVALID_INDUSTRYTYPE; - return ::GetIndustry(industry_id)->type; + return ::Industry::Get(industry_id)->type; } diff --git a/src/ai/api/ai_order.cpp b/src/ai/api/ai_order.cpp index cdff05c06..22b86f683 100644 --- a/src/ai/api/ai_order.cpp +++ b/src/ai/api/ai_order.cpp @@ -43,7 +43,7 @@ static OrderType GetOrderTypeByTile(TileIndex t) /* static */ bool AIOrder::IsValidVehicleOrder(VehicleID vehicle_id, OrderPosition order_position) { - return AIVehicle::IsValidVehicle(vehicle_id) && order_position >= 0 && (order_position < ::GetVehicle(vehicle_id)->GetNumOrders() || order_position == ORDER_CURRENT); + return AIVehicle::IsValidVehicle(vehicle_id) && order_position >= 0 && (order_position < ::Vehicle::Get(vehicle_id)->GetNumOrders() || order_position == ORDER_CURRENT); } /** @@ -53,7 +53,7 @@ static OrderType GetOrderTypeByTile(TileIndex t) */ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition order_position) { - const Vehicle *v = ::GetVehicle(vehicle_id); + const Vehicle *v = ::Vehicle::Get(vehicle_id); if (order_position == AIOrder::ORDER_CURRENT) { const Order *order = &v->current_order; if (order->GetType() == OT_GOTO_DEPOT && !(order->GetDepotOrderType() & ODTFB_PART_OF_ORDERS)) return order; @@ -92,7 +92,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or if (order_position == ORDER_CURRENT) return false; if (!IsValidVehicleOrder(vehicle_id, order_position)) return false; - const Order *order = ::GetVehicleOrder(GetVehicle(vehicle_id), order_position); + const Order *order = ::GetVehicleOrder(Vehicle::Get(vehicle_id), order_position); return order->GetType() == OT_CONDITIONAL; } @@ -101,7 +101,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or if (AIVehicle::IsValidVehicle(vehicle_id)) return false; if (GetOrderCount(vehicle_id) == 0) return false; - const Order *order = &::GetVehicle(vehicle_id)->current_order; + const Order *order = &::Vehicle::Get(vehicle_id)->current_order; if (order->GetType() != OT_GOTO_DEPOT) return true; return (order->GetDepotOrderType() & ODTFB_PART_OF_ORDERS) != 0; } @@ -110,8 +110,8 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or { if (!AIVehicle::IsValidVehicle(vehicle_id)) return ORDER_INVALID; - if (order_position == ORDER_CURRENT) return (AIOrder::OrderPosition)::GetVehicle(vehicle_id)->cur_order_index; - return (order_position >= 0 && order_position < ::GetVehicle(vehicle_id)->GetNumOrders()) ? order_position : ORDER_INVALID; + if (order_position == ORDER_CURRENT) return (AIOrder::OrderPosition)::Vehicle::Get(vehicle_id)->cur_order_index; + return (order_position >= 0 && order_position < ::Vehicle::Get(vehicle_id)->GetNumOrders()) ? order_position : ORDER_INVALID; } @@ -158,7 +158,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or /* static */ int32 AIOrder::GetOrderCount(VehicleID vehicle_id) { - return AIVehicle::IsValidVehicle(vehicle_id) ? ::GetVehicle(vehicle_id)->GetNumOrders() : -1; + return AIVehicle::IsValidVehicle(vehicle_id) ? ::Vehicle::Get(vehicle_id)->GetNumOrders() : -1; } /* static */ TileIndex AIOrder::GetOrderDestination(VehicleID vehicle_id, OrderPosition order_position) @@ -167,20 +167,20 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or const Order *order = ::ResolveOrder(vehicle_id, order_position); if (order == NULL || order->GetType() == OT_CONDITIONAL) return INVALID_TILE; - const Vehicle *v = ::GetVehicle(vehicle_id); + const Vehicle *v = ::Vehicle::Get(vehicle_id); switch (order->GetType()) { case OT_GOTO_DEPOT: { - if (v->type != VEH_AIRCRAFT) return ::GetDepot(order->GetDestination())->xy; + if (v->type != VEH_AIRCRAFT) return ::Depot::Get(order->GetDestination())->xy; /* Aircraft's hangars are referenced by StationID, not DepotID */ - const Station *st = ::GetStation(order->GetDestination()); + const Station *st = ::Station::Get(order->GetDestination()); const AirportFTAClass *airport = st->Airport(); if (airport == NULL || airport->nof_depots == 0) return INVALID_TILE; return st->airport_tile + ::ToTileIndexDiff(st->Airport()->airport_depots[0]); } case OT_GOTO_STATION: { - const Station *st = ::GetStation(order->GetDestination()); + const Station *st = ::Station::Get(order->GetDestination()); if (st->train_tile != INVALID_TILE) { for (uint i = 0; i < st->trainst_w; i++) { TileIndex t = st->train_tile + TileDiffXY(i, 0); @@ -200,7 +200,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or } return INVALID_TILE; } - case OT_GOTO_WAYPOINT: return ::GetWaypoint(order->GetDestination())->xy; + case OT_GOTO_WAYPOINT: return ::Waypoint::Get(order->GetDestination())->xy; default: return INVALID_TILE; } } @@ -236,7 +236,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or if (!IsValidVehicleOrder(vehicle_id, order_position)) return ORDER_INVALID; if (order_position == ORDER_CURRENT || !IsConditionalOrder(vehicle_id, order_position)) return ORDER_INVALID; - const Order *order = ::GetVehicleOrder(GetVehicle(vehicle_id), order_position); + const Order *order = ::GetVehicleOrder(Vehicle::Get(vehicle_id), order_position); return (OrderPosition)order->GetConditionSkipToOrder(); } @@ -245,7 +245,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or if (!IsValidVehicleOrder(vehicle_id, order_position)) return OC_INVALID; if (order_position == ORDER_CURRENT || !IsConditionalOrder(vehicle_id, order_position)) return OC_INVALID; - const Order *order = ::GetVehicleOrder(GetVehicle(vehicle_id), order_position); + const Order *order = ::GetVehicleOrder(Vehicle::Get(vehicle_id), order_position); return (OrderCondition)order->GetConditionVariable(); } @@ -254,7 +254,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or if (!IsValidVehicleOrder(vehicle_id, order_position)) return CF_INVALID; if (order_position == ORDER_CURRENT || !IsConditionalOrder(vehicle_id, order_position)) return CF_INVALID; - const Order *order = ::GetVehicleOrder(GetVehicle(vehicle_id), order_position); + const Order *order = ::GetVehicleOrder(Vehicle::Get(vehicle_id), order_position); return (CompareFunction)order->GetConditionComparator(); } @@ -263,7 +263,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or if (!IsValidVehicleOrder(vehicle_id, order_position)) return -1; if (order_position == ORDER_CURRENT || !IsConditionalOrder(vehicle_id, order_position)) return -1; - const Order *order = ::GetVehicleOrder(GetVehicle(vehicle_id), order_position); + const Order *order = ::GetVehicleOrder(Vehicle::Get(vehicle_id), order_position); int32 value = order->GetConditionValue(); if (order->GetConditionVariable() == OCV_MAX_SPEED) value = value * 16 / 10; return value; @@ -311,7 +311,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or EnforcePrecondition(false, AIVehicle::IsValidVehicle(vehicle_id)); EnforcePrecondition(false, AreOrderFlagsValid(destination, order_flags)); - return InsertOrder(vehicle_id, (AIOrder::OrderPosition)::GetVehicle(vehicle_id)->GetNumOrders(), destination, order_flags); + return InsertOrder(vehicle_id, (AIOrder::OrderPosition)::Vehicle::Get(vehicle_id)->GetNumOrders(), destination, order_flags); } /* static */ bool AIOrder::AppendConditionalOrder(VehicleID vehicle_id, OrderPosition jump_to) @@ -319,7 +319,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or EnforcePrecondition(false, AIVehicle::IsValidVehicle(vehicle_id)); EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, jump_to)); - return InsertConditionalOrder(vehicle_id, (AIOrder::OrderPosition)::GetVehicle(vehicle_id)->GetNumOrders(), jump_to); + return InsertConditionalOrder(vehicle_id, (AIOrder::OrderPosition)::Vehicle::Get(vehicle_id)->GetNumOrders(), jump_to); } /* static */ bool AIOrder::InsertOrder(VehicleID vehicle_id, OrderPosition order_position, TileIndex destination, AIOrder::AIOrderFlags order_flags) @@ -328,7 +328,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or if (order_position == ORDER_CURRENT) order_position = AIOrder::ResolveOrderPosition(vehicle_id, order_position); EnforcePrecondition(false, AIVehicle::IsValidVehicle(vehicle_id)); - EnforcePrecondition(false, order_position >= 0 && order_position <= ::GetVehicle(vehicle_id)->GetNumOrders()); + EnforcePrecondition(false, order_position >= 0 && order_position <= ::Vehicle::Get(vehicle_id)->GetNumOrders()); EnforcePrecondition(false, AreOrderFlagsValid(destination, order_flags)); Order order; @@ -339,7 +339,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or OrderNonStopFlags onsf = (OrderNonStopFlags)((order_flags & AIOF_NON_STOP_INTERMEDIATE) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE); /* Check explicitly if the order is to a station (for aircraft) or * to a depot (other vehicle types). */ - if (::GetVehicle(vehicle_id)->type == VEH_AIRCRAFT) { + if (::Vehicle::Get(vehicle_id)->type == VEH_AIRCRAFT) { if (!::IsTileType(destination, MP_STATION)) return false; order.MakeGoToDepot(::GetStationIndex(destination), odtf, onsf, odaf); } else { @@ -432,7 +432,7 @@ static void _DoCommandReturnSetOrderFlags(class AIInstance *instance) EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, order_position)); EnforcePrecondition(false, AreOrderFlagsValid(GetOrderDestination(vehicle_id, order_position), order_flags)); - const Order *order = ::GetVehicleOrder(GetVehicle(vehicle_id), order_position); + const Order *order = ::GetVehicleOrder(Vehicle::Get(vehicle_id), order_position); AIOrderFlags current = GetOrderFlags(vehicle_id, order_position); diff --git a/src/ai/api/ai_sign.cpp b/src/ai/api/ai_sign.cpp index 3f397a4f0..72e34d333 100644 --- a/src/ai/api/ai_sign.cpp +++ b/src/ai/api/ai_sign.cpp @@ -20,7 +20,7 @@ /* static */ bool AISign::IsValidSign(SignID sign_id) { - return ::IsValidSignID(sign_id) && ::GetSign(sign_id)->owner == _current_company; + return ::IsValidSignID(sign_id) && ::Sign::Get(sign_id)->owner == _current_company; } /* static */ bool AISign::SetName(SignID sign_id, const char *name) @@ -49,7 +49,7 @@ { if (!IsValidSign(sign_id)) return INVALID_TILE; - const Sign *sign = ::GetSign(sign_id); + const Sign *sign = ::Sign::Get(sign_id); return ::TileVirtXY(sign->x, sign->y); } diff --git a/src/ai/api/ai_station.cpp b/src/ai/api/ai_station.cpp index 364b09538..7a9f5cb8d 100644 --- a/src/ai/api/ai_station.cpp +++ b/src/ai/api/ai_station.cpp @@ -17,7 +17,7 @@ /* static */ bool AIStation::IsValidStation(StationID station_id) { - return ::IsValidStationID(station_id) && ::GetStation(station_id)->owner == _current_company; + return ::IsValidStationID(station_id) && ::Station::Get(station_id)->owner == _current_company; } /* static */ StationID AIStation::GetStationID(TileIndex tile) @@ -33,7 +33,7 @@ static const int len = 64; char *station_name = MallocT<char>(len); - ::SetDParam(0, GetStation(station_id)->index); + ::SetDParam(0, Station::Get(station_id)->index); ::GetString(station_name, STR_STATION, &station_name[len - 1]); return station_name; } @@ -51,7 +51,7 @@ { if (!IsValidStation(station_id)) return INVALID_TILE; - return ::GetStation(station_id)->xy; + return ::Station::Get(station_id)->xy; } /* static */ int32 AIStation::GetCargoWaiting(StationID station_id, CargoID cargo_id) @@ -59,7 +59,7 @@ if (!IsValidStation(station_id)) return -1; if (!AICargo::IsValidCargo(cargo_id)) return -1; - return ::GetStation(station_id)->goods[cargo_id].cargo.Count(); + return ::Station::Get(station_id)->goods[cargo_id].cargo.Count(); } /* static */ int32 AIStation::GetCargoRating(StationID station_id, CargoID cargo_id) @@ -67,7 +67,7 @@ if (!IsValidStation(station_id)) return -1; if (!AICargo::IsValidCargo(cargo_id)) return -1; - return ::GetStation(station_id)->goods[cargo_id].rating * 101 >> 8; + return ::Station::Get(station_id)->goods[cargo_id].rating * 101 >> 8; } /* static */ int32 AIStation::GetCoverageRadius(AIStation::StationType station_type) @@ -114,7 +114,7 @@ if (!IsValidStation(station_id)) return false; if (CountBits(station_type) != 1) return false; - return (::GetStation(station_id)->facilities & station_type) != 0; + return (::Station::Get(station_id)->facilities & station_type) != 0; } /* static */ bool AIStation::HasRoadType(StationID station_id, AIRoad::RoadType road_type) @@ -124,10 +124,10 @@ ::RoadTypes r = RoadTypeToRoadTypes((::RoadType)road_type); - for (const RoadStop *rs = ::GetStation(station_id)->GetPrimaryRoadStop(ROADSTOP_BUS); rs != NULL; rs = rs->next) { + for (const RoadStop *rs = ::Station::Get(station_id)->GetPrimaryRoadStop(ROADSTOP_BUS); rs != NULL; rs = rs->next) { if ((::GetRoadTypes(rs->xy) & r) != 0) return true; } - for (const RoadStop *rs = ::GetStation(station_id)->GetPrimaryRoadStop(ROADSTOP_TRUCK); rs != NULL; rs = rs->next) { + for (const RoadStop *rs = ::Station::Get(station_id)->GetPrimaryRoadStop(ROADSTOP_TRUCK); rs != NULL; rs = rs->next) { if ((::GetRoadTypes(rs->xy) & r) != 0) return true; } @@ -138,5 +138,5 @@ { if (!IsValidStation(station_id)) return INVALID_TOWN; - return ::GetStation(station_id)->town->index; + return ::Station::Get(station_id)->town->index; } diff --git a/src/ai/api/ai_stationlist.cpp b/src/ai/api/ai_stationlist.cpp index f392513e7..5e7e82f52 100644 --- a/src/ai/api/ai_stationlist.cpp +++ b/src/ai/api/ai_stationlist.cpp @@ -20,7 +20,7 @@ AIStationList_Vehicle::AIStationList_Vehicle(VehicleID vehicle_id) { if (!AIVehicle::IsValidVehicle(vehicle_id)) return; - Vehicle *v = ::GetVehicle(vehicle_id); + Vehicle *v = ::Vehicle::Get(vehicle_id); for (Order *o = v->GetFirstOrder(); o != NULL; o = o->next) { if (o->IsType(OT_GOTO_STATION)) this->AddItem(o->GetDestination()); diff --git a/src/ai/api/ai_subsidy.cpp b/src/ai/api/ai_subsidy.cpp index d4a8b7e0f..4ffdbac2a 100644 --- a/src/ai/api/ai_subsidy.cpp +++ b/src/ai/api/ai_subsidy.cpp @@ -24,7 +24,7 @@ { if (!IsAwarded(subsidy_id)) return AICompany::COMPANY_INVALID; - return (AICompany::CompanyID)((byte)GetStation(_subsidies[subsidy_id].from)->owner); + return (AICompany::CompanyID)((byte)Station::Get(_subsidies[subsidy_id].from)->owner); } /* static */ int32 AISubsidy::GetExpireDate(SubsidyID subsidy_id) diff --git a/src/ai/api/ai_tilelist.cpp b/src/ai/api/ai_tilelist.cpp index d2fa8c468..31ea81861 100644 --- a/src/ai/api/ai_tilelist.cpp +++ b/src/ai/api/ai_tilelist.cpp @@ -72,7 +72,7 @@ AITileList_IndustryAccepting::AITileList_IndustryAccepting(IndustryID industry_i { if (!AIIndustry::IsValidIndustry(industry_id)) return; - const Industry *i = ::GetIndustry(industry_id); + const Industry *i = ::Industry::Get(industry_id); /* Check if this industry accepts anything */ { @@ -110,7 +110,7 @@ AITileList_IndustryProducing::AITileList_IndustryProducing(IndustryID industry_i { if (!AIIndustry::IsValidIndustry(industry_id)) return; - const Industry *i = ::GetIndustry(industry_id); + const Industry *i = ::Industry::Get(industry_id); /* Check if this industry produces anything */ { @@ -148,7 +148,7 @@ AITileList_StationType::AITileList_StationType(StationID station_id, AIStation:: { if (!AIStation::IsValidStation(station_id)) return; - const StationRect *rect = &::GetStation(station_id)->rect; + const StationRect *rect = &::Station::Get(station_id)->rect; uint station_type_value = 0; /* Convert AIStation::StationType to ::StationType, but do it in a 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); } diff --git a/src/ai/api/ai_vehicle.cpp b/src/ai/api/ai_vehicle.cpp index 130ebe05e..b61519915 100644 --- a/src/ai/api/ai_vehicle.cpp +++ b/src/ai/api/ai_vehicle.cpp @@ -20,7 +20,7 @@ /* static */ bool AIVehicle::IsValidVehicle(VehicleID vehicle_id) { if (!::IsValidVehicleID(vehicle_id)) return false; - const Vehicle *v = ::GetVehicle(vehicle_id); + const Vehicle *v = ::Vehicle::Get(vehicle_id); return v->owner == _current_company && (v->IsPrimaryVehicle() || (v->type == VEH_TRAIN && ::IsFreeWagon(v))); } @@ -29,8 +29,8 @@ if (!IsValidVehicle(vehicle_id)) return -1; int num = 1; - if (::GetVehicle(vehicle_id)->type == VEH_TRAIN) { - const Vehicle *v = ::GetVehicle(vehicle_id); + if (::Vehicle::Get(vehicle_id)->type == VEH_TRAIN) { + const Vehicle *v = ::Vehicle::Get(vehicle_id); while ((v = GetNextUnit(v)) != NULL) num++; } @@ -41,7 +41,7 @@ { if (!IsValidVehicle(vehicle_id)) return -1; - const Vehicle *v = ::GetVehicle(vehicle_id); + const Vehicle *v = ::Vehicle::Get(vehicle_id); switch (v->type) { case VEH_ROAD: { uint total_length = 0; @@ -59,7 +59,7 @@ { EnforcePrecondition(INVALID_VEHICLE, AIEngine::IsValidEngine(engine_id)); - ::VehicleType type = ::GetEngine(engine_id)->type; + ::VehicleType type = ::Engine::Get(engine_id)->type; EnforcePreconditionCustomError(INVALID_VEHICLE, !AIGameSettings::IsDisabledVehicleType((AIVehicle::VehicleType)type), AIVehicle::ERR_VEHICLE_BUILD_DISABLED); @@ -83,14 +83,14 @@ { EnforcePrecondition(false, IsValidVehicle(source_vehicle_id) && source_wagon < GetNumWagons(source_vehicle_id)); EnforcePrecondition(false, dest_vehicle_id == -1 || (IsValidVehicle(dest_vehicle_id) && dest_wagon < GetNumWagons(dest_vehicle_id))); - EnforcePrecondition(false, ::GetVehicle(source_vehicle_id)->type == VEH_TRAIN); - EnforcePrecondition(false, dest_vehicle_id == -1 || ::GetVehicle(dest_vehicle_id)->type == VEH_TRAIN); + EnforcePrecondition(false, ::Vehicle::Get(source_vehicle_id)->type == VEH_TRAIN); + EnforcePrecondition(false, dest_vehicle_id == -1 || ::Vehicle::Get(dest_vehicle_id)->type == VEH_TRAIN); - const Vehicle *v = ::GetVehicle(source_vehicle_id); + const Vehicle *v = ::Vehicle::Get(source_vehicle_id); while (source_wagon-- > 0) v = GetNextUnit(v); const Vehicle *w = NULL; if (dest_vehicle_id != -1) { - w = ::GetVehicle(dest_vehicle_id); + w = ::Vehicle::Get(dest_vehicle_id); while (dest_wagon-- > 0) w = GetNextUnit(w); } @@ -112,7 +112,7 @@ if (!IsValidVehicle(vehicle_id)) return -1; if (!AICargo::IsValidCargo(cargo)) return -1; - CommandCost res = ::DoCommand(0, vehicle_id, cargo, DC_QUERY_COST, GetCmdRefitVeh(::GetVehicle(vehicle_id))); + CommandCost res = ::DoCommand(0, vehicle_id, cargo, DC_QUERY_COST, GetCmdRefitVeh(::Vehicle::Get(vehicle_id))); return CmdSucceeded(res) ? _returned_refit_capacity : -1; } @@ -120,7 +120,7 @@ { EnforcePrecondition(false, IsValidVehicle(vehicle_id) && AICargo::IsValidCargo(cargo)); - return AIObject::DoCommand(0, vehicle_id, cargo, GetCmdRefitVeh(::GetVehicle(vehicle_id))); + return AIObject::DoCommand(0, vehicle_id, cargo, GetCmdRefitVeh(::Vehicle::Get(vehicle_id))); } @@ -128,16 +128,16 @@ { EnforcePrecondition(false, IsValidVehicle(vehicle_id)); - const Vehicle *v = ::GetVehicle(vehicle_id); + const Vehicle *v = ::Vehicle::Get(vehicle_id); return AIObject::DoCommand(0, vehicle_id, v->type == VEH_TRAIN ? 1 : 0, GetCmdSellVeh(v)); } /* static */ bool AIVehicle::_SellWagonInternal(VehicleID vehicle_id, int wagon, bool sell_attached_wagons) { EnforcePrecondition(false, IsValidVehicle(vehicle_id) && wagon < GetNumWagons(vehicle_id)); - EnforcePrecondition(false, ::GetVehicle(vehicle_id)->type == VEH_TRAIN); + EnforcePrecondition(false, ::Vehicle::Get(vehicle_id)->type == VEH_TRAIN); - const Vehicle *v = ::GetVehicle(vehicle_id); + const Vehicle *v = ::Vehicle::Get(vehicle_id); while (wagon-- > 0) v = GetNextUnit(v); return AIObject::DoCommand(0, v->index, sell_attached_wagons ? 1 : 0, CMD_SELL_RAIL_WAGON); @@ -157,26 +157,26 @@ { EnforcePrecondition(false, IsValidVehicle(vehicle_id)); - return AIObject::DoCommand(0, vehicle_id, 0, GetCmdSendToDepot(::GetVehicle(vehicle_id))); + return AIObject::DoCommand(0, vehicle_id, 0, GetCmdSendToDepot(::Vehicle::Get(vehicle_id))); } /* static */ bool AIVehicle::SendVehicleToDepotForServicing(VehicleID vehicle_id) { EnforcePrecondition(false, IsValidVehicle(vehicle_id)); - return AIObject::DoCommand(0, vehicle_id, DEPOT_SERVICE, GetCmdSendToDepot(::GetVehicle(vehicle_id))); + return AIObject::DoCommand(0, vehicle_id, DEPOT_SERVICE, GetCmdSendToDepot(::Vehicle::Get(vehicle_id))); } /* static */ bool AIVehicle::IsInDepot(VehicleID vehicle_id) { if (!IsValidVehicle(vehicle_id)) return false; - return ::GetVehicle(vehicle_id)->IsInDepot(); + return ::Vehicle::Get(vehicle_id)->IsInDepot(); } /* static */ bool AIVehicle::IsStoppedInDepot(VehicleID vehicle_id) { if (!IsValidVehicle(vehicle_id)) return false; - return ::GetVehicle(vehicle_id)->IsStoppedInDepot(); + return ::Vehicle::Get(vehicle_id)->IsStoppedInDepot(); } /* static */ bool AIVehicle::StartStopVehicle(VehicleID vehicle_id) @@ -198,9 +198,9 @@ /* static */ bool AIVehicle::ReverseVehicle(VehicleID vehicle_id) { EnforcePrecondition(false, IsValidVehicle(vehicle_id)); - EnforcePrecondition(false, ::GetVehicle(vehicle_id)->type == VEH_ROAD || ::GetVehicle(vehicle_id)->type == VEH_TRAIN); + EnforcePrecondition(false, ::Vehicle::Get(vehicle_id)->type == VEH_ROAD || ::Vehicle::Get(vehicle_id)->type == VEH_TRAIN); - switch (::GetVehicle(vehicle_id)->type) { + switch (::Vehicle::Get(vehicle_id)->type) { case VEH_ROAD: return AIObject::DoCommand(0, vehicle_id, 0, CMD_TURN_ROADVEH); case VEH_TRAIN: return AIObject::DoCommand(0, vehicle_id, 0, CMD_REVERSE_TRAIN_DIRECTION); default: NOT_REACHED(); @@ -220,7 +220,7 @@ { if (!IsValidVehicle(vehicle_id)) return INVALID_TILE; - const Vehicle *v = ::GetVehicle(vehicle_id); + const Vehicle *v = ::Vehicle::Get(vehicle_id); if (v->type == VEH_AIRCRAFT) { uint x = Clamp(v->x_pos / TILE_SIZE, 0, ::MapSizeX() - 2); uint y = Clamp(v->y_pos / TILE_SIZE, 0, ::MapSizeY() - 2); @@ -234,7 +234,7 @@ { if (!IsValidVehicle(vehicle_id)) return INVALID_ENGINE; - return ::GetVehicle(vehicle_id)->engine_type; + return ::Vehicle::Get(vehicle_id)->engine_type; } /* static */ EngineID AIVehicle::GetWagonEngineType(VehicleID vehicle_id, int wagon) @@ -242,7 +242,7 @@ if (!IsValidVehicle(vehicle_id)) return INVALID_ENGINE; if (wagon >= GetNumWagons(vehicle_id)) return INVALID_ENGINE; - const Vehicle *v = ::GetVehicle(vehicle_id); + const Vehicle *v = ::Vehicle::Get(vehicle_id); if (v->type == VEH_TRAIN) { while (wagon-- > 0) v = GetNextUnit(v); } @@ -253,7 +253,7 @@ { if (!IsValidVehicle(vehicle_id)) return -1; - return ::GetVehicle(vehicle_id)->unitnumber; + return ::Vehicle::Get(vehicle_id)->unitnumber; } /* static */ char *AIVehicle::GetName(VehicleID vehicle_id) @@ -272,7 +272,7 @@ { if (!IsValidVehicle(vehicle_id)) return -1; - return ::GetVehicle(vehicle_id)->age; + return ::Vehicle::Get(vehicle_id)->age; } /* static */ int32 AIVehicle::GetWagonAge(VehicleID vehicle_id, int wagon) @@ -280,7 +280,7 @@ if (!IsValidVehicle(vehicle_id)) return -1; if (wagon >= GetNumWagons(vehicle_id)) return -1; - const Vehicle *v = ::GetVehicle(vehicle_id); + const Vehicle *v = ::Vehicle::Get(vehicle_id); if (v->type == VEH_TRAIN) { while (wagon-- > 0) v = GetNextUnit(v); } @@ -291,28 +291,28 @@ { if (!IsValidVehicle(vehicle_id)) return -1; - return ::GetVehicle(vehicle_id)->max_age; + return ::Vehicle::Get(vehicle_id)->max_age; } /* static */ int32 AIVehicle::GetAgeLeft(VehicleID vehicle_id) { if (!IsValidVehicle(vehicle_id)) return -1; - return ::GetVehicle(vehicle_id)->max_age - ::GetVehicle(vehicle_id)->age; + return ::Vehicle::Get(vehicle_id)->max_age - ::Vehicle::Get(vehicle_id)->age; } /* static */ int32 AIVehicle::GetCurrentSpeed(VehicleID vehicle_id) { if (!IsValidVehicle(vehicle_id)) return -1; - return ::GetVehicle(vehicle_id)->GetDisplaySpeed(); // km-ish/h + return ::Vehicle::Get(vehicle_id)->GetDisplaySpeed(); // km-ish/h } /* static */ AIVehicle::VehicleState AIVehicle::GetState(VehicleID vehicle_id) { if (!IsValidVehicle(vehicle_id)) return AIVehicle::VS_INVALID; - const Vehicle *v = ::GetVehicle(vehicle_id); + const Vehicle *v = ::Vehicle::Get(vehicle_id); byte vehstatus = v->vehstatus; if (vehstatus & ::VS_CRASHED) return AIVehicle::VS_CRASHED; @@ -327,35 +327,35 @@ { if (!IsValidVehicle(vehicle_id)) return -1; - return ::GetVehicle(vehicle_id)->GetRunningCost() >> 8; + return ::Vehicle::Get(vehicle_id)->GetRunningCost() >> 8; } /* static */ Money AIVehicle::GetProfitThisYear(VehicleID vehicle_id) { if (!IsValidVehicle(vehicle_id)) return -1; - return ::GetVehicle(vehicle_id)->GetDisplayProfitThisYear(); + return ::Vehicle::Get(vehicle_id)->GetDisplayProfitThisYear(); } /* static */ Money AIVehicle::GetProfitLastYear(VehicleID vehicle_id) { if (!IsValidVehicle(vehicle_id)) return -1; - return ::GetVehicle(vehicle_id)->GetDisplayProfitLastYear(); + return ::Vehicle::Get(vehicle_id)->GetDisplayProfitLastYear(); } /* static */ Money AIVehicle::GetCurrentValue(VehicleID vehicle_id) { if (!IsValidVehicle(vehicle_id)) return -1; - return ::GetVehicle(vehicle_id)->value; + return ::Vehicle::Get(vehicle_id)->value; } /* static */ AIVehicle::VehicleType AIVehicle::GetVehicleType(VehicleID vehicle_id) { if (!IsValidVehicle(vehicle_id)) return VT_INVALID; - switch (::GetVehicle(vehicle_id)->type) { + switch (::Vehicle::Get(vehicle_id)->type) { case VEH_ROAD: return VT_ROAD; case VEH_TRAIN: return VT_RAIL; case VEH_SHIP: return VT_WATER; @@ -369,7 +369,7 @@ if (!IsValidVehicle(vehicle_id)) return AIRoad::ROADTYPE_INVALID; if (GetVehicleType(vehicle_id) != VT_ROAD) return AIRoad::ROADTYPE_INVALID; - return (AIRoad::RoadType)::GetVehicle(vehicle_id)->u.road.roadtype; + return (AIRoad::RoadType)::Vehicle::Get(vehicle_id)->u.road.roadtype; } /* static */ int32 AIVehicle::GetCapacity(VehicleID vehicle_id, CargoID cargo) @@ -378,7 +378,7 @@ if (!AICargo::IsValidCargo(cargo)) return -1; uint32 amount = 0; - for (const Vehicle *v = ::GetVehicle(vehicle_id); v != NULL; v = v->Next()) { + for (const Vehicle *v = ::Vehicle::Get(vehicle_id); v != NULL; v = v->Next()) { if (v->cargo_type == cargo) amount += v->cargo_cap; } @@ -391,7 +391,7 @@ if (!AICargo::IsValidCargo(cargo)) return -1; uint32 amount = 0; - for (const Vehicle *v = ::GetVehicle(vehicle_id); v != NULL; v = v->Next()) { + for (const Vehicle *v = ::Vehicle::Get(vehicle_id); v != NULL; v = v->Next()) { if (v->cargo_type == cargo) amount += v->cargo.Count(); } @@ -402,7 +402,7 @@ { if (!IsValidVehicle(vehicle_id)) return AIGroup::GROUP_INVALID; - return ::GetVehicle(vehicle_id)->group_id; + return ::Vehicle::Get(vehicle_id)->group_id; } /* static */ bool AIVehicle::IsArticulated(VehicleID vehicle_id) @@ -410,7 +410,7 @@ if (!IsValidVehicle(vehicle_id)) return false; if (GetVehicleType(vehicle_id) != VT_ROAD && GetVehicleType(vehicle_id) != VT_RAIL) return false; - const Vehicle *v = ::GetVehicle(vehicle_id); + const Vehicle *v = ::Vehicle::Get(vehicle_id); switch (v->type) { case VEH_ROAD: return RoadVehHasArticPart(v); case VEH_TRAIN: return EngineHasArticPart(v); @@ -422,6 +422,6 @@ { if (!IsValidVehicle(vehicle_id)) return false; - Vehicle *v = ::GetVehicle(vehicle_id); + Vehicle *v = ::Vehicle::Get(vehicle_id); return v->orders.list != NULL && v->orders.list->GetNumVehicles() > 1; } diff --git a/src/ai/api/ai_vehiclelist.cpp b/src/ai/api/ai_vehiclelist.cpp index c7daff5c5..52ca83dae 100644 --- a/src/ai/api/ai_vehiclelist.cpp +++ b/src/ai/api/ai_vehiclelist.cpp @@ -40,7 +40,7 @@ AIVehicleList_SharedOrders::AIVehicleList_SharedOrders(VehicleID vehicle_id) { if (!AIVehicle::IsValidVehicle(vehicle_id)) return; - for (const Vehicle *v = GetVehicle(vehicle_id)->FirstShared(); v != NULL; v = v->NextShared()) { + for (const Vehicle *v = Vehicle::Get(vehicle_id)->FirstShared(); v != NULL; v = v->NextShared()) { this->AddItem(v->index); } } diff --git a/src/ai/api/ai_waypoint.cpp b/src/ai/api/ai_waypoint.cpp index 3836978df..ec6af36eb 100644 --- a/src/ai/api/ai_waypoint.cpp +++ b/src/ai/api/ai_waypoint.cpp @@ -14,7 +14,7 @@ /* static */ bool AIWaypoint::IsValidWaypoint(WaypointID waypoint_id) { - return ::IsValidWaypointID(waypoint_id) && ::GetWaypoint(waypoint_id)->owner == _current_company; + return ::IsValidWaypointID(waypoint_id) && ::Waypoint::Get(waypoint_id)->owner == _current_company; } /* static */ WaypointID AIWaypoint::GetWaypointID(TileIndex tile) @@ -49,5 +49,5 @@ { if (!IsValidWaypoint(waypoint_id)) return INVALID_TILE; - return ::GetWaypoint(waypoint_id)->xy; + return ::Waypoint::Get(waypoint_id)->xy; } diff --git a/src/ai/api/ai_waypointlist.cpp b/src/ai/api/ai_waypointlist.cpp index 2b25157a4..c2d87e6b7 100644 --- a/src/ai/api/ai_waypointlist.cpp +++ b/src/ai/api/ai_waypointlist.cpp @@ -21,7 +21,7 @@ AIWaypointList_Vehicle::AIWaypointList_Vehicle(VehicleID vehicle_id) { if (!AIVehicle::IsValidVehicle(vehicle_id)) return; - const Vehicle *v = ::GetVehicle(vehicle_id); + const Vehicle *v = ::Vehicle::Get(vehicle_id); for (const Order *o = v->GetFirstOrder(); o != NULL; o = o->next) { if (o->IsType(OT_GOTO_WAYPOINT)) this->AddItem(o->GetDestination()); |