diff src/train_cmd.cpp @ 19093:38652cadf0fe draft

(svn r23947) -Feature: Timetabled maximum travel speeds for non-flying vehicles.
author michi_cc <michi_cc@openttd.org>
date Tue, 14 Feb 2012 17:04:06 +0000 (2012-02-14)
parents 081eb943326c
children 6880d0499ff8
line wrap: on
line diff
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -404,6 +404,7 @@
 		}
 	}
 
+	max_speed = min(max_speed, this->current_order.max_speed);
 	return min(max_speed, this->gcache.cached_max_track_speed);
 }
 
@@ -2748,7 +2749,7 @@
 	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, this->gcache.cached_max_track_speed);
+			return this->DoUpdateSpeed(this->acceleration * (this->GetAccelerationStatus() == AS_BRAKE ? -4 : 2), 0, min(this->gcache.cached_max_track_speed, this->current_order.max_speed));
 
 		case AM_REALISTIC:
 			return this->DoUpdateSpeed(this->GetAcceleration(), this->GetAccelerationStatus() == AS_BRAKE ? 0 : 2, this->GetCurrentMaxSpeed());