summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2007-11-15 00:13:12 +0000
committerglx <glx@openttd.org>2007-11-15 00:13:12 +0000
commit9fcf6e7a43b51bc109749510118d36428ced0b67 (patch)
treef6fd15de0b2710a8555aa567964b330507cc7b71
parenta46f502d5f1dc9106cc5e58b48da3338e80e3b10 (diff)
downloadopenttd-9fcf6e7a43b51bc109749510118d36428ced0b67.tar.xz
(svn r11431) -Codechange: [NewGRF] Add support for changing rail vehicle user-defined bit mask (prop 25) via callback 36
-rw-r--r--src/newgrf_engine.cpp2
-rw-r--r--src/train_cmd.cpp2
-rw-r--r--src/vehicle.h1
3 files changed, 4 insertions, 1 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index 2c0090da9..4adf8d82d 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -548,7 +548,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
cargo_classes |= GetCargo(u->cargo_type)->classes;
common_cargos[u->cargo_type]++;
- if (v->type == VEH_TRAIN) user_def_data |= RailVehInfo(u->engine_type)->user_def_data;
+ if (v->type == VEH_TRAIN) user_def_data |= u->u.rail.user_def_data;
common_subtypes[u->cargo_subtype]++;
}
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index ffd7bc85a..98521110b 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -236,6 +236,8 @@ void TrainConsistChanged(Vehicle* v)
u->cargo_cap = GetVehicleProperty(u, 0x14, rvi_u->capacity);
}
+ u->u.rail.user_def_data = GetVehicleProperty(u, 0x25, rvi_u->user_def_data);
+
/* check the vehicle length (callback) */
uint16 veh_len = CALLBACK_FAILED;
if (HASBIT(EngInfo(u->engine_type)->callbackmask, CBM_VEHICLE_LENGTH)) {
diff --git a/src/vehicle.h b/src/vehicle.h
index 00a457bb1..eb3f3ad4f 100644
--- a/src/vehicle.h
+++ b/src/vehicle.h
@@ -136,6 +136,7 @@ struct VehicleRail {
* bit 7 = disable powered wagons.
*/
byte cached_vis_effect;
+ byte user_def_data;
/* NOSAVE: for wagon override - id of the first engine in train
* 0xffff == not in train */