Implemented executed commands provider

This commit is contained in:
Pax1601
2023-09-04 12:41:54 +02:00
parent aca1e112d2
commit ede245a37d
13 changed files with 174 additions and 104 deletions

View File

@@ -98,9 +98,11 @@ public:
unsigned int getPriority() { return priority; }
virtual string getString() = 0;
virtual unsigned int getLoad() = 0;
const string getHash() { return hash; }
protected:
unsigned int priority = CommandPriority::LOW;
const string hash = random_string(16);
};
/* Simple low priority move command (from user click) */

View File

@@ -11,9 +11,10 @@ public:
void appendCommand(Command* command);
void execute(lua_State* L);
void handleRequest(string key, json::value value, string username);
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()); }
void setFrameRate(double newFrameRate) { frameRate = newFrameRate; }
void setRestrictSpawns(bool newRestrictSpawns) { restrictSpawns = newRestrictSpawns; }
void setRestrictToCoalition(bool newRestrictToCoalition) { restrictToCoalition = newRestrictToCoalition; }
@@ -35,6 +36,7 @@ public:
private:
list<Command*> commands;
list<string> executedCommandsHashes;
unsigned int load;
double frameRate;