mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r23681) -Fix [FS#4914]: vehicle numbers got misaccounted when autoreplacing failed due to length checks
This commit is contained in:
parent
98fdf81320
commit
7d2061516a
@ -1200,11 +1200,9 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
|||||||
Train *original_src_head = src_head;
|
Train *original_src_head = src_head;
|
||||||
Train *original_dst_head = (dst_head == src_head ? NULL : dst_head);
|
Train *original_dst_head = (dst_head == src_head ? NULL : dst_head);
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
/* We want this information from before the rearrangement, but execute this after the validation. */
|
||||||
/* Remove old heads from the statistics */
|
bool original_src_head_front_engine = original_src_head != NULL && original_src_head->IsFrontEngine();
|
||||||
if (original_src_head != NULL && original_src_head->IsFrontEngine()) GroupStatistics::CountVehicle(original_src_head, -1);
|
bool original_dst_head_front_engine = original_dst_head != NULL && original_dst_head->IsFrontEngine();
|
||||||
if (original_dst_head != NULL && original_dst_head->IsFrontEngine()) GroupStatistics::CountVehicle(original_dst_head, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (Re)arrange the trains in the wanted arrangement. */
|
/* (Re)arrange the trains in the wanted arrangement. */
|
||||||
ArrangeTrains(&dst_head, dst, &src_head, src, move_chain);
|
ArrangeTrains(&dst_head, dst, &src_head, src, move_chain);
|
||||||
@ -1224,6 +1222,10 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
|||||||
|
|
||||||
/* do it? */
|
/* do it? */
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
|
/* Remove old heads from the statistics */
|
||||||
|
if (original_src_head_front_engine) GroupStatistics::CountVehicle(original_src_head, -1);
|
||||||
|
if (original_dst_head_front_engine) GroupStatistics::CountVehicle(original_dst_head, -1);
|
||||||
|
|
||||||
/* First normalise the sub types of the chains. */
|
/* First normalise the sub types of the chains. */
|
||||||
NormaliseSubtypes(src_head);
|
NormaliseSubtypes(src_head);
|
||||||
NormaliseSubtypes(dst_head);
|
NormaliseSubtypes(dst_head);
|
||||||
|
Loading…
Reference in New Issue
Block a user