Mercurial > hg > openttd
changeset 7850:37236521c91a draft
(svn r11400) -Fix [FS#1409]: assign orders during cloning after refitting as it needs the cargo types to be the same.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sat, 10 Nov 2007 22:56:43 +0000 |
parents | e6ee8bfd9045 |
children | 0711b2e05d80 |
files | src/vehicle.cpp |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1769,10 +1769,9 @@ return result; // return error and the message returned from CMD_MOVE_RAIL_VEHICLE } } 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->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 } @@ -1836,6 +1835,15 @@ if ((flags & DC_EXEC) && v->type == VEH_TRAIN) w = GetNextVehicle(w); } 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 * check whether the player has enough money manually. */ if (!CheckPlayerHasMoney(total_cost)) {