mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r11400) -Fix [FS#1409]: assign orders during cloning after refitting as it needs the cargo types to be the same.
This commit is contained in:
parent
f55fdfb7c4
commit
3a8cdc37ce
|
@ -1769,10 +1769,9 @@ CommandCost CmdCloneVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
return result; // return error and the message returned from CMD_MOVE_RAIL_VEHICLE
|
return result; // return error and the message returned from CMD_MOVE_RAIL_VEHICLE
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* this is a front engine or not a train. It need orders */
|
/* this is a front engine or not a train. */
|
||||||
w_front = w;
|
w_front = w;
|
||||||
w->service_interval = v->service_interval;
|
w->service_interval = v->service_interval;
|
||||||
DoCommand(0, (v->index << 16) | w->index, p2 & 1 ? CO_SHARE : CO_COPY, flags, CMD_CLONE_ORDER);
|
|
||||||
}
|
}
|
||||||
w_rear = w; // trains needs to know the last car in the train, so they can add more in next loop
|
w_rear = w; // trains needs to know the last car in the train, so they can add more in next loop
|
||||||
}
|
}
|
||||||
|
@ -1836,6 +1835,15 @@ CommandCost CmdCloneVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
if ((flags & DC_EXEC) && v->type == VEH_TRAIN) w = GetNextVehicle(w);
|
if ((flags & DC_EXEC) && v->type == VEH_TRAIN) w = GetNextVehicle(w);
|
||||||
} while (v->type == VEH_TRAIN && (v = GetNextVehicle(v)) != NULL);
|
} while (v->type == VEH_TRAIN && (v = GetNextVehicle(v)) != NULL);
|
||||||
|
|
||||||
|
if (flags & DC_EXEC) {
|
||||||
|
/*
|
||||||
|
* Set the orders of the vehicle. Cannot do it earlier as we need
|
||||||
|
* the vehicle refitted before doing this, otherwise the moved
|
||||||
|
* cargo types might not match (passenger vs non-passenger)
|
||||||
|
*/
|
||||||
|
DoCommand(0, (v_front->index << 16) | w_front->index, p2 & 1 ? CO_SHARE : CO_COPY, flags, CMD_CLONE_ORDER);
|
||||||
|
}
|
||||||
|
|
||||||
/* Since we can't estimate the cost of cloning a vehicle accurately we must
|
/* Since we can't estimate the cost of cloning a vehicle accurately we must
|
||||||
* check whether the player has enough money manually. */
|
* check whether the player has enough money manually. */
|
||||||
if (!CheckPlayerHasMoney(total_cost)) {
|
if (!CheckPlayerHasMoney(total_cost)) {
|
||||||
|
|
Loading…
Reference in New Issue