Added option for ground units to change skill

This commit is contained in:
Stefan Arsic
2024-01-12 22:33:43 +01:00
parent 9942ff476b
commit 497f718e4b
5 changed files with 28 additions and 16 deletions

View File

@@ -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();
}

View File

@@ -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)