mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Fix train unit ID allocation when moving engine to new train, reaching train limit
See: #725
This commit is contained in:
parent
da0010241f
commit
177b75af77
@ -2273,14 +2273,15 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32_t p1,
|
||||
SetWindowDirty(WC_COMPANY, _current_company);
|
||||
}
|
||||
|
||||
/* Add new heads to statistics */
|
||||
if (src_head != nullptr && src_head->IsFrontEngine()) GroupStatistics::CountVehicle(src_head, 1);
|
||||
if (dst_head != nullptr && dst_head->IsFrontEngine()) GroupStatistics::CountVehicle(dst_head, 1);
|
||||
|
||||
/* Handle 'new engine' part of cases #1b, #2b, #3b, #4b and #5 in NormaliseTrainHead. */
|
||||
NormaliseTrainHead(src_head);
|
||||
NormaliseTrainHead(dst_head);
|
||||
|
||||
/* Add new heads to statistics.
|
||||
* This should be done after NormaliseTrainHead due to engine total limit checks in GetFreeUnitNumber. */
|
||||
if (src_head != nullptr && src_head->IsFrontEngine()) GroupStatistics::CountVehicle(src_head, 1);
|
||||
if (dst_head != nullptr && dst_head->IsFrontEngine()) GroupStatistics::CountVehicle(dst_head, 1);
|
||||
|
||||
if ((flags & DC_NO_CARGO_CAP_CHECK) == 0) {
|
||||
CheckCargoCapacity(src_head);
|
||||
CheckCargoCapacity(dst_head);
|
||||
|
Loading…
Reference in New Issue
Block a user