# HG changeset patch # User peter1138 # Date 1208987724 0 # Node ID b5a6fb206640c130db5267d2914e3e9978dcb2ad # Parent 9cfcdd5b5ddb9e3496067c6c7461718490ea7dac (svn r12856) -Fix: Taking r12377 further, ensure that prop 25 is set for all vehicles in the consist before other properties. diff -r 9cfcdd5b5ddb -r b5a6fb206640 src/train_cmd.cpp --- a/src/train_cmd.cpp Wed Apr 23 20:56:08 2008 +0000 +++ b/src/train_cmd.cpp Wed Apr 23 21:55:24 2008 +0000 @@ -203,12 +203,24 @@ /* 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 @@ /* 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 {