mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
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.
57 lines
1.9 KiB
C++
57 lines
1.9 KiB
C++
#pragma once
|
|
#include "framework.h"
|
|
#include "luatools.h"
|
|
#include "commands.h"
|
|
|
|
class Scheduler
|
|
{
|
|
public:
|
|
Scheduler(lua_State* L);
|
|
~Scheduler();
|
|
|
|
void appendCommand(Command* command);
|
|
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) {
|
|
for (auto& commandResult : executedCommandResults) {
|
|
if (commandResult.hash == commandHash) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
void setFrameRate(double newFrameRate) { frameRate = newFrameRate; }
|
|
void setRestrictSpawns(bool newRestrictSpawns) { restrictSpawns = newRestrictSpawns; }
|
|
void setRestrictToCoalition(bool newRestrictToCoalition) { restrictToCoalition = newRestrictToCoalition; }
|
|
void setSetupTime(unsigned int newSetupTime) { setupTime = newSetupTime; }
|
|
void setBlueSpawnPoints(int newBlueSpawnPoints) { blueSpawnPoints = newBlueSpawnPoints; }
|
|
void setRedSpawnPoints(int newRedSpawnPoints) { redSpawnPoints = newRedSpawnPoints; }
|
|
void setEras(vector<string> newEras) { eras = newEras; }
|
|
void setCommandModeOptions(json::value newOptions);
|
|
|
|
int getFrameRate() { return static_cast<int>(round(frameRate)); };
|
|
int getLoad();
|
|
bool getRestrictSpawns() { return restrictSpawns; }
|
|
bool getRestrictToCoalition() { return restrictToCoalition; }
|
|
unsigned int getSetupTime() { return setupTime; }
|
|
int getBlueSpawnPoints() { return blueSpawnPoints; }
|
|
int getRedSpawnPoints() { return redSpawnPoints; }
|
|
vector<string> getEras() { return eras; }
|
|
json::value getCommandModeOptions();
|
|
|
|
private:
|
|
list<Command*> commands;
|
|
list<CommandResult> executedCommandResults;
|
|
unsigned int load = 0;
|
|
double frameRate = 0;
|
|
|
|
bool restrictSpawns = false;
|
|
bool restrictToCoalition = false;
|
|
unsigned int setupTime = 300;
|
|
int blueSpawnPoints = 10000;
|
|
int redSpawnPoints = 10000;
|
|
vector<string> eras = { "WW2", "Early Cold War", "Mid Cold War", "Late Cold War", "Modern" };
|
|
};
|
|
|