From 8ebe427269392fafab8cd144ce6db47ded61b2ad Mon Sep 17 00:00:00 2001 From: Pax1601 Date: Sat, 30 Sep 2023 19:03:59 +0200 Subject: [PATCH] Enabled direction randomization --- client/src/map/map.ts | 2 +- src/core/src/groundunit.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/map/map.ts b/client/src/map/map.ts index c1adb948..360281a6 100644 --- a/client/src/map/map.ts +++ b/client/src/map/map.ts @@ -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" }; } diff --git a/src/core/src/groundunit.cpp b/src/core/src/groundunit.cpp index b8b50c48..3f70a590 100644 --- a/src/core/src/groundunit.cpp +++ b/src/core/src/groundunit.cpp @@ -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;