mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Added option for ground units to change skill
This commit is contained in:
@@ -165,11 +165,12 @@ private:
|
||||
class SpawnGroundUnits : public Command
|
||||
{
|
||||
public:
|
||||
SpawnGroundUnits(string coalition, vector<SpawnOptions> spawnOptions, string country, bool immediate, function<void(void)> callback = [](){}) :
|
||||
SpawnGroundUnits(string coalition, vector<SpawnOptions> spawnOptions, string country, string skill, bool immediate, function<void(void)> callback = [](){}) :
|
||||
Command(callback),
|
||||
coalition(coalition),
|
||||
spawnOptions(spawnOptions),
|
||||
country(country),
|
||||
skill(skill),
|
||||
immediate(immediate)
|
||||
{
|
||||
priority = immediate? CommandPriority::IMMEDIATE: CommandPriority::LOW;
|
||||
@@ -181,6 +182,7 @@ private:
|
||||
const string coalition;
|
||||
const vector<SpawnOptions> spawnOptions;
|
||||
const string country;
|
||||
const string skill;
|
||||
const bool immediate;
|
||||
};
|
||||
|
||||
@@ -188,11 +190,12 @@ private:
|
||||
class SpawnNavyUnits : public Command
|
||||
{
|
||||
public:
|
||||
SpawnNavyUnits(string coalition, vector<SpawnOptions> spawnOptions, string country, bool immediate, function<void(void)> callback = [](){}) :
|
||||
SpawnNavyUnits(string coalition, vector<SpawnOptions> spawnOptions, string country, string skill, bool immediate, function<void(void)> callback = [](){}) :
|
||||
Command(callback),
|
||||
coalition(coalition),
|
||||
spawnOptions(spawnOptions),
|
||||
country(country),
|
||||
skill(skill),
|
||||
immediate(immediate)
|
||||
{
|
||||
priority = immediate ? CommandPriority::IMMEDIATE : CommandPriority::LOW;
|
||||
@@ -204,6 +207,7 @@ private:
|
||||
const string coalition;
|
||||
const vector<SpawnOptions> spawnOptions;
|
||||
const string country;
|
||||
const string skill;
|
||||
const bool immediate;
|
||||
};
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ string SpawnGroundUnits::getString()
|
||||
<< "unitType = " << "\"" << spawnOptions[i].unitType << "\"" << ", "
|
||||
<< "lat = " << spawnOptions[i].location.lat << ", "
|
||||
<< "lng = " << spawnOptions[i].location.lng << ", "
|
||||
<< "skill = \"" << spawnOptions[i].skill << "\"" << ", "
|
||||
<< "liveryID = " << "\"" << spawnOptions[i].liveryID << "\"" << " }, ";
|
||||
}
|
||||
|
||||
@@ -55,6 +56,7 @@ string SpawnGroundUnits::getString()
|
||||
<< "category = " << "\"" << "GroundUnit" << "\"" << ", "
|
||||
<< "coalition = " << "\"" << coalition << "\"" << ", "
|
||||
<< "country = \"" << country << "\", "
|
||||
<< "skill = \"" << skill << "\", "
|
||||
<< "units = " << "{" << unitsSS.str() << "}" << "}";
|
||||
return commandSS.str();
|
||||
}
|
||||
@@ -70,6 +72,7 @@ string SpawnNavyUnits::getString()
|
||||
<< "unitType = " << "\"" << spawnOptions[i].unitType << "\"" << ", "
|
||||
<< "lat = " << spawnOptions[i].location.lat << ", "
|
||||
<< "lng = " << spawnOptions[i].location.lng << ", "
|
||||
<< "skill = \"" << spawnOptions[i].skill << "\"" << ", "
|
||||
<< "liveryID = " << "\"" << spawnOptions[i].liveryID << "\"" << " }, ";
|
||||
}
|
||||
|
||||
@@ -79,6 +82,7 @@ string SpawnNavyUnits::getString()
|
||||
<< "category = " << "\"" << "NavyUnit" << "\"" << ", "
|
||||
<< "coalition = " << "\"" << coalition << "\"" << ", "
|
||||
<< "country = \"" << country << "\", "
|
||||
<< "skill = \"" << skill << "\", "
|
||||
<< "units = " << "{" << unitsSS.str() << "}" << "}";
|
||||
return commandSS.str();
|
||||
}
|
||||
|
||||
@@ -223,6 +223,7 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
|
||||
bool immediate = value[L"immediate"].as_bool();
|
||||
string coalition = to_string(value[L"coalition"]);
|
||||
string country = to_string(value[L"country"]);
|
||||
string skill = "";
|
||||
|
||||
int spawnPoints = value[L"spawnPoints"].as_number().to_int32();
|
||||
if (!checkSpawnPoints(spawnPoints, coalition)) return;
|
||||
@@ -234,15 +235,16 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
|
||||
double lng = unit[L"location"][L"lng"].as_double();
|
||||
Coords location; location.lat = lat; location.lng = lng;
|
||||
string liveryID = to_string(unit[L"liveryID"]);
|
||||
skill = to_string(unit[L"skill"]);
|
||||
|
||||
spawnOptions.push_back({ unitType, location, "", liveryID });
|
||||
log(username + " spawned a " + coalition + " " + unitType, true);
|
||||
}
|
||||
|
||||
if (key.compare("spawnGroundUnits") == 0)
|
||||
command = dynamic_cast<Command*>(new SpawnGroundUnits(coalition, spawnOptions, country, immediate));
|
||||
command = dynamic_cast<Command*>(new SpawnGroundUnits(coalition, spawnOptions, country, skill, immediate));
|
||||
else
|
||||
command = dynamic_cast<Command*>(new SpawnNavyUnits(coalition, spawnOptions, country, immediate));
|
||||
command = dynamic_cast<Command*>(new SpawnNavyUnits(coalition, spawnOptions, country, skill, immediate));
|
||||
}
|
||||
/************************/
|
||||
else if (key.compare("attackUnit") == 0)
|
||||
|
||||
Reference in New Issue
Block a user