MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetEngineProperty

Function GetEngineProperty

src/newgrf_engine.cpp:1230–1243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1228
1229
1230int GetEngineProperty(EngineID engine, PropertyID property, int orig_value, const Vehicle *v, bool is_signed)
1231{
1232 uint16_t callback = GetVehicleCallback(CBID_VEHICLE_MODIFY_PROPERTY, property, 0, engine, v);
1233 if (callback != CALLBACK_FAILED) {
1234 if (is_signed) {
1235 /* Sign extend 15 bit integer */
1236 return static_cast<int16_t>(callback << 1) / 2;
1237 } else {
1238 return callback;
1239 }
1240 }
1241
1242 return orig_value;
1243}
1244
1245/**
1246 * Test for vehicle build probability type.

Callers 9

GetVehiclePropertyFunction · 0.85
DetermineCapacityMethod · 0.85
GetRunningCostMethod · 0.85
GetCostMethod · 0.85
GetDisplayMaxSpeedMethod · 0.85
GetPowerMethod · 0.85
GetDisplayWeightMethod · 0.85
GetRangeMethod · 0.85

Calls 1

GetVehicleCallbackFunction · 0.85

Tested by

no test coverage detected