File diff r8702:158df70aa3b4 → r8703:00ee5912a1f3
src/train_cmd.cpp
Show inline comments
 
@@ -211,12 +211,15 @@ void TrainConsistChanged(Vehicle* v)
 
		/* Cache wagon override sprite group. NULL is returned if there is none */
 
		u->u.rail.cached_override = GetWagonOverrideSpriteSet(u->engine_type, u->cargo_type, u->u.rail.first_engine);
 

	
 
		/* 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 {
 
			if (IsTrainWagon(u) || IsArticulatedPart(u)) {
 
				/* Wagons and articulated parts have no effect by default */
 
				u->u.rail.cached_vis_effect = 0x40;
 
@@ -267,14 +270,12 @@ void TrainConsistChanged(Vehicle* v)
 

	
 
		if (u->cargo_type == rvi_u->cargo_type && u->cargo_subtype == 0) {
 
			/* Set cargo capacity if we've not been refitted */
 
			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)) {
 
			veh_len = GetVehicleCallback(CBID_VEHICLE_LENGTH, 0, 0, u->engine_type, u);
 
		}
 
		if (veh_len == CALLBACK_FAILED) veh_len = rvi_u->shorten_factor;