Codechange: Replaced SmallVector::Find() with std::find()

This commit is contained in:
Henry Wilson
2019-02-20 19:27:10 +00:00
committed by PeterN
parent e0c58bf5ee
commit 2bc2de9034
9 changed files with 41 additions and 37 deletions

View File

@@ -298,10 +298,9 @@ CommandCost CmdSetTimetableStart(TileIndex tile, DoCommandFlag flags, uint32 p1,
QSortT(vehs.Begin(), vehs.size(), &VehicleTimetableSorter);
}
int base = vehs.FindIndex(v);
int idx = vehs.begin() - std::find(vehs.begin(), vehs.end(), v);
for (Vehicle **viter = vehs.Begin(); viter != vehs.End(); viter++) {
int idx = (viter - vehs.Begin()) - base;
Vehicle *w = *viter;
w->lateness_counter = 0;
@@ -309,6 +308,7 @@ CommandCost CmdSetTimetableStart(TileIndex tile, DoCommandFlag flags, uint32 p1,
/* Do multiplication, then division to reduce rounding errors. */
w->timetable_start = start_date + idx * total_duration / num_vehs / DAY_TICKS;
SetWindowDirty(WC_VEHICLE_TIMETABLE, w->index);
++idx;
}
}