aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/military/Unit.cpp
diff options
context:
space:
mode:
author wvpm <24685035+wvpm@users.noreply.github.com>2024-01-12 21:53:46 +0100
committer GitHub <noreply@github.com>2024-01-12 21:53:46 +0100
commit7b5a960ee9fce4241f83e5217bcf8f43af99f330 (patch)
tree60101bdfe575a25c9ef10cdcc52691140795405d /src/openvic-simulation/military/Unit.cpp
parente79d3e0416e62883c697225b090d03abafc7bb30 (diff)
parent177a0051eceb657ad838048d9532e306e18ce4e5 (diff)
Merge pull request #126 from OpenVicProject/improve_modifiers
Case insensitive modifiers & added more
Diffstat (limited to 'src/openvic-simulation/military/Unit.cpp')
-rw-r--r--src/openvic-simulation/military/Unit.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/openvic-simulation/military/Unit.cpp b/src/openvic-simulation/military/Unit.cpp
index db04335..9981c86 100644
--- a/src/openvic-simulation/military/Unit.cpp
+++ b/src/openvic-simulation/military/Unit.cpp
@@ -203,11 +203,11 @@ bool UnitManager::generate_modifiers(ModifierManager& modifier_manager) const {
bool ret = true;
const auto generate_stat_modifiers = [&modifier_manager, &ret](std::string_view identifier, Unit::type_t type) -> void {
-
- const auto stat_modifier = [&modifier_manager, &ret, &identifier](std::string_view suffix, bool positive_good,
- ModifierEffect::format_t format) -> void {
+ const auto stat_modifier = [&modifier_manager, &ret, &identifier](
+ std::string_view suffix, bool is_positive_good, ModifierEffect::format_t format
+ ) -> void {
ret &= modifier_manager.add_modifier_effect(
- StringUtils::append_string_views(identifier, suffix), positive_good, format
+ ModifierManager::get_flat_identifier(identifier, suffix), is_positive_good, format
);
};
@@ -215,29 +215,29 @@ bool UnitManager::generate_modifiers(ModifierManager& modifier_manager) const {
ret &= modifier_manager.register_complex_modifier(identifier);
- stat_modifier("_attack", true, RAW_DECIMAL);
- stat_modifier("_defence", true, RAW_DECIMAL);
- stat_modifier("_default_organisation", true, RAW_DECIMAL);
- stat_modifier("_maximum_speed", true, RAW_DECIMAL);
- stat_modifier("_build_time", false, INT);
- stat_modifier("_supply_consumption", false, PROPORTION_DECIMAL);
+ stat_modifier("attack", true, RAW_DECIMAL);
+ stat_modifier("defence", true, RAW_DECIMAL);
+ stat_modifier("default_organisation", true, RAW_DECIMAL);
+ stat_modifier("maximum_speed", true, RAW_DECIMAL);
+ stat_modifier("build_time", false, INT);
+ stat_modifier("supply_consumption", false, PROPORTION_DECIMAL);
switch (type) {
case Unit::type_t::LAND:
- stat_modifier("_reconnaissance", true, RAW_DECIMAL);
- stat_modifier("_discipline", true, PROPORTION_DECIMAL);
- stat_modifier("_support", true, PROPORTION_DECIMAL);
- stat_modifier("_maneuver", true, INT);
- stat_modifier("_siege", true, RAW_DECIMAL);
+ stat_modifier("reconnaissance", true, RAW_DECIMAL);
+ stat_modifier("discipline", true, PROPORTION_DECIMAL);
+ stat_modifier("support", true, PROPORTION_DECIMAL);
+ stat_modifier("maneuver", true, INT);
+ stat_modifier("siege", true, RAW_DECIMAL);
break;
case Unit::type_t::NAVAL:
- stat_modifier("_colonial_points", true, INT);
- stat_modifier("_supply_consumption_score", false, INT);
- stat_modifier("_hull", true, RAW_DECIMAL);
- stat_modifier("_gun_power", true, RAW_DECIMAL);
- stat_modifier("_fire_range", true, RAW_DECIMAL);
- stat_modifier("_evasion", true, PROPORTION_DECIMAL);
- stat_modifier("_torpedo_attack", true, RAW_DECIMAL);
+ stat_modifier("colonial_points", true, INT);
+ stat_modifier("supply_consumption_score", false, INT);
+ stat_modifier("hull", true, RAW_DECIMAL);
+ stat_modifier("gun_power", true, RAW_DECIMAL);
+ stat_modifier("fire_range", true, RAW_DECIMAL);
+ stat_modifier("evasion", true, PROPORTION_DECIMAL);
+ stat_modifier("torpedo_attack", true, RAW_DECIMAL);
break;
}
};