|
|
@ -4,6 +4,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include <array>
|
|
|
|
#include <array>
|
|
|
|
#include <atomic>
|
|
|
|
#include <atomic>
|
|
|
|
#include <chrono>
|
|
|
|
#include <chrono>
|
|
|
@ -168,15 +169,7 @@ public:
|
|
|
|
* @param value The desired value
|
|
|
|
* @param value The desired value
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void SetValue(const Type& value) override {
|
|
|
|
void SetValue(const Type& value) override {
|
|
|
|
Type temp;
|
|
|
|
this->global = std::clamp(value, minimum, maximum);
|
|
|
|
if (value < minimum) {
|
|
|
|
|
|
|
|
temp = minimum;
|
|
|
|
|
|
|
|
} else if (value > maximum) {
|
|
|
|
|
|
|
|
temp = maximum;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
temp = value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
std::swap(this->global, temp);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -186,15 +179,7 @@ public:
|
|
|
|
* @returns A reference to the setting's value
|
|
|
|
* @returns A reference to the setting's value
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
const Type& operator=(const Type& value) override {
|
|
|
|
const Type& operator=(const Type& value) override {
|
|
|
|
Type temp;
|
|
|
|
this->global = std::clamp(value, minimum, maximum);
|
|
|
|
if (value < minimum) {
|
|
|
|
|
|
|
|
temp = minimum;
|
|
|
|
|
|
|
|
} else if (value > maximum) {
|
|
|
|
|
|
|
|
temp = maximum;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
temp = value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
std::swap(this->global, temp);
|
|
|
|
|
|
|
|
return this->global;
|
|
|
|
return this->global;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -342,19 +327,11 @@ public:
|
|
|
|
* @param value The desired value
|
|
|
|
* @param value The desired value
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void SetValue(const Type& value) override {
|
|
|
|
void SetValue(const Type& value) override {
|
|
|
|
Type temp;
|
|
|
|
const Type temp = std::clamp(value, this->minimum, this->maximum);
|
|
|
|
if (value < this->minimum) {
|
|
|
|
|
|
|
|
temp = this->minimum;
|
|
|
|
|
|
|
|
} else if (value > this->maximum) {
|
|
|
|
|
|
|
|
temp = this->maximum;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
temp = value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this->use_global) {
|
|
|
|
if (this->use_global) {
|
|
|
|
std::swap(this->global, temp);
|
|
|
|
this->global = temp;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
std::swap(this->custom, temp);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this->custom = temp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -365,19 +342,12 @@ public:
|
|
|
|
* @returns A reference to the setting's value
|
|
|
|
* @returns A reference to the setting's value
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
const Type& operator=(const Type& value) override {
|
|
|
|
const Type& operator=(const Type& value) override {
|
|
|
|
Type temp;
|
|
|
|
const Type temp = std::clamp(value, this->minimum, this->maximum);
|
|
|
|
if (value < this->minimum) {
|
|
|
|
|
|
|
|
temp = this->minimum;
|
|
|
|
|
|
|
|
} else if (value > this->maximum) {
|
|
|
|
|
|
|
|
temp = this->maximum;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
temp = value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this->use_global) {
|
|
|
|
if (this->use_global) {
|
|
|
|
std::swap(this->global, temp);
|
|
|
|
this->global = temp;
|
|
|
|
return this->global;
|
|
|
|
return this->global;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
std::swap(this->custom, temp);
|
|
|
|
this->custom = temp;
|
|
|
|
return this->custom;
|
|
|
|
return this->custom;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|