Added new method for handling data

This commit is contained in:
Pax1601
2023-06-21 20:05:41 +02:00
parent 61d6d9f16c
commit 9d0e2239e4
16 changed files with 137 additions and 93 deletions

View File

@@ -5,7 +5,7 @@
#include "logger.h"
namespace CommandPriority {
enum CommandPriorities { LOW, MEDIUM, HIGH };
enum CommandPriorities { LOW, MEDIUM, HIGH, IMMEDIATE };
};
namespace SetCommandType {
@@ -151,7 +151,7 @@ public:
location(location),
immediate(immediate)
{
priority = CommandPriority::LOW;
priority = immediate? CommandPriority::IMMEDIATE: CommandPriority::LOW;
};
virtual wstring getString(lua_State* L);
virtual int getLoad() { return 100 * !immediate; }
@@ -175,7 +175,7 @@ public:
airbaseName(airbaseName),
immediate(immediate)
{
priority = CommandPriority::LOW;
priority = immediate ? CommandPriority::IMMEDIATE : CommandPriority::LOW;
};
virtual wstring getString(lua_State* L);
virtual int getLoad() { return 100 * !immediate; }

View File

@@ -15,6 +15,8 @@ public:
void start(lua_State* L);
void stop(lua_State* L);
json::value& getUpdateJson() { return updateJson; }
json::value& getRefreshJson() { return refreshJson; }
private:
std::thread* serverThread;
@@ -27,6 +29,8 @@ private:
void task();
atomic<bool> runListener;
json::value updateJson;
json::value refreshJson;
wstring password = L"";
};

View File

@@ -65,7 +65,7 @@ public:
void setDefaults(bool force = false);
int getID() { return ID; }
void runAILoop();
void updateExportData(json::value json);
void updateExportData(json::value json, double dt = 0);
void updateMissionData(json::value json);
json::value getData(long long time, bool getAll = false);
virtual wstring getCategory() { return L"No category"; };

View File

@@ -10,16 +10,18 @@ public:
UnitsManager(lua_State* L);
~UnitsManager();
map<int, Unit*>& getUnits() { return units; };
Unit* getUnit(int ID);
bool isUnitInGroup(Unit* unit);
bool isUnitGroupLeader(Unit* unit);
Unit* getGroupLeader(int ID);
Unit* getGroupLeader(Unit* unit);
vector<Unit*> getGroupMembers(wstring groupName);
void updateExportData(lua_State* L);
void updateExportData(lua_State* L, double dt = 0);
void updateMissionData(json::value missionData);
void runAILoop();
void getData(json::value& answer, long long time);
void getUnitData(json::value& answer, long long time);
void appendUnitData(int ID, json::value& answer, long long time);
void deleteUnit(int ID, bool explosion);
void acquireControl(int ID);