diff options
author | frosch <frosch@openttd.org> | 2011-11-09 16:39:34 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2011-11-09 16:39:34 +0000 |
commit | 50b480b9596f18babc550e68cd3608ee6342e82c (patch) | |
tree | 9edd0060e11962728985c9c5a7834bed08d127e4 /src/newgrf_engine.cpp | |
parent | 026317bb444c1165ba96904f8e5a300b1a657539 (diff) | |
download | openttd-50b480b9596f18babc550e68cd3608ee6342e82c.tar.xz |
(svn r23174) -Codechange: Deduplicate code between GetEngineProperty() and GetVehicleProperty().
Diffstat (limited to 'src/newgrf_engine.cpp')
-rw-r--r-- | src/newgrf_engine.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index f13543f08..69cbe4a56 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -1079,16 +1079,13 @@ uint16 GetVehicleCallbackParent(CallbackID callback, uint32 param1, uint32 param /* Callback 36 handlers */ uint GetVehicleProperty(const Vehicle *v, PropertyID property, uint orig_value) { - uint16 callback = GetVehicleCallback(CBID_VEHICLE_MODIFY_PROPERTY, property, 0, v->engine_type, v); - if (callback != CALLBACK_FAILED) return callback; - - return orig_value; + return GetEngineProperty(v->engine_type, property, orig_value, v); } -uint GetEngineProperty(EngineID engine, PropertyID property, uint orig_value) +uint GetEngineProperty(EngineID engine, PropertyID property, uint orig_value, const Vehicle *v) { - uint16 callback = GetVehicleCallback(CBID_VEHICLE_MODIFY_PROPERTY, property, 0, engine, NULL); + uint16 callback = GetVehicleCallback(CBID_VEHICLE_MODIFY_PROPERTY, property, 0, engine, v); if (callback != CALLBACK_FAILED) return callback; return orig_value; |