Fix missing stop due to speed when entering station with lookahead
This commit is contained in:
@@ -928,15 +928,7 @@ Train::MaxSpeedInfo Train::GetCurrentMaxSpeedInfo() const
|
|||||||
int distance_to_go = station_ahead / TILE_SIZE - (station_length - stop_at) / TILE_SIZE;
|
int distance_to_go = station_ahead / TILE_SIZE - (station_length - stop_at) / TILE_SIZE;
|
||||||
|
|
||||||
if (distance_to_go > 0) {
|
if (distance_to_go > 0) {
|
||||||
int st_max_speed = 120;
|
advisory_max_speed = min(advisory_max_speed, 15 * distance_to_go);
|
||||||
|
|
||||||
int delta_v = this->cur_speed / (distance_to_go + 1);
|
|
||||||
if (advisory_max_speed > (this->cur_speed - delta_v)) {
|
|
||||||
st_max_speed = this->cur_speed - (delta_v / 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
st_max_speed = max(st_max_speed, 25 * distance_to_go);
|
|
||||||
advisory_max_speed = min(advisory_max_speed, st_max_speed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user