Add whether the vehicle is non-front to the vehicle pool pointer tag

Add iteration filters which check this
This commit is contained in:
Jonathan G Rennison
2024-02-25 14:49:31 +00:00
parent 05e237f8d1
commit 93bf033107
23 changed files with 145 additions and 81 deletions

View File

@@ -2456,9 +2456,8 @@ CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags, int replacement_
delete cur_stop;
/* Make sure no vehicle is going to the old roadstop */
for (RoadVehicle *v : RoadVehicle::Iterate()) {
if (v->First() == v && v->current_order.IsType(OT_GOTO_STATION) &&
v->dest_tile == tile) {
for (RoadVehicle *v : RoadVehicle::IterateFrontOnly()) {
if (v->current_order.IsType(OT_GOTO_STATION) && v->dest_tile == tile) {
v->SetDestTile(v->GetOrderStationLocation(st->index));
}
}
@@ -3236,9 +3235,7 @@ static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags)
ClearDockingTilesCheckingNeighbours(tile1);
ClearDockingTilesCheckingNeighbours(tile2);
for (Ship *s : Ship::Iterate()) {
if (!s->IsPrimaryVehicle()) continue;
for (Ship *s : Ship::IterateFrontOnly()) {
/* Find all ships going to our dock. */
if (s->current_order.GetDestination() != st->index) {
continue;