TBTR: Add support for vehicle reversed flag

This commit is contained in:
Jonathan G Rennison
2021-01-10 18:10:20 +00:00
parent e9f7783327
commit 515aeb04e0
7 changed files with 23 additions and 2 deletions

View File

@@ -1016,6 +1016,7 @@ Train* VirtualTrainFromTemplateVehicle(const TemplateVehicle* tv, StringID &err,
for (tv = tv_head, tmp = head; tv != nullptr && tmp != nullptr; tv = tv->Next(), tmp = tmp->Next()) {
tmp->cargo_type = tv->cargo_type;
tmp->cargo_subtype = tv->cargo_subtype;
SB(tmp->flags, VRF_REVERSE_DIRECTION, 1, HasBit(tv->ctrl_flags, TVCF_REVERSED) ? 1 : 0);
}
_new_vehicle_id = head->index;
@@ -1064,6 +1065,7 @@ CommandCost CmdVirtualTrainFromTrain(TileIndex tile, DoCommandFlag flags, uint32
tmp->cargo_type = train->cargo_type;
tmp->cargo_subtype = train->cargo_subtype;
SB(tmp->flags, VRF_REVERSE_DIRECTION, 1, HasBit(train->flags, VRF_REVERSE_DIRECTION) ? 1 : 0);
CmdMoveRailVehicle(0, DC_EXEC, (1 << 21) | tmp->index, tail->index, 0);
tail = tmp;