mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
fix(unit): unit and group id are now of the correct type; added DCS unitId to dead units
This commit is contained in:
@@ -75,8 +75,8 @@ public:
|
|||||||
virtual void setName(string newValue) { updateValue(name, newValue, DataIndex::name); }
|
virtual void setName(string newValue) { updateValue(name, newValue, DataIndex::name); }
|
||||||
virtual void setUnitName(string newValue) { updateValue(unitName, newValue, DataIndex::unitName); }
|
virtual void setUnitName(string newValue) { updateValue(unitName, newValue, DataIndex::unitName); }
|
||||||
virtual void setCallsign(string newValue) { updateValue(callsign, newValue, DataIndex::callsign); }
|
virtual void setCallsign(string newValue) { updateValue(callsign, newValue, DataIndex::callsign); }
|
||||||
virtual void setUnitID(unsigned char newValue) { updateValue(unitID, newValue, DataIndex::unitID); }
|
virtual void setUnitID(unsigned int newValue) { updateValue(unitID, newValue, DataIndex::unitID); }
|
||||||
virtual void setGroupID(unsigned char newValue) { updateValue(groupID, newValue, DataIndex::groupID); }
|
virtual void setGroupID(unsigned int newValue) { updateValue(groupID, newValue, DataIndex::groupID); }
|
||||||
virtual void setGroupName(string newValue) { updateValue(groupName, newValue, DataIndex::groupName); }
|
virtual void setGroupName(string newValue) { updateValue(groupName, newValue, DataIndex::groupName); }
|
||||||
virtual void setState(unsigned char newValue) { updateValue(state, newValue, DataIndex::state); };
|
virtual void setState(unsigned char newValue) { updateValue(state, newValue, DataIndex::state); };
|
||||||
virtual void setTask(string newValue) { updateValue(task, newValue, DataIndex::task); }
|
virtual void setTask(string newValue) { updateValue(task, newValue, DataIndex::task); }
|
||||||
@@ -143,8 +143,8 @@ public:
|
|||||||
virtual string getCallsign() { return callsign; }
|
virtual string getCallsign() { return callsign; }
|
||||||
virtual string getUnitName() { return unitName; }
|
virtual string getUnitName() { return unitName; }
|
||||||
virtual string getGroupName() { return groupName; }
|
virtual string getGroupName() { return groupName; }
|
||||||
virtual unsigned char getUnitID() { return unitID; }
|
virtual unsigned int getUnitID() { return unitID; }
|
||||||
virtual unsigned char getGroupID() { return groupID; }
|
virtual unsigned int getGroupID() { return groupID; }
|
||||||
virtual unsigned char getState() { return state; }
|
virtual unsigned char getState() { return state; }
|
||||||
virtual string getTask() { return task; }
|
virtual string getTask() { return task; }
|
||||||
virtual bool getHasTask() { return hasTask; }
|
virtual bool getHasTask() { return hasTask; }
|
||||||
@@ -210,8 +210,8 @@ protected:
|
|||||||
string name = "";
|
string name = "";
|
||||||
string unitName = "";
|
string unitName = "";
|
||||||
string callsign = "";
|
string callsign = "";
|
||||||
unsigned char unitID = NULL;
|
unsigned int unitID = NULL;
|
||||||
unsigned char groupID = NULL;
|
unsigned int groupID = NULL;
|
||||||
string groupName = "";
|
string groupName = "";
|
||||||
unsigned char state = State::NONE;
|
unsigned char state = State::NONE;
|
||||||
unsigned char alarmState = AlarmState::AUTO;
|
unsigned char alarmState = AlarmState::AUTO;
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ void Unit::update(json::value json, double dt)
|
|||||||
setUnitName(to_string(json[L"unitName"]));
|
setUnitName(to_string(json[L"unitName"]));
|
||||||
|
|
||||||
if (json.has_number_field(L"groupID"))
|
if (json.has_number_field(L"groupID"))
|
||||||
setGroupID(json[L"groupID"].as_number().to_int32());
|
setGroupID(json[L"groupID"].as_number().to_uint32());
|
||||||
if (json.has_number_field(L"unitID"))
|
if (json.has_number_field(L"unitID"))
|
||||||
setUnitID(json[L"unitID"].as_number().to_int32());
|
setUnitID(json[L"unitID"].as_number().to_uint32());
|
||||||
|
|
||||||
if (json.has_string_field(L"groupName"))
|
if (json.has_string_field(L"groupName"))
|
||||||
setGroupName(to_string(json[L"groupName"]));
|
setGroupName(to_string(json[L"groupName"]));
|
||||||
@@ -255,6 +255,8 @@ void Unit::getData(stringstream& ss, unsigned long long time)
|
|||||||
appendString(ss, datumIndex, category);
|
appendString(ss, datumIndex, category);
|
||||||
datumIndex = DataIndex::alive;
|
datumIndex = DataIndex::alive;
|
||||||
appendNumeric(ss, datumIndex, alive);
|
appendNumeric(ss, datumIndex, alive);
|
||||||
|
datumIndex = DataIndex::unitID;
|
||||||
|
appendNumeric(ss, datumIndex, unitID);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (unsigned char datumIndex = DataIndex::startOfData + 1; datumIndex < DataIndex::lastIndex; datumIndex++)
|
for (unsigned char datumIndex = DataIndex::startOfData + 1; datumIndex < DataIndex::lastIndex; datumIndex++)
|
||||||
|
|||||||
@@ -618,11 +618,11 @@ export abstract class Unit extends CustomMarker {
|
|||||||
this.#callsign = dataExtractor.extractString();
|
this.#callsign = dataExtractor.extractString();
|
||||||
break;
|
break;
|
||||||
case DataIndexes.unitID:
|
case DataIndexes.unitID:
|
||||||
this.#unitID = dataExtractor.extractUInt8();
|
this.#unitID = dataExtractor.extractUInt32();
|
||||||
updateMarker = true;
|
updateMarker = true;
|
||||||
break;
|
break;
|
||||||
case DataIndexes.groupID:
|
case DataIndexes.groupID:
|
||||||
this.#groupID = dataExtractor.extractUInt8();
|
this.#groupID = dataExtractor.extractUInt32();
|
||||||
updateMarker = true;
|
updateMarker = true;
|
||||||
break;
|
break;
|
||||||
case DataIndexes.groupName:
|
case DataIndexes.groupName:
|
||||||
|
|||||||
Reference in New Issue
Block a user