aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/economy
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/economy')
-rw-r--r--src/openvic-simulation/economy/BuildingType.cpp8
-rw-r--r--src/openvic-simulation/economy/BuildingType.hpp1
-rw-r--r--src/openvic-simulation/economy/EconomyManager.hpp5
-rw-r--r--src/openvic-simulation/economy/GoodDefinition.cpp41
4 files changed, 37 insertions, 18 deletions
diff --git a/src/openvic-simulation/economy/BuildingType.cpp b/src/openvic-simulation/economy/BuildingType.cpp
index f0fc8a8..a20aa36 100644
--- a/src/openvic-simulation/economy/BuildingType.cpp
+++ b/src/openvic-simulation/economy/BuildingType.cpp
@@ -113,13 +113,17 @@ bool BuildingTypeManager::load_buildings_file(
lock_building_types();
for (BuildingType const& building_type : building_types.get_items()) {
+ using enum ModifierEffect::format_t;
+
static constexpr std::string_view max_prefix = "max_";
static constexpr std::string_view min_prefix = "min_build_";
ret &= modifier_manager.add_modifier_effect(
- StringUtils::append_string_views(max_prefix, building_type.get_identifier()), true, ModifierEffect::format_t::INT
+ StringUtils::append_string_views(max_prefix, building_type.get_identifier()), true, INT,
+ StringUtils::append_string_views("$", building_type.get_identifier(), "$ $TECH_MAX_LEVEL$")
);
+ // TODO - add custom localisation for "min_build_$building_type$" modifiers
ret &= modifier_manager.add_modifier_effect(
- StringUtils::append_string_views(min_prefix, building_type.get_identifier()), false, ModifierEffect::format_t::INT
+ StringUtils::append_string_views(min_prefix, building_type.get_identifier()), false, INT
);
if (building_type.is_in_province()) {
diff --git a/src/openvic-simulation/economy/BuildingType.hpp b/src/openvic-simulation/economy/BuildingType.hpp
index e28dd86..d9a9bd0 100644
--- a/src/openvic-simulation/economy/BuildingType.hpp
+++ b/src/openvic-simulation/economy/BuildingType.hpp
@@ -7,7 +7,6 @@
#include "openvic-simulation/types/IdentifierRegistry.hpp"
#include "openvic-simulation/types/fixed_point/FixedPoint.hpp"
-
namespace OpenVic {
struct BuildingTypeManager;
diff --git a/src/openvic-simulation/economy/EconomyManager.hpp b/src/openvic-simulation/economy/EconomyManager.hpp
index 7f0520d..5257e6a 100644
--- a/src/openvic-simulation/economy/EconomyManager.hpp
+++ b/src/openvic-simulation/economy/EconomyManager.hpp
@@ -1,12 +1,11 @@
#pragma once
+#include <openvic-dataloader/v2script/Parser.hpp>
+
#include "openvic-simulation/economy/BuildingType.hpp"
#include "openvic-simulation/economy/GoodDefinition.hpp"
#include "openvic-simulation/economy/production/ProductionType.hpp"
-#include "openvic-dataloader/v2script/Parser.hpp"
-
-
namespace OpenVic {
struct EconomyManager {
private:
diff --git a/src/openvic-simulation/economy/GoodDefinition.cpp b/src/openvic-simulation/economy/GoodDefinition.cpp
index f21ea18..82d3719 100644
--- a/src/openvic-simulation/economy/GoodDefinition.cpp
+++ b/src/openvic-simulation/economy/GoodDefinition.cpp
@@ -88,29 +88,46 @@ bool GoodDefinitionManager::load_goods_file(ast::NodeCPtr root) {
}
bool GoodDefinitionManager::generate_modifiers(ModifierManager& modifier_manager) const {
+ using enum ModifierEffect::format_t;
+
bool ret = true;
- const auto good_modifier = [this, &modifier_manager, &ret](std::string_view name, bool is_positive_good) -> void {
+ const auto good_modifier = [this, &modifier_manager, &ret](
+ std::string_view name, bool is_positive_good, auto make_localisation_suffix
+ ) -> void {
ret &= modifier_manager.register_complex_modifier(name);
+
for (GoodDefinition const& good : get_good_definitions()) {
ret &= modifier_manager.add_modifier_effect(
- ModifierManager::get_flat_identifier(name, good.get_identifier()), is_positive_good
+ ModifierManager::get_flat_identifier(name, good.get_identifier()), is_positive_good, PROPORTION_DECIMAL,
+ make_localisation_suffix(good.get_identifier())
);
}
};
- good_modifier("artisan_goods_input", false);
- good_modifier("artisan_goods_output", true);
- good_modifier("artisan_goods_throughput", true);
- good_modifier("factory_goods_input", false);
- good_modifier("factory_goods_output", true);
- good_modifier("factory_goods_throughput", true);
- good_modifier("rgo_goods_output", true);
- good_modifier("rgo_goods_throughput", true);
- good_modifier("rgo_size", true);
+ const auto make_production_localisation_suffix = [](std::string_view localisation_suffix) -> auto {
+ return [localisation_suffix](std::string_view good_identifier) -> std::string {
+ return StringUtils::append_string_views("$", good_identifier, "$ $", localisation_suffix, "$");
+ };
+ };
+
+ good_modifier("artisan_goods_input", false, make_production_localisation_suffix("TECH_INPUT"));
+ good_modifier("artisan_goods_output", true, make_production_localisation_suffix("TECH_OUTPUT"));
+ good_modifier("artisan_goods_throughput", true, make_production_localisation_suffix("TECH_THROUGHPUT"));
+ good_modifier("factory_goods_input", false, make_production_localisation_suffix("TECH_INPUT"));
+ good_modifier("factory_goods_output", true, make_production_localisation_suffix("TECH_OUTPUT"));
+ good_modifier("factory_goods_throughput", true, make_production_localisation_suffix("TECH_THROUGHPUT"));
+ good_modifier("rgo_goods_output", true, make_production_localisation_suffix("TECH_OUTPUT"));
+ good_modifier("rgo_goods_throughput", true, make_production_localisation_suffix("TECH_THROUGHPUT"));
+ good_modifier("rgo_size", true, [](std::string_view good_identifier) -> std::string {
+ return StringUtils::append_string_views(good_identifier, "_RGO_SIZE");
+ });
for (GoodDefinition const& good : get_good_definitions()) {
- ret &= modifier_manager.add_modifier_effect(good.get_identifier(), true, ModifierEffect::format_t::PERCENTAGE_DECIMAL);
+ ret &= modifier_manager.add_modifier_effect(
+ good.get_identifier(), true, PERCENTAGE_DECIMAL,
+ StringUtils::append_string_views("$ENCOURAGEMENT_FOR$$", good.get_identifier(), "$")
+ );
}
return ret;