mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Migration to node.js completed
This commit is contained in:
@@ -11,6 +11,7 @@ auto before = std::chrono::system_clock::now();
|
||||
UnitsFactory* unitsFactory = nullptr;
|
||||
Server* server = nullptr;
|
||||
Scheduler* scheduler = nullptr;
|
||||
json::value airbasesData;
|
||||
|
||||
/* Called when DCS simulation stops. All singleton instances are deleted. */
|
||||
extern "C" DllExport int coreDeinit(lua_State* L)
|
||||
@@ -68,6 +69,8 @@ extern "C" DllExport int coreMissionData(lua_State * L)
|
||||
|
||||
if (missionData.has_object_field(L"unitsData"))
|
||||
unitsFactory->updateMissionData(missionData[L"unitsData"]);
|
||||
if (missionData.has_object_field(L"airbases"))
|
||||
airbasesData = missionData[L"airbases"];
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
extern UnitsFactory* unitsFactory;
|
||||
extern Scheduler* scheduler;
|
||||
extern json::value airbasesData;
|
||||
|
||||
void handle_eptr(std::exception_ptr eptr)
|
||||
{
|
||||
@@ -57,6 +58,7 @@ void Server::handle_get(http_request request)
|
||||
std::exception_ptr eptr;
|
||||
try {
|
||||
unitsFactory->updateAnswer(answer);
|
||||
answer[L"airbases"] = airbasesData;
|
||||
response.set_body(answer);
|
||||
}
|
||||
catch (...) {
|
||||
|
||||
@@ -94,10 +94,8 @@ void UnitsFactory::updateMissionData(json::value missionData)
|
||||
for (auto const& p : units)
|
||||
{
|
||||
int ID = p.first;
|
||||
log(to_string(ID));
|
||||
if (missionData.has_field(to_wstring(ID)))
|
||||
{
|
||||
log("mix");
|
||||
p.second->updateMissionData(missionData[to_wstring(ID)]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user