1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-02-03 18:08:14 +01:00

(svn r20585) [1.0] -Backport from trunk:

- Fix: Autoreplace failed while attaching non-replaced wagons to the new chain, if to-be-sold-engines would become front-engines and the unitnumber limit would be exceeded (r20583)
- Fix: Autoreplace can trigger an assertion when at the vehicle limit [FS#4044] (r20582)
- Fix: Go via station and go via waypoint behaved differently when a train went back to the same (unordered) station again [FS#4039] (r20580)
- Fix: Draw bounding boxes using white instead of pure white, so they are recoloured to grey in coloured newspaper instead of blue [FS#4051] (r20578)
- Fix: Scroll button flickering when pressed [FS#4043] (r20577)
This commit is contained in:
rubidium
2010-08-20 18:28:46 +00:00
parent 544887688b
commit 7cf8dd70c3
7 changed files with 30 additions and 19 deletions

View File

@@ -454,6 +454,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
/* Append engines to the new chain
* We do this from back to front, so that the head of the temporary vehicle chain does not change all the time.
* That way we also have less trouble when exceeding the unitnumber limit.
* OTOH the vehicle attach callback is more expensive this way :s */
Train *last_engine = NULL; ///< Shall store the last engine unit after this step
if (cost.Succeeded()) {
@@ -462,6 +463,13 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
if (RailVehInfo(append->engine_type)->railveh_type == RAILVEH_WAGON) continue;
if (new_vehs[i] != NULL) {
/* Move the old engine to a separate row with DC_AUTOREPLACE. Else
* moving the wagon in front may fail later due to unitnumber limit.
* (We have to attach wagons without DC_AUTOREPLACE.) */
MoveVehicle(old_vehs[i], NULL, DC_EXEC | DC_AUTOREPLACE, false);
}
if (last_engine == NULL) last_engine = append;
cost.AddCost(MoveVehicle(append, new_head, DC_EXEC, false));
if (cost.Failed()) break;