Changeset - r14372:c020b32eb5e4
[Not reviewed]
master
0 2 0
terkhen - 14 years ago 2010-01-28 20:54:29
terkhen@openttd.org
(svn r18939) -Codechange [FS#3545]: Move train slope steepness to its own function.
2 files changed with 10 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/train.h
Show inline comments
 
@@ -494,6 +494,15 @@ protected: /* These functions should not
 
	{
 
		return GetRailTypeInfo(this->railtype)->acceleration_type;
 
	}
 

	
 
	/**
 
	 * Returns the slope steepness used by this vehicle.
 
	 * @return Slope steepness used by the vehicle.
 
	 */
 
	FORCEINLINE uint32 GetSlopeSteepness() const
 
	{
 
		return 20 * _settings_game.vehicle.train_slope_steepness; // 1% slope * slope steepness
 
	}
 
};
 

	
 
#define FOR_ALL_TRAINS(var) FOR_ALL_VEHICLES_OF_TYPE(Train, var)
src/train_cmd.cpp
Show inline comments
 
@@ -139,7 +139,7 @@ void Train::CargoChanged()
 
	for (Train *u = this; u != NULL; u = u->Next()) {
 
		uint32 current_weight = u->GetWeight();
 
		weight += current_weight;
 
		u->tcache.cached_slope_resistance = current_weight * 20 * _settings_game.vehicle.train_slope_steepness; //1% slope * slope steepness
 
		u->tcache.cached_slope_resistance = current_weight * u->GetSlopeSteepness();
 
	}
 

	
 
	/* store consist weight in cache */
0 comments (0 inline, 0 general)