diff options
author | glx <glx@openttd.org> | 2009-01-25 00:57:03 +0000 |
---|---|---|
committer | glx <glx@openttd.org> | 2009-01-25 00:57:03 +0000 |
commit | c1cf3934fa5bd523dd1df01cf505c9f06927701d (patch) | |
tree | a8b3e55a2f1168021a45917b6fbf5777c3476634 /src/aircraft_cmd.cpp | |
parent | 80ee3d3440233b50bbe818b2f74f6aac8841edfa (diff) | |
download | openttd-c1cf3934fa5bd523dd1df01cf505c9f06927701d.tar.xz |
(svn r15263) -Codechange: added Engine::GetCost() to remove some code duplication.
Diffstat (limited to 'src/aircraft_cmd.cpp')
-rw-r--r-- | src/aircraft_cmd.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 2effe517a..cec144be4 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -223,12 +223,6 @@ void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height) height = spr->height; } -static CommandCost EstimateAircraftCost(EngineID engine, const AircraftVehicleInfo *avi) -{ - return CommandCost(EXPENSES_NEW_VEHICLES, GetEngineProperty(engine, 0x0B, avi->cost_factor) * (_price.aircraft_base >> 3) >> 5); -} - - /** * Calculates cargo capacity based on an aircraft's passenger * and mail capacities. @@ -266,7 +260,8 @@ CommandCost CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, if (!IsEngineBuildable(p1, VEH_AIRCRAFT, _current_company)) return_cmd_error(STR_AIRCRAFT_NOT_AVAILABLE); const AircraftVehicleInfo *avi = AircraftVehInfo(p1); - CommandCost value = EstimateAircraftCost(p1, avi); + const Engine *e = GetEngine(p1); + CommandCost value(EXPENSES_NEW_VEHICLES, e->GetCost()); /* to just query the cost, it is not neccessary to have a valid tile (automation/AI) */ if (flags & DC_QUERY_COST) return value; @@ -374,7 +369,6 @@ CommandCost CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, u->cargo_cap = 0; } - const Engine *e = GetEngine(p1); v->reliability = e->reliability; v->reliability_spd_dec = e->reliability_spd_dec; v->max_age = e->lifelength * DAYS_IN_LEAP_YEAR; |