mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Added basic simulated firefight state
This commit is contained in:
@@ -95,21 +95,26 @@ namespace ECMUse {
|
||||
class Command
|
||||
{
|
||||
public:
|
||||
Command(function<void(void)> callback) : callback(callback) {};
|
||||
unsigned int getPriority() { return priority; }
|
||||
virtual string getString() = 0;
|
||||
virtual unsigned int getLoad() = 0;
|
||||
const string getHash() { return hash; }
|
||||
void executeCallback() { callback(); }
|
||||
|
||||
protected:
|
||||
unsigned int priority = CommandPriority::LOW;
|
||||
const string hash = random_string(16);
|
||||
function<void(void)> callback;
|
||||
};
|
||||
|
||||
/* Simple low priority move command (from user click) */
|
||||
class Move : public Command
|
||||
{
|
||||
public:
|
||||
Move(string groupName, Coords destination, double speed, string speedType, double altitude, string altitudeType, string taskOptions, string category):
|
||||
Move(string groupName, Coords destination, double speed, string speedType, double altitude,
|
||||
string altitudeType, string taskOptions, string category, function<void(void)> callback = []() {}) :
|
||||
Command(callback),
|
||||
groupName(groupName),
|
||||
destination(destination),
|
||||
speed(speed),
|
||||
@@ -139,7 +144,8 @@ private:
|
||||
class Smoke : public Command
|
||||
{
|
||||
public:
|
||||
Smoke(string color, Coords location) :
|
||||
Smoke(string color, Coords location, function<void(void)> callback = [](){}) :
|
||||
Command(callback),
|
||||
color(color),
|
||||
location(location)
|
||||
{
|
||||
@@ -157,7 +163,8 @@ private:
|
||||
class SpawnGroundUnits : public Command
|
||||
{
|
||||
public:
|
||||
SpawnGroundUnits(string coalition, vector<SpawnOptions> spawnOptions, string country, bool immediate) :
|
||||
SpawnGroundUnits(string coalition, vector<SpawnOptions> spawnOptions, string country, bool immediate, function<void(void)> callback = [](){}) :
|
||||
Command(callback),
|
||||
coalition(coalition),
|
||||
spawnOptions(spawnOptions),
|
||||
country(country),
|
||||
@@ -179,7 +186,8 @@ private:
|
||||
class SpawnNavyUnits : public Command
|
||||
{
|
||||
public:
|
||||
SpawnNavyUnits(string coalition, vector<SpawnOptions> spawnOptions, string country, bool immediate) :
|
||||
SpawnNavyUnits(string coalition, vector<SpawnOptions> spawnOptions, string country, bool immediate, function<void(void)> callback = [](){}) :
|
||||
Command(callback),
|
||||
coalition(coalition),
|
||||
spawnOptions(spawnOptions),
|
||||
country(country),
|
||||
@@ -201,7 +209,8 @@ private:
|
||||
class SpawnAircrafts : public Command
|
||||
{
|
||||
public:
|
||||
SpawnAircrafts(string coalition, vector<SpawnOptions> spawnOptions, string airbaseName, string country, bool immediate) :
|
||||
SpawnAircrafts(string coalition, vector<SpawnOptions> spawnOptions, string airbaseName, string country, bool immediate, function<void(void)> callback = [](){}) :
|
||||
Command(callback),
|
||||
coalition(coalition),
|
||||
spawnOptions(spawnOptions),
|
||||
airbaseName(airbaseName),
|
||||
@@ -221,12 +230,12 @@ private:
|
||||
const bool immediate;
|
||||
};
|
||||
|
||||
|
||||
/* Spawn helicopter command */
|
||||
class SpawnHelicopters : public Command
|
||||
{
|
||||
public:
|
||||
SpawnHelicopters(string coalition, vector<SpawnOptions> spawnOptions, string airbaseName, string country, bool immediate) :
|
||||
SpawnHelicopters(string coalition, vector<SpawnOptions> spawnOptions, string airbaseName, string country, bool immediate, function<void(void)> callback = [](){}) :
|
||||
Command(callback),
|
||||
coalition(coalition),
|
||||
spawnOptions(spawnOptions),
|
||||
airbaseName(airbaseName),
|
||||
@@ -250,7 +259,8 @@ private:
|
||||
class Clone : public Command
|
||||
{
|
||||
public:
|
||||
Clone(vector<CloneOptions> cloneOptions, bool deleteOriginal) :
|
||||
Clone(vector<CloneOptions> cloneOptions, bool deleteOriginal, function<void(void)> callback = [](){}) :
|
||||
Command(callback),
|
||||
cloneOptions(cloneOptions),
|
||||
deleteOriginal(deleteOriginal)
|
||||
{
|
||||
@@ -268,7 +278,8 @@ private:
|
||||
class Delete : public Command
|
||||
{
|
||||
public:
|
||||
Delete(unsigned int ID, bool explosion, bool immediate ) :
|
||||
Delete(unsigned int ID, bool explosion, bool immediate, function<void(void)> callback = [](){}) :
|
||||
Command(callback),
|
||||
ID(ID),
|
||||
explosion(explosion),
|
||||
immediate(immediate)
|
||||
@@ -289,7 +300,8 @@ private:
|
||||
class SetTask : public Command
|
||||
{
|
||||
public:
|
||||
SetTask(string groupName, string task) :
|
||||
SetTask(string groupName, string task, function<void(void)> callback = [](){}) :
|
||||
Command(callback),
|
||||
groupName(groupName),
|
||||
task(task)
|
||||
{
|
||||
@@ -307,7 +319,8 @@ private:
|
||||
class ResetTask : public Command
|
||||
{
|
||||
public:
|
||||
ResetTask(string groupName) :
|
||||
ResetTask(string groupName, function<void(void)> callback = [](){}) :
|
||||
Command(callback),
|
||||
groupName(groupName)
|
||||
{
|
||||
priority = CommandPriority::HIGH;
|
||||
@@ -323,7 +336,8 @@ private:
|
||||
class SetCommand : public Command
|
||||
{
|
||||
public:
|
||||
SetCommand(string groupName, string command) :
|
||||
SetCommand(string groupName, string command, function<void(void)> callback = [](){}) :
|
||||
Command(callback),
|
||||
groupName(groupName),
|
||||
command(command)
|
||||
{
|
||||
@@ -341,7 +355,8 @@ private:
|
||||
class SetOption : public Command
|
||||
{
|
||||
public:
|
||||
SetOption(string groupName, unsigned int optionID, unsigned int optionValue) :
|
||||
SetOption(string groupName, unsigned int optionID, unsigned int optionValue, function<void(void)> callback = [](){}) :
|
||||
Command(callback),
|
||||
groupName(groupName),
|
||||
optionID(optionID),
|
||||
optionValue(optionValue),
|
||||
@@ -351,7 +366,8 @@ public:
|
||||
priority = CommandPriority::HIGH;
|
||||
};
|
||||
|
||||
SetOption(string groupName, unsigned int optionID, bool optionBool) :
|
||||
SetOption(string groupName, unsigned int optionID, bool optionBool, function<void(void)> callback = [](){}) :
|
||||
Command(callback),
|
||||
groupName(groupName),
|
||||
optionID(optionID),
|
||||
optionValue(0),
|
||||
@@ -375,7 +391,8 @@ private:
|
||||
class SetOnOff : public Command
|
||||
{
|
||||
public:
|
||||
SetOnOff(string groupName, bool onOff) :
|
||||
SetOnOff(string groupName, bool onOff, function<void(void)> callback = [](){}) :
|
||||
Command(callback),
|
||||
groupName(groupName),
|
||||
onOff(onOff)
|
||||
{
|
||||
@@ -393,7 +410,8 @@ private:
|
||||
class Explosion : public Command
|
||||
{
|
||||
public:
|
||||
Explosion(unsigned int intensity, Coords location) :
|
||||
Explosion(unsigned int intensity, Coords location, function<void(void)> callback = [](){}) :
|
||||
Command(callback),
|
||||
location(location),
|
||||
intensity(intensity)
|
||||
{
|
||||
|
||||
@@ -64,7 +64,8 @@ namespace State
|
||||
BOMB_POINT,
|
||||
CARPET_BOMB,
|
||||
BOMB_BUILDING,
|
||||
FIRE_AT_AREA
|
||||
FIRE_AT_AREA,
|
||||
SIMULATE_FIRE_FIGHT
|
||||
};
|
||||
};
|
||||
|
||||
@@ -125,4 +126,9 @@ struct SpawnOptions {
|
||||
struct CloneOptions {
|
||||
unsigned int ID;
|
||||
Coords location;
|
||||
};
|
||||
|
||||
struct GunDataItem {
|
||||
double barrelHeight;
|
||||
double muzzleVelocity;
|
||||
};
|
||||
116
src/core/include/gundata.h
Normal file
116
src/core/include/gundata.h
Normal file
@@ -0,0 +1,116 @@
|
||||
#pragma once
|
||||
|
||||
#include "framework.h"
|
||||
#include "datatypes.h"
|
||||
|
||||
map<string, GunDataItem> gunData = {
|
||||
{"2B11 mortar", {0.9, 860}},
|
||||
{"SAU Gvozdika", {0.9, 860}},
|
||||
{"SAU Msta", {0.9, 860}},
|
||||
{"SAU Akatsia", {0.9, 860}},
|
||||
{"SAU 2-C9", {0.9, 860}},
|
||||
{"M-109", {0.9, 860}},
|
||||
{"SpGH_Dana", {0.9, 860}},
|
||||
{"AAV7", {0.9, 860}},
|
||||
{"BMD-1", {0.9, 860}},
|
||||
{"BMP-1", {0.9, 860}},
|
||||
{"BMP-2", {0.9, 860}},
|
||||
{"BMP-3", {0.9, 860}},
|
||||
{"BRDM-2", {0.9, 860}},
|
||||
{"BTR_D", {0.9, 860}},
|
||||
{"Cobra", {0.9, 860}},
|
||||
{"LAV-25", {0.9, 860}},
|
||||
{"M1043 HMMWV Armament", {0.9, 860}},
|
||||
{"M1045 HMMWV TOW", {0.9, 860}},
|
||||
{"M1126 Stryker ICV", {0.9, 860}},
|
||||
{"M-113", {0.9, 860}},
|
||||
{"M1134 Stryker ATGM", {0.9, 860}},
|
||||
{"M-2 Bradley", {0.9, 860}},
|
||||
{"MCV-80", {0.9, 860}},
|
||||
{"MTLB", {0.9, 860}},
|
||||
{"Marder", {0.9, 860}},
|
||||
{"TPZ", {0.9, 860}},
|
||||
{"Grad_FDDM", {0.9, 860}},
|
||||
{"Paratrooper RPG-16", {0.9, 860}},
|
||||
{"Paratrooper AKS-74", {0.9, 860}},
|
||||
{"Infantry AK Ins", {0.9, 860}},
|
||||
{"Soldier AK", {0.4, 860}},
|
||||
{"Infantry AK", {0.9, 860}},
|
||||
{"Soldier M249", {0.9, 860}},
|
||||
{"Soldier M4", {0.9, 860}},
|
||||
{"Soldier M4 GRG", {0.9, 860}},
|
||||
{"Soldier RPG", {0.9, 860}},
|
||||
{"MLRS FDDM", {0.9, 860}},
|
||||
{"Infantry AK ver2", {0.9, 860}},
|
||||
{"Infantry AK ver3", {0.9, 860}},
|
||||
{"Grad-URAL", {0.9, 860}},
|
||||
{"Uragan_BM-27", {0.9, 860}},
|
||||
{"Smerch", {0.9, 860}},
|
||||
{"Smerch_HE", {0.9, 860}},
|
||||
{"MLRS", {0.9, 860}},
|
||||
{"Challenger2", {0.9, 860}},
|
||||
{"Leclerc", {0.9, 860}},
|
||||
{"M-60", {0.9, 860}},
|
||||
{"M1128 Stryker MGS", {0.9, 860}},
|
||||
{"M-1 Abrams", {0.9, 860}},
|
||||
{"T-55", {0.9, 860}},
|
||||
{"T-72B", {0.9, 860}},
|
||||
{"T-80UD", {0.9, 860}},
|
||||
{"T-90", {0.9, 860}},
|
||||
{"Leopard1A3", {0.9, 860}},
|
||||
{"Merkava_Mk4", {0.9, 860}},
|
||||
{"JTAC", {0.9, 860}},
|
||||
{"Infantry Animated", {0.9, 860}},
|
||||
{"HL_DSHK", {0.9, 860}},
|
||||
{"HL_KORD", {0.9, 860}},
|
||||
{"tt_DSHK", {0.9, 860}},
|
||||
{"tt_KORD", {0.9, 860}},
|
||||
{"HL_B8M1", {0.9, 860}},
|
||||
{"tt_B8M1", {0.9, 860}},
|
||||
{"M4_Sherman", {0.9, 860}},
|
||||
{"M2A1_halftrack", {0.9, 860}},
|
||||
{"BTR-80", {0.9, 860}},
|
||||
{"T-72B3", {0.9, 860}},
|
||||
{"PT_76", {0.9, 860}},
|
||||
{"BTR-82A", {0.9, 860}},
|
||||
{"Chieftain_mk3", {0.9, 860}},
|
||||
{"Pz_IV_H", {0.9, 860}},
|
||||
{"Leopard-2A5", {0.9, 860}},
|
||||
{"Leopard-2", {0.9, 860}},
|
||||
{"leopard-2A4", {0.9, 860}},
|
||||
{"leopard-2A4_trs", {0.9, 860}},
|
||||
{"Sd_Kfz_251", {0.9, 860}},
|
||||
{"T155_Firtina", {0.9, 860}},
|
||||
{"VAB_Mephisto", {0.9, 860}},
|
||||
{"ZTZ96B", {0.9, 860}},
|
||||
{"ZBD04A", {0.9, 860}},
|
||||
{"PLZ05", {0.9, 860}},
|
||||
{"TYPE-59", {0.9, 860}},
|
||||
{"Tiger_I", {0.9, 860}},
|
||||
{"Tiger_II_H", {0.9, 860}},
|
||||
{"Pz_V_Panther_G", {0.9, 860}},
|
||||
{"Jagdpanther_G1", {0.9, 860}},
|
||||
{"JagdPz_IV", {0.9, 860}},
|
||||
{"Stug_IV", {0.9, 860}},
|
||||
{"SturmPzIV", {0.9, 860}},
|
||||
{"Wespe124", {0.9, 860}},
|
||||
{"Sd_Kfz_234_2_Puma", {0.9, 860}},
|
||||
{"soldier_mauser98", {0.9, 860}},
|
||||
{"Stug_III", {0.9, 860}},
|
||||
{"Elefant_SdKfz_184", {0.9, 860}},
|
||||
{"Pak40", {0.9, 860}},
|
||||
{"LeFH_18-40-105", {0.9, 860}},
|
||||
{"Cromwell_IV", {0.9, 860}},
|
||||
{"M4A4_Sherman_FF", {0.9, 860}},
|
||||
{"soldier_wwii_br_01", {0.9, 860}},
|
||||
{"Centaur_IV", {0.9, 860}},
|
||||
{"Churchill_VII", {0.9, 860}},
|
||||
{"Daimler_AC", {0.9, 860}},
|
||||
{"Tetrarch", {0.9, 860}},
|
||||
{"M12_GMC", {0.9, 860}},
|
||||
{"soldier_wwii_us", {0.9, 860}},
|
||||
{"M10_GMC", {0.9, 860}},
|
||||
{"M8_Greyhound", {0.9, 860}},
|
||||
{"M2A1-105", {0.9, 860}},
|
||||
{"M4_Tractor", {0.9, 860}},
|
||||
};
|
||||
@@ -54,6 +54,7 @@ public:
|
||||
void resetTask();
|
||||
bool checkTaskFailed();
|
||||
void resetTaskFailedCounter();
|
||||
void setHasTaskAssigned(bool newHasTaskAssigned);
|
||||
|
||||
void triggerUpdate(unsigned char datumIndex);
|
||||
|
||||
@@ -185,6 +186,7 @@ protected:
|
||||
|
||||
/********** Other **********/
|
||||
unsigned int taskCheckCounter = 0;
|
||||
bool hasTaskAssigned = false;
|
||||
double initialFuel = 0;
|
||||
map<unsigned char, unsigned long long> updateTimeMap;
|
||||
unsigned long long lastLoopTime = 0;
|
||||
|
||||
Reference in New Issue
Block a user