summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-11-08 17:28:05 +0000
committerfrosch <frosch@openttd.org>2011-11-08 17:28:05 +0000
commit7d4568361c92bcf448859f47103a59c0735a4f99 (patch)
treefb58a52a1a031149feb3354a5afda1525e2164c7 /src
parent8dcbd673cfa9e9f1f4036fe053a9ebd78bb0328a (diff)
downloadopenttd-7d4568361c92bcf448859f47103a59c0735a4f99.tar.xz
(svn r23151) -Change: [NewGRF v8] Deprecate callback 12, and use callback 36 instead.
Diffstat (limited to 'src')
-rw-r--r--src/economy.cpp11
-rw-r--r--src/newgrf.cpp2
-rw-r--r--src/newgrf_properties.h2
3 files changed, 12 insertions, 3 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index 79d8a0b99..48cd28296 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1207,8 +1207,15 @@ static void LoadUnloadVehicle(Vehicle *front, int *cargo_left)
/* The default loadamount for mail is 1/4 of the load amount for passengers */
if (v->type == VEH_AIRCRAFT && !Aircraft::From(v)->IsNormalAircraft()) load_amount = CeilDiv(load_amount, 4);
- if (_settings_game.order.gradual_loading && HasBit(e->info.callback_mask, CBM_VEHICLE_LOAD_AMOUNT)) {
- uint16 cb_load_amount = GetVehicleCallback(CBID_VEHICLE_LOAD_AMOUNT, 0, 0, v->engine_type, v);
+ if (_settings_game.order.gradual_loading) {
+ uint16 cb_load_amount = CALLBACK_FAILED;
+ if (e->GetGRF() != NULL && e->GetGRF()->grf_version >= 8) {
+ /* Use callback 36 */
+ cb_load_amount = GetVehicleProperty(v, PROP_VEHICLE_LOAD_AMOUNT, CALLBACK_FAILED);
+ } else if (HasBit(e->info.callback_mask, CBM_VEHICLE_LOAD_AMOUNT)) {
+ /* Use callback 12 */
+ cb_load_amount = GetVehicleCallback(CBID_VEHICLE_LOAD_AMOUNT, 0, 0, v->engine_type, v);
+ }
if (cb_load_amount != CALLBACK_FAILED) {
if (e->GetGRF()->grf_version < 8) cb_load_amount = GB(cb_load_amount, 0, 8);
if (cb_load_amount >= 0x100) {
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 0904760c6..890b10034 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -888,7 +888,7 @@ static ChangeInfoResult CommonVehicleChangeInfo(EngineInfo *ei, int prop, ByteRe
ei->climates = buf->ReadByte();
break;
- case 0x07: // Loading speed
+ case PROP_VEHICLE_LOAD_AMOUNT: // 0x07 Loading speed
/* Amount of cargo loaded during a vehicle's "loading tick" */
ei->load_amount = buf->ReadByte();
break;
diff --git a/src/newgrf_properties.h b/src/newgrf_properties.h
index 5b2ba055a..090ac1413 100644
--- a/src/newgrf_properties.h
+++ b/src/newgrf_properties.h
@@ -18,6 +18,8 @@
* @todo Currently the list only contains properties which are used more than once in the code. I.e. they are available for callback 0x36.
*/
enum PropertyID {
+ PROP_VEHICLE_LOAD_AMOUNT = 0x07, ///< Loading speed
+
PROP_TRAIN_SPEED = 0x09, ///< Max. speed: 1 unit = 1/1.6 mph = 1 km-ish/h
PROP_TRAIN_POWER = 0x0B, ///< Power in hp (if dualheaded: sum of both vehicles)
PROP_TRAIN_RUNNING_COST_FACTOR = 0x0D, ///< Yearly runningcost (if dualheaded: sum of both vehicles)