mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Added unit country selection
This commit is contained in:
@@ -195,10 +195,11 @@ private:
|
||||
class SpawnAircrafts : public Command
|
||||
{
|
||||
public:
|
||||
SpawnAircrafts(string coalition, vector<SpawnOptions> spawnOptions, string airbaseName, bool immediate) :
|
||||
SpawnAircrafts(string coalition, vector<SpawnOptions> spawnOptions, string airbaseName, string country, bool immediate) :
|
||||
coalition(coalition),
|
||||
spawnOptions(spawnOptions),
|
||||
airbaseName(airbaseName),
|
||||
country(country),
|
||||
immediate(immediate)
|
||||
{
|
||||
priority = immediate ? CommandPriority::IMMEDIATE : CommandPriority::LOW;
|
||||
@@ -210,6 +211,7 @@ private:
|
||||
const string coalition;
|
||||
const vector<SpawnOptions> spawnOptions;
|
||||
const string airbaseName;
|
||||
const string country;
|
||||
const bool immediate;
|
||||
};
|
||||
|
||||
@@ -218,10 +220,11 @@ private:
|
||||
class SpawnHelicopters : public Command
|
||||
{
|
||||
public:
|
||||
SpawnHelicopters(string coalition, vector<SpawnOptions> spawnOptions, string airbaseName, bool immediate) :
|
||||
SpawnHelicopters(string coalition, vector<SpawnOptions> spawnOptions, string airbaseName, string country, bool immediate) :
|
||||
coalition(coalition),
|
||||
spawnOptions(spawnOptions),
|
||||
airbaseName(airbaseName),
|
||||
country(country),
|
||||
immediate(immediate)
|
||||
{
|
||||
priority = immediate ? CommandPriority::IMMEDIATE : CommandPriority::LOW;
|
||||
@@ -233,6 +236,7 @@ private:
|
||||
const string coalition;
|
||||
const vector<SpawnOptions> spawnOptions;
|
||||
const string airbaseName;
|
||||
const string country;
|
||||
const bool immediate;
|
||||
};
|
||||
|
||||
|
||||
@@ -103,6 +103,7 @@ string SpawnAircrafts::getString()
|
||||
<< "category = " << "\"" << "Aircraft" << "\"" << ", "
|
||||
<< "coalition = " << "\"" << coalition << "\"" << ", "
|
||||
<< "airbaseName = \"" << airbaseName << "\", "
|
||||
<< "country = \"" << country << "\", "
|
||||
<< "units = " << "{" << unitsSS.str() << "}" << "}";
|
||||
return commandSS.str();
|
||||
}
|
||||
@@ -129,6 +130,7 @@ string SpawnHelicopters::getString()
|
||||
<< "category = " << "\"" << "Helicopter" << "\"" << ", "
|
||||
<< "coalition = " << "\"" << coalition << "\"" << ", "
|
||||
<< "airbaseName = \"" << airbaseName << "\", "
|
||||
<< "country = \"" << country << "\", "
|
||||
<< "units = " << "{" << unitsSS.str() << "}" << "}";
|
||||
return commandSS.str();
|
||||
}
|
||||
|
||||
@@ -179,6 +179,7 @@ void Scheduler::handleRequest(string key, json::value value, string username)
|
||||
bool immediate = value[L"immediate"].as_bool();
|
||||
string coalition = to_string(value[L"coalition"]);
|
||||
string airbaseName = to_string(value[L"airbaseName"]);
|
||||
string country = to_string(value[L"country"]);
|
||||
|
||||
int spawnPoints = value[L"spawnPoints"].as_number().to_int32();
|
||||
if (!checkSpawnPoints(spawnPoints, coalition)) return;
|
||||
@@ -197,13 +198,14 @@ void Scheduler::handleRequest(string key, json::value value, string username)
|
||||
log(username + " spawned a " + coalition + " " + unitType, true);
|
||||
}
|
||||
|
||||
command = dynamic_cast<Command*>(new SpawnAircrafts(coalition, spawnOptions, airbaseName, immediate));
|
||||
command = dynamic_cast<Command*>(new SpawnAircrafts(coalition, spawnOptions, airbaseName, country, immediate));
|
||||
}
|
||||
else if (key.compare("spawnHelicopters") == 0)
|
||||
{
|
||||
bool immediate = value[L"immediate"].as_bool();
|
||||
string coalition = to_string(value[L"coalition"]);
|
||||
string airbaseName = to_string(value[L"airbaseName"]);
|
||||
string country = to_string(value[L"country"]);
|
||||
|
||||
int spawnPoints = value[L"spawnPoints"].as_number().to_int32();
|
||||
if (!checkSpawnPoints(spawnPoints, coalition)) return;
|
||||
@@ -222,7 +224,7 @@ void Scheduler::handleRequest(string key, json::value value, string username)
|
||||
log(username + " spawned a " + coalition + " " + unitType, true);
|
||||
}
|
||||
|
||||
command = dynamic_cast<Command*>(new SpawnHelicopters(coalition, spawnOptions, airbaseName, immediate));
|
||||
command = dynamic_cast<Command*>(new SpawnHelicopters(coalition, spawnOptions, airbaseName, country, immediate));
|
||||
}
|
||||
else if (key.compare("spawnGroundUnits") == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user