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

Function GetVehicleCallback

src/newgrf_engine.cpp:1198–1202  ·  view source on GitHub ↗

* Evaluate a newgrf callback for vehicles * @param callback The callback to evaluate * @param param1 First parameter of the callback * @param param2 Second parameter of the callback * @param engine Engine type of the vehicle to evaluate the callback for * @param v The vehicle to evaluate the callback for, or nullptr if it doesn't exist yet * @param[out] regs100 Additional result

Source from the content-addressed store, hash-verified

1196 * @return The value the callback returned, or CALLBACK_FAILED if it failed
1197 */
1198uint16_t GetVehicleCallback(CallbackID callback, uint32_t param1, uint32_t param2, EngineID engine, const Vehicle *v, std::span<int32_t> regs100)
1199{
1200 VehicleResolverObject object(engine, v, VehicleResolverObject::WO_UNCACHED, false, callback, param1, param2);
1201 return object.ResolveCallback(regs100);
1202}
1203
1204/**
1205 * Evaluate a newgrf callback for vehicles with a different vehicle for parent scope.

Callers 15

CalculateRefitMasksFunction · 0.85
FormatStringFunction · 0.85
GetNextArticulatedPartFunction · 0.85
PlayVehicleSoundFunction · 0.85
ConsistChangedMethod · 0.85
RunEconomyVehicleDayProcFunction · 0.85
GetEngineColourMapFunction · 0.85
UpdateVisualEffectMethod · 0.85
GetRefitCostFactorFunction · 0.85
CmdStartStopVehicleFunction · 0.85
GetRoadVehLengthFunction · 0.85

Calls 1

ResolveCallbackMethod · 0.80

Tested by 1