mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Added livery ID
This commit is contained in:
@@ -154,10 +154,11 @@ private:
|
||||
class SpawnGroundUnits : public Command
|
||||
{
|
||||
public:
|
||||
SpawnGroundUnits(string coalition, vector<string> unitTypes, vector<Coords> locations, bool immediate) :
|
||||
SpawnGroundUnits(string coalition, vector<string> unitTypes, vector<Coords> locations, vector<string> liveryIDs, bool immediate) :
|
||||
coalition(coalition),
|
||||
unitTypes(unitTypes),
|
||||
locations(locations),
|
||||
liveryIDs(liveryIDs),
|
||||
immediate(immediate)
|
||||
{
|
||||
priority = immediate? CommandPriority::IMMEDIATE: CommandPriority::LOW;
|
||||
@@ -169,6 +170,7 @@ private:
|
||||
const string coalition;
|
||||
const vector<string> unitTypes;
|
||||
const vector<Coords> locations;
|
||||
const vector<string> liveryIDs;
|
||||
const bool immediate;
|
||||
};
|
||||
|
||||
@@ -176,10 +178,11 @@ private:
|
||||
class SpawnNavyUnits : public Command
|
||||
{
|
||||
public:
|
||||
SpawnNavyUnits(string coalition, vector<string> unitTypes, vector<Coords> locations, bool immediate) :
|
||||
SpawnNavyUnits(string coalition, vector<string> unitTypes, vector<Coords> locations, vector<string> liveryIDs, bool immediate) :
|
||||
coalition(coalition),
|
||||
unitTypes(unitTypes),
|
||||
locations(locations),
|
||||
liveryIDs(liveryIDs),
|
||||
immediate(immediate)
|
||||
{
|
||||
priority = immediate ? CommandPriority::IMMEDIATE : CommandPriority::LOW;
|
||||
@@ -191,6 +194,7 @@ private:
|
||||
const string coalition;
|
||||
const vector<string> unitTypes;
|
||||
const vector<Coords> locations;
|
||||
const vector<string> liveryIDs;
|
||||
const bool immediate;
|
||||
};
|
||||
|
||||
@@ -198,11 +202,12 @@ private:
|
||||
class SpawnAircrafts : public Command
|
||||
{
|
||||
public:
|
||||
SpawnAircrafts(string coalition, vector<string> unitTypes, vector<Coords> locations, vector<string> loadouts, string airbaseName, bool immediate) :
|
||||
SpawnAircrafts(string coalition, vector<string> unitTypes, vector<Coords> locations, vector<string> loadouts, vector<string> liveryIDs, string airbaseName, bool immediate) :
|
||||
coalition(coalition),
|
||||
unitTypes(unitTypes),
|
||||
locations(locations),
|
||||
loadouts(loadouts),
|
||||
liveryIDs(liveryIDs),
|
||||
airbaseName(airbaseName),
|
||||
immediate(immediate)
|
||||
{
|
||||
@@ -216,6 +221,7 @@ private:
|
||||
const vector<string> unitTypes;
|
||||
const vector<Coords> locations;
|
||||
const vector<string> loadouts;
|
||||
const vector<string> liveryIDs;
|
||||
const string airbaseName;
|
||||
const bool immediate;
|
||||
};
|
||||
@@ -225,11 +231,12 @@ private:
|
||||
class SpawnHelicopters : public Command
|
||||
{
|
||||
public:
|
||||
SpawnHelicopters(string coalition, vector<string> unitTypes, vector<Coords> locations, vector<string> loadouts, string airbaseName, bool immediate) :
|
||||
SpawnHelicopters(string coalition, vector<string> unitTypes, vector<Coords> locations, vector<string> loadouts, vector<string> liveryIDs, string airbaseName, bool immediate) :
|
||||
coalition(coalition),
|
||||
unitTypes(unitTypes),
|
||||
locations(locations),
|
||||
loadouts(loadouts),
|
||||
liveryIDs(liveryIDs),
|
||||
airbaseName(airbaseName),
|
||||
immediate(immediate)
|
||||
{
|
||||
@@ -243,6 +250,7 @@ private:
|
||||
const vector<string> unitTypes;
|
||||
const vector<Coords> locations;
|
||||
const vector<string> loadouts;
|
||||
const vector<string> liveryIDs;
|
||||
const string airbaseName;
|
||||
const bool immediate;
|
||||
};
|
||||
|
||||
@@ -48,7 +48,8 @@ string SpawnGroundUnits::getString()
|
||||
unitsSS << "[" << i + 1 << "] = {"
|
||||
<< "unitType = " << "\"" << unitTypes[i] << "\"" << ", "
|
||||
<< "lat = " << locations[i].lat << ", "
|
||||
<< "lng = " << locations[i].lng << "},";
|
||||
<< "lng = " << locations[i].lng << ", "
|
||||
<< "liveryID = " << "\"" << liveryIDs[i] << "\"" << " }, ";
|
||||
}
|
||||
|
||||
std::ostringstream commandSS;
|
||||
@@ -72,7 +73,8 @@ string SpawnNavyUnits::getString()
|
||||
unitsSS << "[" << i + 1 << "] = {"
|
||||
<< "unitType = " << "\"" << unitTypes[i] << "\"" << ", "
|
||||
<< "lat = " << locations[i].lat << ", "
|
||||
<< "lng = " << locations[i].lng << "},";
|
||||
<< "lng = " << locations[i].lng << ", "
|
||||
<< "liveryID = " << "\"" << liveryIDs[i] << "\"" << " }, ";
|
||||
}
|
||||
|
||||
std::ostringstream commandSS;
|
||||
@@ -97,7 +99,8 @@ string SpawnAircrafts::getString()
|
||||
<< "lat = " << locations[i].lat << ", "
|
||||
<< "lng = " << locations[i].lng << ", "
|
||||
<< "alt = " << locations[i].alt << ", "
|
||||
<< "loadout = \"" << loadouts[i] << "\"" << "},";
|
||||
<< "loadout = \"" << loadouts[i] << "\"" << ", "
|
||||
<< "liveryID = " << "\"" << liveryIDs[i] << "\"" << " }, ";
|
||||
}
|
||||
|
||||
std::ostringstream commandSS;
|
||||
@@ -124,7 +127,8 @@ string SpawnHelicopters::getString()
|
||||
<< "lat = " << locations[i].lat << ", "
|
||||
<< "lng = " << locations[i].lng << ", "
|
||||
<< "alt = " << locations[i].alt << ", "
|
||||
<< "loadout = \"" << loadouts[i] << "\"" << "},";
|
||||
<< "loadout = \"" << loadouts[i] << "\"" << ", "
|
||||
<< "liveryID = " << "\"" << liveryIDs[i] << "\"" << " }, ";
|
||||
}
|
||||
|
||||
std::ostringstream commandSS;
|
||||
|
||||
@@ -186,6 +186,7 @@ void Scheduler::handleRequest(string key, json::value value, string username)
|
||||
vector<string> unitTypes;
|
||||
vector<Coords> locations;
|
||||
vector<string> loadouts;
|
||||
vector<string> liveryIDs;
|
||||
for (auto unit : value[L"units"].as_array()) {
|
||||
string unitType = to_string(unit[L"unitType"]);
|
||||
double lat = unit[L"location"][L"lat"].as_double();
|
||||
@@ -193,14 +194,16 @@ void Scheduler::handleRequest(string key, json::value value, string username)
|
||||
double alt = unit[L"altitude"].as_double();
|
||||
Coords location; location.lat = lat; location.lng = lng; location.alt = alt;
|
||||
string loadout = to_string(unit[L"loadout"]);
|
||||
string liveryID = to_string(unit[L"liveryID"]);
|
||||
|
||||
unitTypes.push_back(unitType);
|
||||
locations.push_back(location);
|
||||
loadouts.push_back(loadout);
|
||||
liveryIDs.push_back(liveryID);
|
||||
log(username + " spawned a " + coalition + " " + unitType, true);
|
||||
}
|
||||
|
||||
command = dynamic_cast<Command*>(new SpawnAircrafts(coalition, unitTypes, locations, loadouts, airbaseName, immediate));
|
||||
command = dynamic_cast<Command*>(new SpawnAircrafts(coalition, unitTypes, locations, liveryIDs, loadouts, airbaseName, immediate));
|
||||
}
|
||||
else if (key.compare("spawnHelicopters") == 0)
|
||||
{
|
||||
@@ -214,6 +217,7 @@ void Scheduler::handleRequest(string key, json::value value, string username)
|
||||
vector<string> unitTypes;
|
||||
vector<Coords> locations;
|
||||
vector<string> loadouts;
|
||||
vector<string> liveryIDs;
|
||||
for (auto unit : value[L"units"].as_array()) {
|
||||
string unitType = to_string(unit[L"unitType"]);
|
||||
double lat = unit[L"location"][L"lat"].as_double();
|
||||
@@ -221,14 +225,16 @@ void Scheduler::handleRequest(string key, json::value value, string username)
|
||||
double alt = unit[L"altitude"].as_double();
|
||||
Coords location; location.lat = lat; location.lng = lng; location.alt = alt;
|
||||
string loadout = to_string(unit[L"loadout"]);
|
||||
string liveryID = to_string(unit[L"liveryID"]);
|
||||
|
||||
unitTypes.push_back(unitType);
|
||||
locations.push_back(location);
|
||||
loadouts.push_back(loadout);
|
||||
liveryIDs.push_back(liveryID);
|
||||
log(username + " spawned a " + coalition + " " + unitType, true);
|
||||
}
|
||||
|
||||
command = dynamic_cast<Command*>(new SpawnHelicopters(coalition, unitTypes, locations, loadouts, airbaseName, immediate));
|
||||
command = dynamic_cast<Command*>(new SpawnHelicopters(coalition, unitTypes, locations, loadouts, liveryIDs, airbaseName, immediate));
|
||||
}
|
||||
else if (key.compare("spawnGroundUnits") == 0)
|
||||
{
|
||||
@@ -240,18 +246,21 @@ void Scheduler::handleRequest(string key, json::value value, string username)
|
||||
|
||||
vector<string> unitTypes;
|
||||
vector<Coords> locations;
|
||||
vector<string> liveryIDs;
|
||||
for (auto unit : value[L"units"].as_array()) {
|
||||
string unitType = to_string(unit[L"unitType"]);
|
||||
double lat = unit[L"location"][L"lat"].as_double();
|
||||
double lng = unit[L"location"][L"lng"].as_double();
|
||||
Coords location; location.lat = lat; location.lng = lng;
|
||||
string liveryID = to_string(unit[L"liveryID"]);
|
||||
|
||||
unitTypes.push_back(unitType);
|
||||
locations.push_back(location);
|
||||
liveryIDs.push_back(liveryID);
|
||||
log(username + " spawned a " + coalition + " " + unitType, true);
|
||||
}
|
||||
|
||||
command = dynamic_cast<Command*>(new SpawnGroundUnits(coalition, unitTypes, locations, immediate));
|
||||
command = dynamic_cast<Command*>(new SpawnGroundUnits(coalition, unitTypes, locations, liveryIDs, immediate));
|
||||
}
|
||||
else if (key.compare("spawnNavyUnits") == 0)
|
||||
{
|
||||
@@ -263,18 +272,21 @@ void Scheduler::handleRequest(string key, json::value value, string username)
|
||||
|
||||
vector<string> unitTypes;
|
||||
vector<Coords> locations;
|
||||
vector<string> liveryIDs;
|
||||
for (auto unit : value[L"units"].as_array()) {
|
||||
string unitType = to_string(unit[L"unitType"]);
|
||||
double lat = unit[L"location"][L"lat"].as_double();
|
||||
double lng = unit[L"location"][L"lng"].as_double();
|
||||
Coords location; location.lat = lat; location.lng = lng;
|
||||
string liveryID = to_string(unit[L"liveryID"]);
|
||||
|
||||
unitTypes.push_back(unitType);
|
||||
locations.push_back(location);
|
||||
liveryIDs.push_back(liveryID);
|
||||
log(username + " spawned a " + coalition + " " + unitType, true);
|
||||
}
|
||||
|
||||
command = dynamic_cast<Command*>(new SpawnNavyUnits(coalition, unitTypes, locations, immediate));
|
||||
command = dynamic_cast<Command*>(new SpawnNavyUnits(coalition, unitTypes, locations, liveryIDs, immediate));
|
||||
}
|
||||
else if (key.compare("attackUnit") == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user