|
VR-Engage
2.3
|
RTD maintains fuel mass in kilograms. This class maps the percentage of usable RTD fuel to the configured VR-Forces resource while an RTD vehicle is player controlled and detects external resource changes, such as refueling, that must be applied to RTD.
#include <vreRtdUtil.h>
Public Member Functions | |
| RtdFuelSynchronizer () | |
| void | synchronize (DtSimResource &fuelResource, RTD::CGFVehicleBase &rtdVehicle, bool fuelLevelsFrozen) |
| void | reset (RTD::CGFVehicleBase &rtdVehicle) |
Static Public Member Functions | |
| static constexpr double | fuelDensityKgPerLiter () |
Private Member Functions | |
| bool | isFuelAmountValid (double fuelAmount) |
| bool | isFuelCapacityValid (double fuelCapacity) |
| bool | doesFuelAmountDiffer (double fuelAmount) const |
| bool | setResourceFuelFromRtd (DtSimResource &fuelResource, RTD::CGFVehicleBase &rtdVehicle) |
| bool | setRtdFuelFromResource (DtSimResource &fuelResource, RTD::CGFVehicleBase &rtdVehicle) |
| void | updateFuelConsumptionFactor (RTD::CGFVehicleBase &rtdVehicle, bool fuelLevelsFrozen) |
Private Attributes | |
| double | myLastSynchronizedFuelAmount |
| double | myRtdFuelCapacity |
| double | myFuelConsumptionFactor |
| bool | myFuelLevelsFrozen |
| bool | myFuelSynchronizationErrorReported |
| vreRtd::RtdFuelSynchronizer::RtdFuelSynchronizer | ( | ) |
Constructs a fuel synchronizer with no prior resource state.
|
inlinestaticconstexpr |
Returns the jet-fuel conversion factor used by the VR-Forces aircraft models.
| void vreRtd::RtdFuelSynchronizer::synchronize | ( | DtSimResource & | fuelResource, |
| RTD::CGFVehicleBase & | rtdVehicle, | ||
| bool | fuelLevelsFrozen ) |
Synchronizes RTD vehicle fuel with a VR-Forces fuel resource.
On the first call after reset, determines RTD's usable fuel capacity and initializes RTD at the resource's current percentage. Subsequent calls copy RTD's remaining fuel percentage into the resource unless an external resource change is detected, in which case the resource percentage is applied to RTD. Call when RTD assumes control, during every RTD-controlled tick, and immediately before RTD relinquishes control.
| fuelResource | VR-Forces resource representing aircraft fuel. |
| rtdVehicle | RTD vehicle whose tank will be synchronized. |
| fuelLevelsFrozen | True when fuel consumption must be suspended. |
| void vreRtd::RtdFuelSynchronizer::reset | ( | RTD::CGFVehicleBase & | rtdVehicle | ) |
Forgets the last synchronized resource amount.
Call this after RTD relinquishes control or when the configured fuel resource is unavailable. A subsequently available resource will then determine RTD's capacity and initialize its fuel percentage. Restores the RTD fuel-consumption factor if it had been frozen.
| rtdVehicle | RTD vehicle whose fuel-consumption factor may be restored. |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Resource amount last written by the synchronizer.
|
private |
Usable RTD fuel capacity determined at the current control handoff, in kilograms.
|
private |
RTD fuel-consumption factor saved before freezing fuel use.
|
private |
True while RTD fuel consumption is disabled for frozen fuel levels.
|
private |
Prevents repeated warnings for a persistent invalid fuel amount.