summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-11-06 12:53:31 +0000
committerterkhen <terkhen@openttd.org>2010-11-06 12:53:31 +0000
commitc8a56f17f82be7d4a8e935fc514c86a313dc7d15 (patch)
tree4a2552f26ee887aa326721881fbbe6f62b8b48d2 /src/train_cmd.cpp
parent78d0a1cb1af68863e3e7bfed584f4a94ee46f611 (diff)
downloadopenttd-c8a56f17f82be7d4a8e935fc514c86a313dc7d15.tar.xz
(svn r21097) -Codechange: Unify cached max speed for all vehicle types.
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 2983f76f1..574972694 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -285,7 +285,7 @@ void Train::ConsistChanged(bool same_length)
}
/* store consist weight/max speed in cache */
- this->tcache.cached_max_speed = max_speed;
+ this->vcache.cached_max_speed = max_speed;
this->tcache.cached_tilt = train_can_tilt;
this->tcache.cached_max_curve_speed = this->GetCurveSpeedLimit();
@@ -1984,7 +1984,7 @@ static void HandleLocomotiveSmokeCloud(const Train *v)
* third of its maximum speed spectrum. Steam emission finally normalises at very close to train's maximum speed.
* REGULATION:
* - instead of 1, 4 / 2^smoke_amount (max. 2) is used to provide sufficient regulation to steam puffs' amount. */
- if (GB(v->tick_counter, 0, ((4 >> _settings_game.vehicle.smoke_amount) + ((u->cur_speed * 3) / u->tcache.cached_max_speed))) == 0) {
+ if (GB(v->tick_counter, 0, ((4 >> _settings_game.vehicle.smoke_amount) + ((u->cur_speed * 3) / u->vcache.cached_max_speed))) == 0) {
CreateEffectVehicleRel(v, x, y, 10, EV_STEAM_SMOKE);
sound = true;
}
@@ -2002,8 +2002,8 @@ static void HandleLocomotiveSmokeCloud(const Train *v)
* REGULATION:
* - up to which speed a diesel train is emitting smoke (with reduced/small setting only until 1/2 of max_speed),
* - in Chance16 - the last value is 512 / 2^smoke_amount (max. smoke when 128 = smoke_amount of 2). */
- if (u->cur_speed < (u->tcache.cached_max_speed >> (2 >> _settings_game.vehicle.smoke_amount)) &&
- Chance16((64 - ((u->cur_speed << 5) / u->tcache.cached_max_speed) + (32 >> (u->acc_cache.cached_power >> 10)) - (32 >> (u->acc_cache.cached_weight >> 9))), (512 >> _settings_game.vehicle.smoke_amount))) {
+ if (u->cur_speed < (u->vcache.cached_max_speed >> (2 >> _settings_game.vehicle.smoke_amount)) &&
+ Chance16((64 - ((u->cur_speed << 5) / u->vcache.cached_max_speed) + (32 >> (u->acc_cache.cached_power >> 10)) - (32 >> (u->acc_cache.cached_weight >> 9))), (512 >> _settings_game.vehicle.smoke_amount))) {
CreateEffectVehicleRel(v, 0, 0, 10, EV_DIESEL_SMOKE);
sound = true;
}
@@ -2017,7 +2017,7 @@ static void HandleLocomotiveSmokeCloud(const Train *v)
* REGULATION:
* - in Chance16 the last value is 360 / 2^smoke_amount (max. sparks when 90 = smoke_amount of 2). */
if (GB(v->tick_counter, 0, 2) == 0 &&
- Chance16((6 - ((u->cur_speed << 2) / u->tcache.cached_max_speed)), (360 >> _settings_game.vehicle.smoke_amount))) {
+ Chance16((6 - ((u->cur_speed << 2) / u->vcache.cached_max_speed)), (360 >> _settings_game.vehicle.smoke_amount))) {
CreateEffectVehicleRel(v, 0, 0, 10, EV_ELECTRIC_SPARK);
sound = true;
}