mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
feat: read enginepower from SimConnect
This commit is contained in:
@@ -53,7 +53,7 @@ namespace swift::misc::aviation
|
||||
|
||||
private:
|
||||
int m_number = 1;
|
||||
bool m_on = true;
|
||||
bool m_on = false;
|
||||
double m_power = 0.0;
|
||||
|
||||
SWIFT_METACLASS(
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace swift::misc::aviation
|
||||
}
|
||||
}
|
||||
|
||||
void CAircraftEngineList::initEngines(int engineNumber, bool on, int enginePercentage)
|
||||
void CAircraftEngineList::initEngines(int engineNumber, bool on, double enginePercentage)
|
||||
{
|
||||
this->clear();
|
||||
for (int e = 0; e < engineNumber; e++)
|
||||
@@ -73,7 +73,7 @@ namespace swift::misc::aviation
|
||||
}
|
||||
}
|
||||
|
||||
void CAircraftEngineList::setEnginePower(int engineNumber, int percentage)
|
||||
void CAircraftEngineList::setEnginePower(int engineNumber, double percentage)
|
||||
{
|
||||
Q_ASSERT(engineNumber > 0);
|
||||
for (CAircraftEngine &engine : *this)
|
||||
@@ -86,7 +86,7 @@ namespace swift::misc::aviation
|
||||
}
|
||||
}
|
||||
|
||||
int CAircraftEngineList::getEnginePower(int engineNumber) const
|
||||
double CAircraftEngineList::getEnginePower(int engineNumber) const
|
||||
{
|
||||
Q_ASSERT(engineNumber > 0);
|
||||
return this->getEngine(engineNumber).getEnginePower();
|
||||
|
||||
@@ -57,20 +57,23 @@ namespace swift::misc::aviation
|
||||
void setEngines(const CAircraftEngine &engine, int engineNumber);
|
||||
|
||||
//! Init some engines
|
||||
void initEngines(int engineNumber, bool on, int enginePercentage);
|
||||
void initEngines(int engineNumber, bool on, double enginePercentage);
|
||||
|
||||
//! Is any engine on?
|
||||
bool isAnyEngineOn() const;
|
||||
|
||||
void setEnginePower(int engineNumber, int percentage);
|
||||
void setEnginePower(int engineNumber, double percentage);
|
||||
|
||||
int getEnginePower(int engineNumber) const;
|
||||
double getEnginePower(int engineNumber) const;
|
||||
|
||||
//! \copydoc swift::misc::mixin::JsonByMetaClass::toJson
|
||||
QJsonObject toJson() const;
|
||||
|
||||
//! \copydoc swift::misc::mixin::JsonByMetaClass::convertFromJson
|
||||
void convertFromJson(const QJsonObject &json);
|
||||
|
||||
//! Get engine count
|
||||
int getEngineCount() const { return this->size(); }
|
||||
};
|
||||
} // namespace swift::misc::aviation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user