aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/misc/Modifier.hpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-11-22 23:11:42 +0100
committer GitHub <noreply@github.com>2023-11-22 23:11:42 +0100
commita54898b7770e0d66b729216173960686c67e58bb (patch)
treeaf8ed836a4789ef94c5bfed27abb713922f45af3 /src/openvic-simulation/misc/Modifier.hpp
parente76336cd92639f4ec71088fc4c80aea4c25528cd (diff)
parent738a203e0d8b4df87c42888043b99c13d5d97511 (diff)
Merge pull request #78 from OpenVicProject/property-macro
Refactoring (*mostly* related to the property macro)
Diffstat (limited to 'src/openvic-simulation/misc/Modifier.hpp')
-rw-r--r--src/openvic-simulation/misc/Modifier.hpp19
1 files changed, 5 insertions, 14 deletions
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>