diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/train.h | 9 | ||||
-rw-r--r-- | src/train_cmd.cpp | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/train.h b/src/train.h index f61febf0c..d7b583ee3 100644 --- a/src/train.h +++ b/src/train.h @@ -494,6 +494,15 @@ protected: /* These functions should not be called outside acceleration code. */ { 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) diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index a1c9d51d2..f2c2e4d37 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -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 */ |