diff options
author | peter1138 <peter1138@openttd.org> | 2006-06-09 06:34:28 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-06-09 06:34:28 +0000 |
commit | 1b48a2bd9d41bb1f52fec30aabd05c342e3f0b5b (patch) | |
tree | cec2376156d3bbcf58f1342e2749ec52302d80f7 | |
parent | 0372cceb2f4d97fa9d1cee6b9d766db618162ff0 (diff) | |
download | openttd-1b48a2bd9d41bb1f52fec30aabd05c342e3f0b5b.tar.xz |
(svn r5186) - NewGRF: show default aircraft cargo type and the purchase list (mart3p)
-rw-r--r-- | aircraft.h | 7 | ||||
-rw-r--r-- | aircraft_cmd.c | 2 | ||||
-rw-r--r-- | aircraft_gui.c | 17 |
3 files changed, 22 insertions, 4 deletions
diff --git a/aircraft.h b/aircraft.h index 55fc35c89..06e53797a 100644 --- a/aircraft.h +++ b/aircraft.h @@ -1,5 +1,8 @@ /* $Id$ */ +#ifndef AIRCRAFT_H +#define AIRCRAFT_H + #include "station_map.h" #include "vehicle.h" @@ -14,3 +17,7 @@ static inline bool IsAircraftInHangarStopped(const Vehicle* v) { return IsAircraftInHangar(v) && v->vehstatus & VS_STOPPED; } + +uint16 AircraftDefaultCargoCapacity(CargoID cid, EngineID engine_type); + +#endif /* AIRCRAFT_H */ diff --git a/aircraft_cmd.c b/aircraft_cmd.c index 1729dcdbe..9a3306c3d 100644 --- a/aircraft_cmd.c +++ b/aircraft_cmd.c @@ -164,7 +164,7 @@ static int32 EstimateAircraftCost(EngineID engine_type) * @param engine Which engine to find a cargo capacity for. * @return New cargo capacity value. */ -static uint16 AircraftDefaultCargoCapacity(CargoID cid, EngineID engine_type) +uint16 AircraftDefaultCargoCapacity(CargoID cid, EngineID engine_type) { const AircraftVehicleInfo *avi = AircraftVehInfo(engine_type); diff --git a/aircraft_gui.c b/aircraft_gui.c index 51695618f..a76acd34f 100644 --- a/aircraft_gui.c +++ b/aircraft_gui.c @@ -32,6 +32,7 @@ void DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number) { const AircraftVehicleInfo *avi = AircraftVehInfo(engine_number); const Engine* e = GetEngine(engine_number); + CargoID cargo; YearMonthDay ymd; ConvertDayToYMD(&ymd, e->intro_date); @@ -42,9 +43,19 @@ void DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number) y += 10; /* Cargo capacity */ - SetDParam(0, avi->passenger_capacity); - SetDParam(1, avi->mail_capacity); - DrawString(x, y, STR_PURCHASE_INFO_AIRCRAFT_CAPACITY, 0); + cargo = FindFirstRefittableCargo(engine_number); + if (cargo == CT_INVALID || cargo == CT_PASSENGERS) { + SetDParam(0, avi->passenger_capacity); + SetDParam(1, avi->mail_capacity); + DrawString(x, y, STR_PURCHASE_INFO_AIRCRAFT_CAPACITY, 0); + } else { + /* Note, if the default capacity is selected by the refit capacity + * callback, then the capacity shown is likely to be incorrect. */ + SetDParam(0, _cargoc.names_long[cargo]); + SetDParam(1, AircraftDefaultCargoCapacity(cargo, engine_number)); + SetDParam(2, STR_9842_REFITTABLE); + DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0); + } y += 10; /* Running cost */ |