src/train_cmd.cpp
changeset 9199 39147e16a5a0
parent 9192 7e4b0b777375
child 9200 8daa2f627bdb
equal deleted inserted replaced
9198:1442ea35d8dd 9199:39147e16a5a0
   212 		u->u.rail.cached_override = GetWagonOverrideSpriteSet(u->engine_type, u->cargo_type, u->u.rail.first_engine);
   212 		u->u.rail.cached_override = GetWagonOverrideSpriteSet(u->engine_type, u->cargo_type, u->u.rail.first_engine);
   213 
   213 
   214 		/* Reset color map */
   214 		/* Reset color map */
   215 		u->colormap = PAL_NONE;
   215 		u->colormap = PAL_NONE;
   216 
   216 
       
   217 		/* Set user defined data (must be done before other properties) */
       
   218 		u->u.rail.user_def_data = GetVehicleProperty(u, 0x25, rvi_u->user_def_data);
       
   219 
   217 		if (rvi_u->visual_effect != 0) {
   220 		if (rvi_u->visual_effect != 0) {
   218 			u->u.rail.cached_vis_effect = rvi_u->visual_effect;
   221 			u->u.rail.cached_vis_effect = rvi_u->visual_effect;
   219 		} else {
   222 		} else {
   220 			if (IsTrainWagon(u) || IsArticulatedPart(u)) {
   223 			if (IsTrainWagon(u) || IsArticulatedPart(u)) {
   221 				/* Wagons and articulated parts have no effect by default */
   224 				/* Wagons and articulated parts have no effect by default */
   267 
   270 
   268 		if (u->cargo_type == rvi_u->cargo_type && u->cargo_subtype == 0) {
   271 		if (u->cargo_type == rvi_u->cargo_type && u->cargo_subtype == 0) {
   269 			/* Set cargo capacity if we've not been refitted */
   272 			/* Set cargo capacity if we've not been refitted */
   270 			u->cargo_cap = GetVehicleProperty(u, 0x14, rvi_u->capacity);
   273 			u->cargo_cap = GetVehicleProperty(u, 0x14, rvi_u->capacity);
   271 		}
   274 		}
   272 
       
   273 		u->u.rail.user_def_data = GetVehicleProperty(u, 0x25, rvi_u->user_def_data);
       
   274 
   275 
   275 		/* check the vehicle length (callback) */
   276 		/* check the vehicle length (callback) */
   276 		uint16 veh_len = CALLBACK_FAILED;
   277 		uint16 veh_len = CALLBACK_FAILED;
   277 		if (HasBit(EngInfo(u->engine_type)->callbackmask, CBM_VEHICLE_LENGTH)) {
   278 		if (HasBit(EngInfo(u->engine_type)->callbackmask, CBM_VEHICLE_LENGTH)) {
   278 			veh_len = GetVehicleCallback(CBID_VEHICLE_LENGTH, 0, 0, u->engine_type, u);
   279 			veh_len = GetVehicleCallback(CBID_VEHICLE_LENGTH, 0, 0, u->engine_type, u);