Feat: added backend ability to set spawn heading

This commit is contained in:
Davide Passoni
2025-01-24 15:01:25 +01:00
parent d1d4116e66
commit 96415fd087
8 changed files with 40 additions and 5 deletions

View File

@@ -202,12 +202,16 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
double lat = unit[L"location"][L"lat"].as_double();
double lng = unit[L"location"][L"lng"].as_double();
double alt = unit[L"altitude"].as_double();
double heading = 0;
if (unit.has_number_field(L"heading"))
heading = unit[L"heading"].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"]);
string skill = to_string(unit[L"skill"]);
spawnOptions.push_back({unitType, location, loadout, skill, liveryID});
spawnOptions.push_back({unitType, location, loadout, skill, liveryID, heading});
log(username + " spawned a " + coalition + " " + unitType , true);
}
@@ -231,11 +235,15 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
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();
double heading = 0;
if (unit.has_number_field(L"heading"))
heading = unit[L"heading"].as_double();
Coords location; location.lat = lat; location.lng = lng;
string liveryID = to_string(unit[L"liveryID"]);
string skill = to_string(unit[L"skill"]);
spawnOptions.push_back({ unitType, location, "", skill, liveryID});
spawnOptions.push_back({ unitType, location, "", skill, liveryID, heading});
log(username + " spawned a " + coalition + " " + unitType, true);
}