equal
deleted
inserted
replaced
796 /* This count is used by the depot code to determine the number of engines |
796 /* This count is used by the depot code to determine the number of engines |
797 * in the consist. Exclude articulated parts so that autoreplacing to |
797 * in the consist. Exclude articulated parts so that autoreplacing to |
798 * engines with more articulated parts than before works correctly. |
798 * engines with more articulated parts than before works correctly. |
799 * |
799 * |
800 * Also skip counting rear ends of multiheaded engines */ |
800 * Also skip counting rear ends of multiheaded engines */ |
801 if (!IsArticulatedPart(v) && !(!IsTrainEngine(v) && IsMultiheaded(v))) count++; |
801 if (!IsArticulatedPart(v) && !IsRearDualheaded(v)) count++; |
802 if (v->u.rail.track != TRACK_BIT_DEPOT || v->tile != tile || |
802 if (v->u.rail.track != TRACK_BIT_DEPOT || v->tile != tile || |
803 (IsFrontEngine(v) && needs_to_be_stopped && !(v->vehstatus & VS_STOPPED))) { |
803 (IsFrontEngine(v) && needs_to_be_stopped && !(v->vehstatus & VS_STOPPED))) { |
804 return -1; |
804 return -1; |
805 } |
805 } |
806 } |
806 } |
951 dst = GetLastEnginePart(dst); |
951 dst = GetLastEnginePart(dst); |
952 } else { |
952 } else { |
953 dst_head = NULL; |
953 dst_head = NULL; |
954 } |
954 } |
955 |
955 |
956 if (IsMultiheaded(src) && !IsTrainEngine(src)) return_cmd_error(STR_REAR_ENGINE_FOLLOW_FRONT_ERROR); |
956 if (IsRearDualheaded(src)) return_cmd_error(STR_REAR_ENGINE_FOLLOW_FRONT_ERROR); |
957 |
957 |
958 /* when moving all wagons, we can't have the same src_head and dst_head */ |
958 /* when moving all wagons, we can't have the same src_head and dst_head */ |
959 if (HASBIT(p2, 0) && src_head == dst_head) return CommandCost(); |
959 if (HASBIT(p2, 0) && src_head == dst_head) return CommandCost(); |
960 |
960 |
961 { |
961 { |
1219 /* make sure the vehicle is stopped in the depot */ |
1219 /* make sure the vehicle is stopped in the depot */ |
1220 if (CheckTrainStoppedInDepot(first) < 0) { |
1220 if (CheckTrainStoppedInDepot(first) < 0) { |
1221 return_cmd_error(STR_881A_TRAINS_CAN_ONLY_BE_ALTERED); |
1221 return_cmd_error(STR_881A_TRAINS_CAN_ONLY_BE_ALTERED); |
1222 } |
1222 } |
1223 |
1223 |
1224 if (IsMultiheaded(v) && !IsTrainEngine(v)) return_cmd_error(STR_REAR_ENGINE_FOLLOW_FRONT_ERROR); |
1224 if (IsRearDualheaded(v)) return_cmd_error(STR_REAR_ENGINE_FOLLOW_FRONT_ERROR); |
1225 |
1225 |
1226 if (flags & DC_EXEC) { |
1226 if (flags & DC_EXEC) { |
1227 if (v == first && IsFrontEngine(first)) { |
1227 if (v == first && IsFrontEngine(first)) { |
1228 w = FindWindowById(WC_VEHICLE_VIEW, first->index); |
1228 w = FindWindowById(WC_VEHICLE_VIEW, first->index); |
1229 if (w != NULL) DeleteWindow(w); |
1229 if (w != NULL) DeleteWindow(w); |