Changeset - r16381:32e85ff71e6c
[Not reviewed]
master
0 2 0
michi_cc - 14 years ago 2010-11-07 13:35:12
michi_cc@openttd.org
(svn r21107) -Fix: Don't use the maximum track speed where the maximum vehicle speed is meant.
2 files changed with 7 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/ground_vehicle.cpp
Show inline comments
 
@@ -47,8 +47,9 @@ void GroundVehicle<T, Type>::PowerChange
 

	
 
	/* If air drag is set to zero (default), the resulting air drag coefficient is dependent on max speed. */
 
	if (air_drag_value == 0) {
 
		uint16 max_speed = v->GetDisplayMaxSpeed();
 
		/* Simplification of the method used in TTDPatch. It uses <= 10 to change more steadily from 128 to 196. */
 
		air_drag = (max_track_speed <= 10) ? 192 : max(2048 / max_track_speed, 1);
 
		air_drag = (max_speed <= 10) ? 192 : max(2048 / max_speed, 1);
 
	} else {
 
		/* According to the specs, a value of 0x01 in the air drag property means "no air drag". */
 
		air_drag = (air_drag_value == 1) ? 0 : air_drag_value;
src/pathfinder/yapf/yapf_costrail.hpp
Show inline comments
 
@@ -466,11 +466,12 @@ no_entry_cost: // jump here at the begin
 
			{
 
				int min_speed = 0;
 
				int max_speed = tf->GetSpeedLimit(&min_speed);
 
				if (max_speed < v->max_speed) {
 
					extra_cost += YAPF_TILE_LENGTH * (v->max_speed - max_speed) * (4 + tf->m_tiles_skipped) / v->max_speed;
 
				int max_veh_speed = v->GetDisplayMaxSpeed();
 
				if (max_speed < max_veh_speed) {
 
					extra_cost += YAPF_TILE_LENGTH * (max_veh_speed - max_speed) * (4 + tf->m_tiles_skipped) / max_veh_speed;
 
				}
 
				if (min_speed > v->max_speed) {
 
					extra_cost += YAPF_TILE_LENGTH * (min_speed - v->max_speed);
 
				if (min_speed > max_veh_speed) {
 
					extra_cost += YAPF_TILE_LENGTH * (min_speed - max_veh_speed);
 
				}
 
			}
 

	
0 comments (0 inline, 0 general)