mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Merge pull request #948 from Pax1601/bugfix/v1/wrong-unit-on-reconnection
Bugfix/v1/wrong unit on reconnection
This commit is contained in:
commit
a6e28e9064
@ -19,12 +19,12 @@ public:
|
||||
~Unit();
|
||||
|
||||
/********** Methods **********/
|
||||
void initialize(json::value json);
|
||||
virtual void initialize(json::value json) final;
|
||||
virtual void setDefaults(bool force = false);
|
||||
|
||||
void runAILoop();
|
||||
|
||||
void update(json::value json, double dt);
|
||||
virtual void update(json::value json, double dt) final;
|
||||
void refreshLeaderData(unsigned long long time);
|
||||
|
||||
unsigned int getID() { return ID; }
|
||||
|
||||
@ -27,6 +27,13 @@ Unit::~Unit()
|
||||
}
|
||||
|
||||
void Unit::initialize(json::value json)
|
||||
{
|
||||
update(json, 0);
|
||||
setDefaults();
|
||||
}
|
||||
|
||||
|
||||
void Unit::update(json::value json, double dt)
|
||||
{
|
||||
if (json.has_string_field(L"name"))
|
||||
setName(to_string(json[L"name"]));
|
||||
@ -42,21 +49,13 @@ void Unit::initialize(json::value json)
|
||||
|
||||
if (json.has_number_field(L"coalitionID"))
|
||||
setCoalition(json[L"coalitionID"].as_number().to_int32());
|
||||
|
||||
//if (json.has_number_field(L"Country"))
|
||||
// setCountry(json[L"Country"].as_number().to_int32());
|
||||
|
||||
|
||||
/* All units which contain the name "Olympus" are automatically under AI control */
|
||||
if (getUnitName().find("Olympus") != string::npos)
|
||||
setControlled(true);
|
||||
|
||||
update(json, 0);
|
||||
setDefaults();
|
||||
}
|
||||
|
||||
|
||||
void Unit::update(json::value json, double dt)
|
||||
{
|
||||
if (json.has_object_field(L"position"))
|
||||
{
|
||||
setPosition({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user