diff options
author | smatz <smatz@openttd.org> | 2008-03-15 19:24:13 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-03-15 19:24:13 +0000 |
commit | 89e9bbfa98e5dd01a7624e2937a60a2999c3c289 (patch) | |
tree | 3be73f8fde1f8198c15d4883d46aacd6a2b311de /src | |
parent | bfae49aeb2affaf239f7e9b04b6b7e226830e962 (diff) | |
download | openttd-89e9bbfa98e5dd01a7624e2937a60a2999c3c289.tar.xz |
(svn r12369) -Fix (r1681): reset train speed limits when _patches.realistic_acceleration changes
Diffstat (limited to 'src')
-rw-r--r-- | src/settings.cpp | 13 | ||||
-rw-r--r-- | src/train.h | 1 | ||||
-rw-r--r-- | src/train_cmd.cpp | 2 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/settings.cpp b/src/settings.cpp index 7a257bf64..e64b5cbcb 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -1195,6 +1195,17 @@ static int32 EngineRenewMoneyUpdate(int32 p1) return 0; } +static int32 RealisticAccelerationChanged(int32 p1) +{ + Vehicle *v; + + FOR_ALL_VEHICLES(v) { + if (v->type == VEH_TRAIN && IsFrontEngine(v)) UpdateTrainAcceleration(v); + } + + return 0; +} + /** * Check for right TownLayout usage in editor mode. * The No Road mode is not desirable since towns have to be @@ -1395,7 +1406,7 @@ const SettingDesc _patch_settings[] = { /***************************************************************************/ /* Vehicle section of the GUI-configure patches window */ - SDT_BOOL(Patches, realistic_acceleration, 0, 0, false, STR_CONFIG_PATCHES_REALISTICACCEL, NULL), + SDT_BOOL(Patches, realistic_acceleration, 0, 0, false, STR_CONFIG_PATCHES_REALISTICACCEL, RealisticAccelerationChanged), SDT_BOOL(Patches, forbid_90_deg, 0, 0, false, STR_CONFIG_PATCHES_FORBID_90_DEG, NULL), SDT_BOOL(Patches, mammoth_trains, 0,NN, true, STR_CONFIG_PATCHES_MAMMOTHTRAINS, NULL), SDT_BOOL(Patches, gotodepot, 0, 0, true, STR_CONFIG_PATCHES_GOTODEPOT, NULL), diff --git a/src/train.h b/src/train.h index 816b7b77c..677f66915 100644 --- a/src/train.h +++ b/src/train.h @@ -274,6 +274,7 @@ byte FreightWagonMult(CargoID cargo); int CheckTrainInDepot(const Vehicle *v, bool needs_to_be_stopped); int CheckTrainStoppedInDepot(const Vehicle *v); +void UpdateTrainAcceleration(Vehicle* v); /** * This class 'wraps' Vehicle; you do not actually instantiate this class. diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 5a830608d..4246f0c9e 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -467,7 +467,7 @@ static int GetTrainAcceleration(Vehicle *v, bool mode) } } -static void UpdateTrainAcceleration(Vehicle* v) +void UpdateTrainAcceleration(Vehicle* v) { assert(IsFrontEngine(v)); |