Fixed unit payloads, spread update load from mission update

This commit is contained in:
Pax1601
2023-02-14 22:48:17 +01:00
parent 0564b4b01f
commit 433b4bdf56
13 changed files with 1349 additions and 60 deletions

View File

@@ -12,6 +12,7 @@ public:
void appendCommand(Command* command);
void execute(lua_State* L);
void handleRequest(wstring key, json::value value);
private:
list<Command*> commands;

View File

@@ -65,9 +65,9 @@ void Scheduler::handleRequest(wstring key, json::value value)
wstring unitName = unit->getUnitName();
json::value path = value[L"path"];
list<Coords> newPath;
for (auto const& e : path.as_object())
for (int i = 1; i <= path.as_object().size(); i++)
{
wstring WP = e.first;
wstring WP = to_wstring(i);
double lat = path[WP][L"lat"].as_double();
double lng = path[WP][L"lng"].as_double();
log(unitName + L" set path destination " + WP + L" (" + to_wstring(lat) + L", " + to_wstring(lng) + L")");

View File

@@ -98,6 +98,7 @@ json::value Unit::json()
auto json = json::value::object();
json[L"alive"] = alive;
json[L"AI"] = AI;
json[L"name"] = json::value::string(name);
json[L"unitName"] = json::value::string(unitName);
json[L"groupName"] = json::value::string(groupName);