Started to implement advanced settings

This commit is contained in:
Pax1601
2023-04-11 20:30:59 +02:00
parent 1f51d69126
commit 316261e01e
9 changed files with 137 additions and 84 deletions

View File

@@ -105,6 +105,12 @@ public:
void setTargetID(int newTargetID) { targetID = newTargetID; addMeasure(L"targetID", json::value(newTargetID));}
void setIsTanker(bool newIsTanker) { isTanker = newIsTanker; addMeasure(L"isTanker", json::value(newIsTanker));}
void setIsAWACS(bool newIsAWACS) { isAWACS = newIsAWACS; addMeasure(L"isAWACS", json::value(newIsAWACS));}
void setRadioOn(bool newRadioOn) { radioOn = newRadioOn; addMeasure(L"radioOn", json::value(newRadioOn)); }
void setTACANOn(bool newTACANOn) { TACANOn = newTACANOn; addMeasure(L"TACANOn", json::value(newTACANOn)); }
void setRadioFrequency(int newRadioFrequency) { radioFrequency = newRadioFrequency; addMeasure(L"radioFrequency", json::value(newRadioFrequency)); }
void setTACANChannel(int newTACANChannel) { TACANChannel = newTACANChannel; addMeasure(L"TACANChannel", json::value(newTACANChannel)); }
void setTACANXY(wstring newTACANXY) { TACANXY = newTACANXY; addMeasure(L"TACANXY", json::value(newTACANXY)); }
void setTACANCallsign(wstring newTACANCallsign) { TACANCallsign = newTACANCallsign; addMeasure(L"TACANCallsign", json::value(newTACANCallsign)); }
wstring getCurrentTask() { return currentTask; }
virtual double getTargetSpeed() { return targetSpeed; };
virtual double getTargetAltitude() { return targetAltitude; };
@@ -113,7 +119,13 @@ public:
int getTargetID() { return targetID; }
bool getIsTanker() { return isTanker; }
bool getIsAWACS() { return isAWACS; }
bool setRadioOn() { return radioOn; }
bool setTACANOn() { return TACANOn; }
int setRadioFrequency() { return radioFrequency; }
int setTACANChannel() { return TACANChannel; }
wstring setTACANXY() { return TACANXY; }
wstring setTACANCallsign() { return TACANCallsign; }
/********** Options data **********/
void setROE(wstring newROE);
void setReactionToThreat(wstring newReactionToThreat);
@@ -174,6 +186,12 @@ protected:
int targetID = NULL;
bool isTanker = false;
bool isAWACS = false;
bool radioOn = false;
bool TACANOn = false;
int radioFrequency = 0;
int TACANChannel = 0;
wstring TACANXY = "X";
wstring TACANCallsign = "TKR";
/********** Options data **********/
wstring ROE = L"";

View File

@@ -256,19 +256,20 @@ void Scheduler::handleRequest(wstring key, json::value value)
Unit* unit = unitsManager->getUnit(ID);
unit->setState(State::REFUEL);
}
else if (key.compare(L"setIsTanker") == 0)
else if (key.compare(L"setAdvancedOptions") == 0)
{
int ID = value[L"ID"].as_integer();
bool state = value[L"state"].as_bool();
Unit* unit = unitsManager->getUnit(ID);
unit->setIsTanker(state);
}
else if (key.compare(L"setIsAWACS") == 0)
{
int ID = value[L"ID"].as_integer();
bool state = value[L"state"].as_bool();
Unit* unit = unitsManager->getUnit(ID);
unit->setIsAWACS(state);
if (unit != nullptr)
{
unit->setIsTanker(value[L"isTanker"].as_bool());
unit->setIsAWACS(value[L"isAWACS"].as_bool());
unit->setRadioOn(value[L"radioOn"].as_bool());
unit->setTACANOn(value[L"TACANOn"].as_bool());
unit->setTACANCallsign(value[L"TACANCallsign"].as_string());
unit->setTACANChannel(value[L"TACANChannel"].as_number().to_int32());
unit->setTACANXY(value[L"TACANXY"].as_string());
}
}
else
{