1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 17:02:37 +01:00

(svn r25170) [1.3] -Backport from trunk:

- Fix: Original train and rv acceleration did no longer respect bridge speed limits [FS#5523] (r25167)
- Fix: [Win32] Do not statically link to SHGetFolderPath as it may not exist, and improve its emulation [FS#5522] (r25155, r25153)
- Fix: [Win32] Do not store invalid paths in the search path list (r25154)
- Fix: Remove stray reservation from savegames affected by FS#5510 et al. upon loading [FS#5520] (r25152)
- Fix: [Script] XXBase::Chance function did not work for large values (>65535) [FS#5517] (r25148)
This commit is contained in:
rubidium
2013-04-08 20:59:42 +00:00
parent 283ab728f2
commit 7daff778f9
8 changed files with 59 additions and 34 deletions

View File

@@ -371,10 +371,11 @@ int Train::GetCurveSpeedLimit() const
*/
int Train::GetCurrentMaxSpeed() const
{
if (_settings_game.vehicle.train_acceleration_model == AM_ORIGINAL) return min(this->gcache.cached_max_track_speed, this->current_order.max_speed);
int max_speed = _settings_game.vehicle.train_acceleration_model == AM_ORIGINAL ?
this->gcache.cached_max_track_speed :
this->tcache.cached_max_curve_speed;
int max_speed = this->tcache.cached_max_curve_speed;
if (IsRailStationTile(this->tile)) {
if (_settings_game.vehicle.train_acceleration_model == AM_REALISTIC && IsRailStationTile(this->tile)) {
StationID sid = GetStationIndex(this->tile);
if (this->current_order.ShouldStopAtStation(this, sid)) {
int station_ahead;
@@ -400,7 +401,7 @@ int Train::GetCurrentMaxSpeed() const
}
for (const Train *u = this; u != NULL; u = u->Next()) {
if (u->track == TRACK_BIT_DEPOT) {
if (_settings_game.vehicle.train_acceleration_model == AM_REALISTIC && u->track == TRACK_BIT_DEPOT) {
max_speed = min(max_speed, 61);
break;
}
@@ -2775,7 +2776,7 @@ int Train::UpdateSpeed()
switch (_settings_game.vehicle.train_acceleration_model) {
default: NOT_REACHED();
case AM_ORIGINAL:
return this->DoUpdateSpeed(this->acceleration * (this->GetAccelerationStatus() == AS_BRAKE ? -4 : 2), 0, min(this->gcache.cached_max_track_speed, this->current_order.max_speed));
return this->DoUpdateSpeed(this->acceleration * (this->GetAccelerationStatus() == AS_BRAKE ? -4 : 2), 0, this->GetCurrentMaxSpeed());
case AM_REALISTIC:
return this->DoUpdateSpeed(this->GetAcceleration(), this->GetAccelerationStatus() == AS_BRAKE ? 0 : 2, this->GetCurrentMaxSpeed());