summaryrefslogtreecommitdiff
path: root/src/timetable_cmd.cpp
diff options
context:
space:
mode:
authorHenry Wilson <m3henry@googlemail.com>2019-02-20 19:27:10 +0000
committerPeterN <peter@fuzzle.org>2019-03-26 20:15:57 +0000
commit2bc2de9034d3b75a253b849cf7a703b1a503e200 (patch)
tree39f3a8e94a6f993f20dbbf027b6cdd684ab4ce4c /src/timetable_cmd.cpp
parente0c58bf5ee0f3f4d0563a04de315c09b37f74c6e (diff)
downloadopenttd-2bc2de9034d3b75a253b849cf7a703b1a503e200.tar.xz
Codechange: Replaced SmallVector::Find() with std::find()
Diffstat (limited to 'src/timetable_cmd.cpp')
-rw-r--r--src/timetable_cmd.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp
index 8107fc3d2..fcc8493e2 100644
--- a/src/timetable_cmd.cpp
+++ b/src/timetable_cmd.cpp
@@ -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;
}
}