Use already found iterator for erasing from hash map
This commit is contained in:
@@ -5562,7 +5562,7 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse)
|
|||||||
|
|
||||||
if (found_speed_restriction != _signal_speeds.end()) {
|
if (found_speed_restriction != _signal_speeds.end()) {
|
||||||
if (IsOutOfDate(found_speed_restriction->second)) {
|
if (IsOutOfDate(found_speed_restriction->second)) {
|
||||||
_signal_speeds.erase(speed_key);
|
_signal_speeds.erase(found_speed_restriction);
|
||||||
v->signal_speed_restriction = 0;
|
v->signal_speed_restriction = 0;
|
||||||
} else {
|
} else {
|
||||||
v->signal_speed_restriction = std::max<uint16>(25, found_speed_restriction->second.train_speed);
|
v->signal_speed_restriction = std::max<uint16>(25, found_speed_restriction->second.train_speed);
|
||||||
|
Reference in New Issue
Block a user