aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/military
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-09-21 15:34:22 +0200
committer GitHub <noreply@github.com>2024-09-21 15:34:22 +0200
commit4b69a91a6db50f86efec503b56b07573c692df9f (patch)
tree68fca0f77f6b20f3e1fe98d32a5a79311cfd3edc /src/openvic-simulation/military
parent85da7fb84197d617d1b3cde6969bf7bcfbb93d1d (diff)
parente35ff8ed703b0b6a5496a21a29e0b274c6a36874 (diff)
Merge pull request #204 from OpenVicProject/fix-modifiers
Fix modifiers
Diffstat (limited to 'src/openvic-simulation/military')
-rw-r--r--src/openvic-simulation/military/LeaderTrait.cpp2
-rw-r--r--src/openvic-simulation/military/UnitType.cpp40
2 files changed, 21 insertions, 21 deletions
diff --git a/src/openvic-simulation/military/LeaderTrait.cpp b/src/openvic-simulation/military/LeaderTrait.cpp
index e6c0227..da7331a 100644
--- a/src/openvic-simulation/military/LeaderTrait.cpp
+++ b/src/openvic-simulation/military/LeaderTrait.cpp
@@ -4,7 +4,7 @@ using namespace OpenVic;
using namespace OpenVic::NodeTools;
LeaderTrait::LeaderTrait(std::string_view new_identifier, trait_type_t new_type, ModifierValue&& new_modifiers)
- : Modifier { new_identifier, std::move(new_modifiers) }, trait_type { new_type } {}
+ : Modifier { new_identifier, std::move(new_modifiers), modifier_type_t::LEADER }, trait_type { new_type } {}
bool LeaderTrait::is_personality_trait() const {
return trait_type == trait_type_t::PERSONALITY;
diff --git a/src/openvic-simulation/military/UnitType.cpp b/src/openvic-simulation/military/UnitType.cpp
index 1c111cc..71bc5c3 100644
--- a/src/openvic-simulation/military/UnitType.cpp
+++ b/src/openvic-simulation/military/UnitType.cpp
@@ -322,11 +322,11 @@ bool UnitTypeManager::generate_modifiers(ModifierManager& modifier_manager) cons
std::string_view identifier, UnitType::branch_t branch
) -> void {
const auto stat_modifier = [&modifier_manager, &ret, &identifier](
- std::string_view suffix, bool is_positive_good, ModifierEffect::format_t format
+ std::string_view suffix, bool is_positive_good, ModifierEffect::format_t format, std::string_view localisation_key
) -> void {
ret &= modifier_manager.add_modifier_effect(
ModifierManager::get_flat_identifier(identifier, suffix), is_positive_good, format,
- StringUtils::append_string_views("$", identifier, "$: $", suffix, "$")
+ StringUtils::append_string_views("$", identifier, "$: $", localisation_key, "$")
);
};
@@ -334,29 +334,29 @@ bool UnitTypeManager::generate_modifiers(ModifierManager& modifier_manager) cons
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, "ATTACK");
+ stat_modifier("defence", true, RAW_DECIMAL, "DEFENCE");
+ stat_modifier("default_organisation", true, RAW_DECIMAL, "DEFAULT_ORG");
+ stat_modifier("maximum_speed", true, RAW_DECIMAL, "MAXIMUM_SPEED");
+ stat_modifier("build_time", false, INT, "BUILD_TIME");
+ stat_modifier("supply_consumption", false, PROPORTION_DECIMAL, "SUPPLY_CONSUMPTION");
switch (branch) {
case 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, "RECONAISSANCE");
+ stat_modifier("discipline", true, PROPORTION_DECIMAL, "DISCIPLINE");
+ stat_modifier("support", true, PROPORTION_DECIMAL, "SUPPORT");
+ stat_modifier("maneuver", true, INT, "Maneuver");
+ stat_modifier("siege", true, RAW_DECIMAL, "SIEGE");
break;
case 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, "COLONIAL_POINTS_TECH");
+ stat_modifier("supply_consumption_score", false, INT, "SUPPLY_LOAD");
+ stat_modifier("hull", true, RAW_DECIMAL, "HULL");
+ stat_modifier("gun_power", true, RAW_DECIMAL, "GUN_POWER");
+ stat_modifier("fire_range", true, RAW_DECIMAL, "FIRE_RANGE");
+ stat_modifier("evasion", true, PROPORTION_DECIMAL, "EVASION");
+ stat_modifier("torpedo_attack", true, RAW_DECIMAL, "TORPEDO_ATTACK");
break;
default:
/* Unreachable - unit types are only added via add_regiment_type or add_ship_type which set branch to LAND or NAVAL. */