(svn r11733) -Fix: Max speed for entering stations overrode the max speed of curves

This commit is contained in:
peter1138 2008-01-01 14:15:28 +00:00
parent a967a7287f
commit a8611311ac
1 changed files with 7 additions and 6 deletions

View File

@ -368,15 +368,16 @@ static int GetTrainAcceleration(Vehicle *v, bool mode)
if (IsTileType(v->tile, MP_STATION) && IsFrontEngine(v)) {
if (TrainShouldStop(v, v->tile)) {
int station_length = GetStationByTile(v->tile)->GetPlatformLength(v->tile, DirToDiagDir(v->direction));
int delta_v;
max_speed = 120;
int st_max_speed = 120;
delta_v = v->cur_speed / (station_length + 1);
if (v->max_speed > (v->cur_speed - delta_v))
max_speed = v->cur_speed - (delta_v / 10);
int delta_v = v->cur_speed / (station_length + 1);
if (v->max_speed > (v->cur_speed - delta_v)) {
st_max_speed = v->cur_speed - (delta_v / 10);
}
max_speed = max(max_speed, 25 * station_length);
st_max_speed = max(st_max_speed, 25 * station_length);
max_speed = min(max_speed, st_max_speed);
}
}