(svn r23174) -Codechange: Deduplicate code between GetEngineProperty() and GetVehicleProperty().

This commit is contained in:
frosch
2011-11-09 16:39:34 +00:00
parent 026317bb44
commit 50b480b959
3 changed files with 10 additions and 13 deletions

View File

@@ -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;