diff options
author | peter1138 <peter1138@openttd.org> | 2008-04-23 21:55:24 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2008-04-23 21:55:24 +0000 |
commit | 7c8fe9791b3fb63a2842f45c85c8c428780a7a4e (patch) | |
tree | a83d6c9fb4786eb493ec400e7a85b526490d74c2 | |
parent | d56827a9a9a109b639a25514f1a6424ba9111a70 (diff) | |
download | openttd-7c8fe9791b3fb63a2842f45c85c8c428780a7a4e.tar.xz |
(svn r12856) -Fix: Taking r12377 further, ensure that prop 25 is set for all vehicles in the consist before other properties.
-rw-r--r-- | src/train_cmd.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 84ad087c9..681f369cc 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -203,12 +203,24 @@ void TrainConsistChanged(Vehicle *v) /* Check the v->first cache. */ assert(u->First() == v); - if (!HasBit(EngInfo(u->engine_type)->misc_flags, EF_RAIL_TILTS)) train_can_tilt = false; - /* update the 'first engine' */ u->u.rail.first_engine = v == u ? INVALID_ENGINE : first_engine; u->u.rail.railtype = rvi_u->railtype; + /* Set user defined data to its default value */ + u->u.rail.user_def_data = rvi_u->user_def_data; + } + + for (Vehicle *u = v; u != NULL; u = u->Next()) { + /* Update user defined data (must be done before other properties) */ + u->u.rail.user_def_data = GetVehicleProperty(u, 0x25, u->u.rail.user_def_data); + } + + for (Vehicle *u = v; u != NULL; u = u->Next()) { + const RailVehicleInfo *rvi_u = RailVehInfo(u->engine_type); + + if (!HasBit(EngInfo(u->engine_type)->misc_flags, EF_RAIL_TILTS)) train_can_tilt = false; + if (IsTrainEngine(u)) first_engine = u->engine_type; /* Cache wagon override sprite group. NULL is returned if there is none */ @@ -217,9 +229,6 @@ void TrainConsistChanged(Vehicle *v) /* Reset color map */ u->colormap = PAL_NONE; - /* Set user defined data (must be done before other properties) */ - u->u.rail.user_def_data = GetVehicleProperty(u, 0x25, rvi_u->user_def_data); - if (rvi_u->visual_effect != 0) { u->u.rail.cached_vis_effect = rvi_u->visual_effect; } else { |