Use already found iterator for erasing from hash map

This commit is contained in:
Jonathan G Rennison
2021-06-27 23:06:41 +01:00
parent 62075c88de
commit e16c29ef7d

View File

@@ -5562,7 +5562,7 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse)
if (found_speed_restriction != _signal_speeds.end()) {
if (IsOutOfDate(found_speed_restriction->second)) {
_signal_speeds.erase(speed_key);
_signal_speeds.erase(found_speed_restriction);
v->signal_speed_restriction = 0;
} else {
v->signal_speed_restriction = std::max<uint16>(25, found_speed_restriction->second.train_speed);