summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-02-22 21:46:20 +0000
committerfrosch <frosch@openttd.org>2010-02-22 21:46:20 +0000
commit63b01f2009be96797bc3a08c6391516604e00e86 (patch)
treecaf3307a34205ae1043eb9d377336510b13cd400
parentfee0743ba99da6301ac6e9b0eda05b06e1c60a69 (diff)
downloadopenttd-63b01f2009be96797bc3a08c6391516604e00e86.tar.xz
(svn r19218) -Feature: [NewGRF] Add CB36 support for aircraft properties 0F and 11. (Eddi)
-rw-r--r--src/engine.cpp6
-rw-r--r--src/newgrf.cpp4
-rw-r--r--src/newgrf_properties.h2
-rw-r--r--src/vehicle.cpp12
4 files changed, 13 insertions, 11 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index f3d8133ec..8e6c41ba0 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -184,12 +184,12 @@ uint Engine::GetDisplayDefaultCapacity(uint16 *mail_capacity) const
return GetEngineProperty(this->index, PROP_SHIP_CARGO_CAPACITY, this->u.ship.capacity);
case VEH_AIRCRAFT: {
- uint capacity = this->u.air.passenger_capacity;
+ uint capacity = GetEngineProperty(this->index, PROP_AIRCRAFT_PASSENGER_CAPACITY, this->u.air.passenger_capacity);;
CargoID cargo = this->GetDefaultCargoType();
if (IsCargoInClass(cargo, CC_PASSENGERS)) {
- if (mail_capacity != NULL) *mail_capacity = this->u.air.mail_capacity;
+ if (mail_capacity != NULL) *mail_capacity = GetEngineProperty(this->index, PROP_AIRCRAFT_MAIL_CAPACITY, this->u.air.mail_capacity);
} else {
- capacity += this->u.air.mail_capacity;
+ capacity += GetEngineProperty(this->index, PROP_AIRCRAFT_MAIL_CAPACITY, this->u.air.mail_capacity);
}
switch (cargo) {
case CT_PASSENGERS:
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 786d33959..ba322df5c 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -1049,11 +1049,11 @@ static ChangeInfoResult AircraftVehicleChangeInfo(uint engine, int numinfo, int
avi->running_cost = buf->ReadByte();
break;
- case 0x0F: // Passenger capacity
+ case PROP_AIRCRAFT_PASSENGER_CAPACITY: // 0x0F Passenger capacity
avi->passenger_capacity = buf->ReadWord();
break;
- case 0x11: // Mail capacity
+ case PROP_AIRCRAFT_MAIL_CAPACITY: // 0x11 Mail capacity
avi->mail_capacity = buf->ReadByte();
break;
diff --git a/src/newgrf_properties.h b/src/newgrf_properties.h
index 758791caf..2f21352e0 100644
--- a/src/newgrf_properties.h
+++ b/src/newgrf_properties.h
@@ -39,6 +39,8 @@ enum PropertyID {
PROP_AIRCRAFT_COST_FACTOR = 0x0B, ///< Purchase cost
PROP_AIRCRAFT_SPEED = 0x0C, ///< Max. speed: 1 unit = 8 mph = 12.8 km-ish/h
PROP_AIRCRAFT_RUNNING_COST_FACTOR = 0x0E, ///< Yearly runningcost
+ PROP_AIRCRAFT_PASSENGER_CAPACITY = 0x0F, ///< Passenger Capacity
+ PROP_AIRCRAFT_MAIL_CAPACITY = 0x11, ///< Mail Capacity
};
#endif /* NEWGRF_PROPERTIES_H */
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 4cf0af4d9..f0a1d40da 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1468,7 +1468,7 @@ uint GetVehicleCapacity(const Vehicle *v, uint16 *mail_capacity)
if (!e->CanCarryCargo()) return 0;
if (mail_capacity != NULL && e->type == VEH_AIRCRAFT && IsCargoInClass(v->cargo_type, CC_PASSENGERS)) {
- *mail_capacity = e->u.air.mail_capacity;
+ *mail_capacity = GetVehicleProperty(v, PROP_AIRCRAFT_MAIL_CAPACITY, e->u.air.mail_capacity);
}
CargoID default_cargo = e->GetDefaultCargoType();
@@ -1483,10 +1483,10 @@ uint GetVehicleCapacity(const Vehicle *v, uint16 *mail_capacity)
/* Get capacity according to property resp. CB */
uint capacity;
switch (e->type) {
- case VEH_TRAIN: capacity = GetVehicleProperty(v, PROP_TRAIN_CARGO_CAPACITY, e->u.rail.capacity); break;
- case VEH_ROAD: capacity = GetVehicleProperty(v, PROP_ROADVEH_CARGO_CAPACITY, e->u.road.capacity); break;
- case VEH_SHIP: capacity = GetVehicleProperty(v, PROP_SHIP_CARGO_CAPACITY, e->u.ship.capacity); break;
- case VEH_AIRCRAFT: capacity = e->u.air.passenger_capacity; break;
+ case VEH_TRAIN: capacity = GetVehicleProperty(v, PROP_TRAIN_CARGO_CAPACITY, e->u.rail.capacity); break;
+ case VEH_ROAD: capacity = GetVehicleProperty(v, PROP_ROADVEH_CARGO_CAPACITY, e->u.road.capacity); break;
+ case VEH_SHIP: capacity = GetVehicleProperty(v, PROP_SHIP_CARGO_CAPACITY, e->u.ship.capacity); break;
+ case VEH_AIRCRAFT: capacity = GetVehicleProperty(v, PROP_AIRCRAFT_PASSENGER_CAPACITY, e->u.air.passenger_capacity); break;
default: NOT_REACHED();
}
@@ -1495,7 +1495,7 @@ uint GetVehicleCapacity(const Vehicle *v, uint16 *mail_capacity)
if (e->type != VEH_SHIP) {
if (e->type == VEH_AIRCRAFT) {
if (!IsCargoInClass(v->cargo_type, CC_PASSENGERS)) {
- capacity += e->u.air.mail_capacity;
+ capacity += GetVehicleProperty(v, PROP_AIRCRAFT_MAIL_CAPACITY, e->u.air.mail_capacity);
}
if (v->cargo_type == CT_MAIL) return capacity;
} else {