aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/misc
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/misc')
-rw-r--r--src/openvic-simulation/misc/Modifier.cpp20
-rw-r--r--src/openvic-simulation/misc/Modifier.hpp19
2 files changed, 5 insertions, 34 deletions
diff --git a/src/openvic-simulation/misc/Modifier.cpp b/src/openvic-simulation/misc/Modifier.cpp
index 0386833..89a411c 100644
--- a/src/openvic-simulation/misc/Modifier.cpp
+++ b/src/openvic-simulation/misc/Modifier.cpp
@@ -6,14 +6,6 @@ using namespace OpenVic::NodeTools;
ModifierEffect::ModifierEffect(std::string_view new_identifier, bool new_positive_good, format_t new_format)
: HasIdentifier { new_identifier }, positive_good { new_positive_good }, format { new_format } {}
-bool ModifierEffect::get_positive_good() const {
- return positive_good;
-}
-
-ModifierEffect::format_t ModifierEffect::get_format() const {
- return format;
-}
-
ModifierValue::ModifierValue() = default;
ModifierValue::ModifierValue(effect_map_t&& new_values) : values { std::move(new_values) } {}
ModifierValue::ModifierValue(ModifierValue const&) = default;
@@ -85,21 +77,9 @@ ModifierValue ModifierValue::operator-(ModifierValue const& right) const {
Modifier::Modifier(std::string_view new_identifier, ModifierValue&& new_values, icon_t new_icon)
: HasIdentifier { new_identifier }, ModifierValue { std::move(new_values) }, icon { new_icon } {}
-Modifier::icon_t Modifier::get_icon() const {
- return icon;
-}
-
ModifierInstance::ModifierInstance(Modifier const& modifier, Date expiry_date)
: modifier { modifier }, expiry_date { expiry_date } {}
-Modifier const& ModifierInstance::get_modifier() const {
- return modifier;
-}
-
-Date ModifierInstance::get_expiry_date() const {
- return expiry_date;
-}
-
ModifierManager::ModifierManager() : modifier_effects { "modifier effects" }, event_modifiers { "event modifiers" } {}
bool ModifierManager::add_modifier_effect(std::string_view identifier, bool positive_good, ModifierEffect::format_t format) {
diff --git a/src/openvic-simulation/misc/Modifier.hpp b/src/openvic-simulation/misc/Modifier.hpp
index e6ea54e..34acd9d 100644
--- a/src/openvic-simulation/misc/Modifier.hpp
+++ b/src/openvic-simulation/misc/Modifier.hpp
@@ -19,8 +19,8 @@ namespace OpenVic {
/* If true, positive values will be green and negative values will be red.
* If false, the colours will be switced.
*/
- const bool positive_good;
- const format_t format;
+ const bool PROPERTY_CUSTOM_NAME(positive_good, is_positive_good);
+ const format_t PROPERTY(format);
// TODO - format/precision, e.g. 80% vs 0.8 vs 0.800, 2 vs 2.0 vs 200%
@@ -28,9 +28,6 @@ namespace OpenVic {
public:
ModifierEffect(ModifierEffect&&) = default;
-
- bool get_positive_good() const;
- format_t get_format() const;
};
struct ModifierValue {
@@ -73,27 +70,21 @@ namespace OpenVic {
private:
/* A modifier can have no icon (zero). */
- const icon_t icon;
+ const icon_t PROPERTY(icon);
Modifier(std::string_view new_identifier, ModifierValue&& new_values, icon_t new_icon);
public:
Modifier(Modifier&&) = default;
-
- icon_t get_icon() const;
};
struct ModifierInstance {
private:
- Modifier const& modifier;
- Date expiry_date;
+ Modifier const& PROPERTY(modifier);
+ Date PROPERTY(expiry_date);
ModifierInstance(Modifier const& modifier, Date expiry_date);
-
- public:
- Modifier const& get_modifier() const;
- Date get_expiry_date() const;
};
template<typename Fn>