comparison src/train_cmd.cpp @ 9037:8132939c7773 draft

(svn r12856) -Fix: Taking r12377 further, ensure that prop 25 is set for all vehicles in the consist before other properties.
author peter1138 <peter1138@openttd.org>
date Wed, 23 Apr 2008 21:55:24 +0000
parents db43607c4798
children 7a19e805faf6
comparison
equal deleted inserted replaced
9036:74210834ed21 9037:8132939c7773
201 const RailVehicleInfo *rvi_u = RailVehInfo(u->engine_type); 201 const RailVehicleInfo *rvi_u = RailVehInfo(u->engine_type);
202 202
203 /* Check the v->first cache. */ 203 /* Check the v->first cache. */
204 assert(u->First() == v); 204 assert(u->First() == v);
205 205
206 if (!HasBit(EngInfo(u->engine_type)->misc_flags, EF_RAIL_TILTS)) train_can_tilt = false;
207
208 /* update the 'first engine' */ 206 /* update the 'first engine' */
209 u->u.rail.first_engine = v == u ? INVALID_ENGINE : first_engine; 207 u->u.rail.first_engine = v == u ? INVALID_ENGINE : first_engine;
210 u->u.rail.railtype = rvi_u->railtype; 208 u->u.rail.railtype = rvi_u->railtype;
211 209
210 /* Set user defined data to its default value */
211 u->u.rail.user_def_data = rvi_u->user_def_data;
212 }
213
214 for (Vehicle *u = v; u != NULL; u = u->Next()) {
215 /* Update user defined data (must be done before other properties) */
216 u->u.rail.user_def_data = GetVehicleProperty(u, 0x25, u->u.rail.user_def_data);
217 }
218
219 for (Vehicle *u = v; u != NULL; u = u->Next()) {
220 const RailVehicleInfo *rvi_u = RailVehInfo(u->engine_type);
221
222 if (!HasBit(EngInfo(u->engine_type)->misc_flags, EF_RAIL_TILTS)) train_can_tilt = false;
223
212 if (IsTrainEngine(u)) first_engine = u->engine_type; 224 if (IsTrainEngine(u)) first_engine = u->engine_type;
213 225
214 /* Cache wagon override sprite group. NULL is returned if there is none */ 226 /* Cache wagon override sprite group. NULL is returned if there is none */
215 u->u.rail.cached_override = GetWagonOverrideSpriteSet(u->engine_type, u->cargo_type, u->u.rail.first_engine); 227 u->u.rail.cached_override = GetWagonOverrideSpriteSet(u->engine_type, u->cargo_type, u->u.rail.first_engine);
216 228
217 /* Reset color map */ 229 /* Reset color map */
218 u->colormap = PAL_NONE; 230 u->colormap = PAL_NONE;
219
220 /* Set user defined data (must be done before other properties) */
221 u->u.rail.user_def_data = GetVehicleProperty(u, 0x25, rvi_u->user_def_data);
222 231
223 if (rvi_u->visual_effect != 0) { 232 if (rvi_u->visual_effect != 0) {
224 u->u.rail.cached_vis_effect = rvi_u->visual_effect; 233 u->u.rail.cached_vis_effect = rvi_u->visual_effect;
225 } else { 234 } else {
226 if (IsTrainWagon(u) || IsArticulatedPart(u)) { 235 if (IsTrainWagon(u) || IsArticulatedPart(u)) {