mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Refactor Python API structure and enhance backend command handling
Major refactor of the Python API: moved modules into subdirectories, replaced app.py with api.py, and added new audio and utility modules. Backend C++ code now tracks command execution results, exposes them via the API, and improves command result handling. Also includes updates to the SRS audio handler, random string generation, and VSCode launch configurations.
This commit is contained in:
@@ -5,6 +5,11 @@
|
||||
#include "logger.h"
|
||||
#include "datatypes.h"
|
||||
|
||||
struct CommandResult {
|
||||
string hash;
|
||||
string result;
|
||||
};
|
||||
|
||||
namespace CommandPriority {
|
||||
enum CommandPriorities { LOW, MEDIUM, HIGH, IMMEDIATE };
|
||||
};
|
||||
|
||||
@@ -13,7 +13,13 @@ public:
|
||||
void execute(lua_State* L);
|
||||
void handleRequest(string key, json::value value, string username, json::value& answer);
|
||||
bool checkSpawnPoints(int spawnPoints, string coalition);
|
||||
bool isCommandExecuted(string commandHash) { return (find(executedCommandsHashes.begin(), executedCommandsHashes.end(), commandHash) != executedCommandsHashes.end()); }
|
||||
bool isCommandExecuted(string commandHash) {
|
||||
for (auto& commandResult : executedCommandResults) {
|
||||
if (commandResult.hash == commandHash) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setFrameRate(double newFrameRate) { frameRate = newFrameRate; }
|
||||
void setRestrictSpawns(bool newRestrictSpawns) { restrictSpawns = newRestrictSpawns; }
|
||||
@@ -36,7 +42,7 @@ public:
|
||||
|
||||
private:
|
||||
list<Command*> commands;
|
||||
list<string> executedCommandsHashes;
|
||||
list<CommandResult> executedCommandResults;
|
||||
unsigned int load = 0;
|
||||
double frameRate = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user