From 911a81169b6d72f603f700578af55076beeadd3e Mon Sep 17 00:00:00 2001 From: Pax1601 Date: Sun, 26 Mar 2023 18:04:17 +0200 Subject: [PATCH] Minor bugfixes --- client/src/controls/slider.ts | 4 ++-- scripts/OlympusHook.lua | 2 +- src/core/src/aircraft.cpp | 6 ++++-- src/core/src/airunit.cpp | 2 +- src/core/src/unit.cpp | 1 - 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/client/src/controls/slider.ts b/client/src/controls/slider.ts index 636c1f70..7cf185cc 100644 --- a/client/src/controls/slider.ts +++ b/client/src/controls/slider.ts @@ -75,7 +75,7 @@ export class Slider { { this.#value = newValue; if (this.#slider != null) - this.#slider.value = String((newValue - this.#minValue) / (this.#maxValue - this.#minValue) * 100); + this.#slider.value = String((newValue - this.#minValue) / (this.#maxValue - this.#minValue) * parseFloat(this.#slider.max)); this.#onValue() } } @@ -120,7 +120,7 @@ export class Slider { this.#dragged = false; if (this.#slider != null) { - this.#value = this.#minValue + parseFloat(this.#slider.value) / 100 * (this.#maxValue - this.#minValue); + this.#value = this.#minValue + parseFloat(this.#slider.value) / parseFloat(this.#slider.max) * (this.#maxValue - this.#minValue); this.#callback(this.getValue()); } } diff --git a/scripts/OlympusHook.lua b/scripts/OlympusHook.lua index fbae7406..3948f693 100644 --- a/scripts/OlympusHook.lua +++ b/scripts/OlympusHook.lua @@ -1,4 +1,4 @@ -local version = 'v0.1.0-alpha' +local version = 'v0.1.1-alpha' Olympus = {} Olympus.OlympusDLL = nil diff --git a/src/core/src/aircraft.cpp b/src/core/src/aircraft.cpp index 8b90ee4d..79f2694d 100644 --- a/src/core/src/aircraft.cpp +++ b/src/core/src/aircraft.cpp @@ -63,11 +63,13 @@ void Aircraft::changeAltitude(wstring change) void Aircraft::setTargetSpeed(double newTargetSpeed) { targetSpeed = newTargetSpeed; addMeasure(L"targetSpeed", json::value(targetSpeed)); - goToDestination(); + if (activeDestination != NULL) + goToDestination(); } void Aircraft::setTargetAltitude(double newTargetAltitude) { targetAltitude = newTargetAltitude; addMeasure(L"targetAltitude", json::value(targetAltitude)); - goToDestination(); + if (activeDestination != NULL) + goToDestination(); } \ No newline at end of file diff --git a/src/core/src/airunit.cpp b/src/core/src/airunit.cpp index b3c455be..08922240 100644 --- a/src/core/src/airunit.cpp +++ b/src/core/src/airunit.cpp @@ -149,7 +149,7 @@ bool AirUnit::updateActivePath(bool looping) /* Push the next destination in the queue to the front */ if (looping) pushActivePathBack(activePath.front()); - activePath.pop_front(); + popActivePathFront(); log(unitName + L" active path front popped"); return true; } diff --git a/src/core/src/unit.cpp b/src/core/src/unit.cpp index 0f5fcdfd..5c14c6bd 100644 --- a/src/core/src/unit.cpp +++ b/src/core/src/unit.cpp @@ -201,7 +201,6 @@ void Unit::popActivePathFront() setActivePath(path); } - void Unit::setCoalitionID(int newCoalitionID) { if (newCoalitionID == 0)