mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
fix: Added setting of forced AlarmState
This commit is contained in:
parent
1622d663bb
commit
2b5b428237
@ -46,8 +46,8 @@ namespace ROE {
|
||||
};
|
||||
}
|
||||
|
||||
namespace ALARM_STATE {
|
||||
enum ALARM_STATEs {
|
||||
namespace AlarmState {
|
||||
enum AlarmStates {
|
||||
AUTO = 2,
|
||||
GREEN = 1,
|
||||
RED = 0,
|
||||
|
||||
@ -67,6 +67,7 @@ public:
|
||||
/********** Setters **********/
|
||||
virtual void setCategory(string newValue) { updateValue(category, newValue, DataIndex::category); }
|
||||
virtual void setAlive(bool newValue) { updateValue(alive, newValue, DataIndex::alive); }
|
||||
virtual void setAlarmState(unsigned char newValue, bool force = false);
|
||||
virtual void setHuman(bool newValue) { updateValue(human, newValue, DataIndex::human); }
|
||||
virtual void setControlled(bool newValue) { updateValue(controlled, newValue, DataIndex::controlled); }
|
||||
virtual void setCoalition(unsigned char newValue) { updateValue(coalition, newValue, DataIndex::coalition); }
|
||||
@ -98,7 +99,6 @@ public:
|
||||
virtual void setTargetID(unsigned int newValue) { updateValue(targetID, newValue, DataIndex::targetID); }
|
||||
virtual void setTargetPosition(Coords newValue) { updateValue(targetPosition, newValue, DataIndex::targetPosition); }
|
||||
virtual void setROE(unsigned char newValue, bool force = false);
|
||||
virtual void setAlarmState(unsigned char newValue, bool force = false);
|
||||
virtual void setReactionToThreat(unsigned char newValue, bool force = false);
|
||||
virtual void setEmissionsCountermeasures(unsigned char newValue, bool force = false);
|
||||
virtual void setTACAN(DataTypes::TACAN newValue, bool force = false);
|
||||
@ -206,7 +206,7 @@ protected:
|
||||
string callsign = "";
|
||||
string groupName = "";
|
||||
unsigned char state = State::NONE;
|
||||
unsigned char alarmState = ALARM_STATE::AUTO;
|
||||
unsigned char alarmState = AlarmState::AUTO;
|
||||
bool radarState = false;
|
||||
string task = "";
|
||||
bool hasTask = false;
|
||||
|
||||
@ -154,7 +154,7 @@ void Unit::update(json::value json, double dt)
|
||||
|
||||
void Unit::setDefaults(bool force)
|
||||
{
|
||||
setAlarmState(ALARM_STATE::AUTO, force);
|
||||
setAlarmState(AlarmState::AUTO, force);
|
||||
}
|
||||
|
||||
void Unit::runAILoop() {
|
||||
@ -476,9 +476,13 @@ void Unit::setROE(unsigned char newROE, bool force)
|
||||
|
||||
void Unit::setAlarmState(unsigned char newAlarmState, bool force)
|
||||
{
|
||||
if (alarmState != newAlarmState || force) {
|
||||
alarmState = newAlarmState;
|
||||
Command* command = dynamic_cast<Command*>(new SetOption(groupName, SetCommandType::ALARM_STATE, static_cast<unsigned int>(newAlarmState)));
|
||||
scheduler->appendCommand(command);
|
||||
triggerUpdate(DataIndex::alarmState);
|
||||
|
||||
triggerUpdate(DataIndex::alarmState);
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::setReactionToThreat(unsigned char newReactionToThreat, bool force)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user