From f2de4cd34c92c2f77798f4275da5e9e085d3efe7 Mon Sep 17 00:00:00 2001 From: Pax1601 Date: Mon, 4 Sep 2023 19:01:50 +0200 Subject: [PATCH] Completed implementation --- client/src/map/map.ts | 19 ------------------- client/src/unit/unit.ts | 2 -- client/src/weapon/weapon.ts | 2 -- src/core/src/server.cpp | 4 ++-- 4 files changed, 2 insertions(+), 25 deletions(-) diff --git a/client/src/map/map.ts b/client/src/map/map.ts index 345d6a82..70b8adcd 100644 --- a/client/src/map/map.ts +++ b/client/src/map/map.ts @@ -431,25 +431,6 @@ export class Map extends L.Map { this.#temporaryMarkers.push(marker); } - removeTemporaryMarker(latlng: L.LatLng) { - // TODO something more refined than this - var dist: number | null = null; - var closest: L.Marker | null = null; - var i: number = 0; - this.#temporaryMarkers.forEach((marker: L.Marker, idx: number) => { - var t = latlng.distanceTo(marker.getLatLng()); - if (dist == null || t < dist) { - dist = t; - closest = marker; - i = idx; - } - }); - if (closest && dist != null && dist < 100) { - this.removeLayer(closest); - this.#temporaryMarkers.splice(i, 1); - } - } - getSelectedCoalitionArea() { return this.#coalitionAreas.find((area: CoalitionArea) => { return area.getSelected() }); } diff --git a/client/src/unit/unit.ts b/client/src/unit/unit.ts index c3f8c100..a51b0394 100644 --- a/client/src/unit/unit.ts +++ b/client/src/unit/unit.ts @@ -715,8 +715,6 @@ export class Unit extends CustomMarker { /***********************************************/ onAdd(map: Map): this { super.onAdd(map); - /* If this is the first time adding this unit to the map, remove the temporary marker */ - getMap().removeTemporaryMarker(new LatLng(this.#position.lat, this.#position.lng)); return this; } diff --git a/client/src/weapon/weapon.ts b/client/src/weapon/weapon.ts index 911794f5..1ee6b946 100644 --- a/client/src/weapon/weapon.ts +++ b/client/src/weapon/weapon.ts @@ -214,8 +214,6 @@ export class Weapon extends CustomMarker { /***********************************************/ onAdd(map: Map): this { super.onAdd(map); - /* If this is the first time adding this unit to the map, remove the temporary marker */ - getMap().removeTemporaryMarker(new LatLng(this.#position.lat, this.#position.lng)); return this; } diff --git a/src/core/src/server.cpp b/src/core/src/server.cpp index 567d5fba..2817846a 100644 --- a/src/core/src/server.cpp +++ b/src/core/src/server.cpp @@ -142,8 +142,8 @@ void Server::handle_get(http_request request) else answer[L"mission"][L"commandModeOptions"][L"commandMode"] = json::value(L"Observer"); } - else if (URI.compare(COMMANDS_URI) && query.find(L"commandHash") != query.end()) { - answer[L"commandExectued"] = json::value(scheduler->isCommandExecuted(to_string(query[L"commandHash"]))); + else if (URI.compare(COMMANDS_URI) == 0 && query.find(L"commandHash") != query.end()) { + answer[L"commandExecuted"] = json::value(scheduler->isCommandExecuted(to_string(query[L"commandHash"]))); } /* Common data */