Enabled direction randomization

This commit is contained in:
Pax1601 2023-09-30 19:03:59 +02:00
parent 48d4ff97a0
commit 8ebe427269
2 changed files with 3 additions and 3 deletions

View File

@ -605,7 +605,7 @@ export class Map extends L.Map {
}
}
else if (selectedUnitTypes.length === 1 && ["GroundUnit", "NavyUnit"].includes(selectedUnitTypes[0])) {
if (selectedUnits.every((unit: Unit) => { return ["AAA", "Gun Artillery", "Rocket Artillery", "Infantry", "IFV", "Tank", "Cruiser", "Destroyer", "Frigate"].includes(unit.getType()) })) {
if (selectedUnits.every((unit: Unit) => { return ["AAA", "APC", "Gun Artillery", "Rocket Artillery", "Infantry", "IFV", "Tank", "Cruiser", "Destroyer", "Frigate"].includes(unit.getType()) })) {
options["fire-at-area"] = { text: "Fire at area", tooltip: "Fire at a large area" };
options["simulate-fire-fight"] = { text: "Simulate fire fight", tooltip: "Simulate a fire fight by shooting randomly in a certain large area" };
}

View File

@ -160,7 +160,7 @@ void GroundUnit::AIloop()
case State::SIMULATE_FIRE_FIGHT: {
setTask("Simulating fire fight");
if (!getHasTask() || 0 * (((double)(rand()) / (double)(RAND_MAX)) < 0.01)) {
if (!getHasTask() || (((double)(rand()) / (double)(RAND_MAX)) < 0.002)) {
double dist;
double bearing1;
double bearing2;
@ -183,7 +183,7 @@ void GroundUnit::AIloop()
double lat = 0;
double lng = 0;
double randomBearing = bearing1 + 0 * (((double)(rand()) / (double)(RAND_MAX) - 0.5) * 2) * 15;
double randomBearing = bearing1 + (((double)(rand()) / (double)(RAND_MAX) - 0.5) * 2) * 15;
Geodesic::WGS84().Direct(position.lat, position.lng, randomBearing, r, lat, lng);
std::ostringstream taskSS;