diff options
author | hop311 <hop3114@gmail.com> | 2024-10-05 20:08:55 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-10-05 22:48:42 +0200 |
commit | 6c23b7ff2e8bc733699ef9b29aee80719001acf2 (patch) | |
tree | 31032796ff2addd154837a873663d8325ee6bdc6 /src/openvic-simulation/modifier/Modifier.cpp | |
parent | 4f9fd8a327b6de5fb32792a07453e9a2e245dc84 (diff) |
Add nullcheck fuction variants accepting pointer arguments to ModifierValue and ModifierSum
Diffstat (limited to 'src/openvic-simulation/modifier/Modifier.cpp')
-rw-r--r-- | src/openvic-simulation/modifier/Modifier.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/openvic-simulation/modifier/Modifier.cpp b/src/openvic-simulation/modifier/Modifier.cpp index 73b30ce..c7c8087 100644 --- a/src/openvic-simulation/modifier/Modifier.cpp +++ b/src/openvic-simulation/modifier/Modifier.cpp @@ -58,6 +58,18 @@ fixed_point_t ModifierValue::get_effect(ModifierEffect const& effect, bool* effe } return it->second; } + + if (effect_found != nullptr) { + *effect_found = false; + } + return fixed_point_t::_0(); +} + +fixed_point_t ModifierValue::get_effect_nullcheck(ModifierEffect const* effect, bool* effect_found) const { + if (effect != nullptr) { + return get_effect(*effect, effect_found); + } + if (effect_found != nullptr) { *effect_found = false; } |