aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation')
-rw-r--r--src/openvic-simulation/economy/BuildingType.cpp3
-rw-r--r--src/openvic-simulation/economy/GoodDefinition.cpp7
-rw-r--r--src/openvic-simulation/map/Crime.cpp12
-rw-r--r--src/openvic-simulation/map/Crime.hpp2
-rw-r--r--src/openvic-simulation/map/MapDefinition.cpp4
-rw-r--r--src/openvic-simulation/map/Region.cpp12
-rw-r--r--src/openvic-simulation/map/Region.hpp2
-rw-r--r--src/openvic-simulation/map/TerrainType.cpp22
-rw-r--r--src/openvic-simulation/military/LeaderTrait.cpp2
-rw-r--r--src/openvic-simulation/military/UnitType.cpp40
-rw-r--r--src/openvic-simulation/modifier/Modifier.cpp52
-rw-r--r--src/openvic-simulation/modifier/Modifier.hpp33
-rw-r--r--src/openvic-simulation/politics/Issue.cpp24
-rw-r--r--src/openvic-simulation/politics/Issue.hpp2
-rw-r--r--src/openvic-simulation/politics/NationalFocus.cpp60
-rw-r--r--src/openvic-simulation/politics/NationalFocus.hpp14
-rw-r--r--src/openvic-simulation/politics/NationalValue.cpp2
-rw-r--r--src/openvic-simulation/pop/Pop.cpp7
-rw-r--r--src/openvic-simulation/research/Invention.cpp6
-rw-r--r--src/openvic-simulation/research/Technology.cpp4
20 files changed, 223 insertions, 87 deletions
diff --git a/src/openvic-simulation/economy/BuildingType.cpp b/src/openvic-simulation/economy/BuildingType.cpp
index a20aa36..e7c0d59 100644
--- a/src/openvic-simulation/economy/BuildingType.cpp
+++ b/src/openvic-simulation/economy/BuildingType.cpp
@@ -5,7 +5,7 @@ using namespace OpenVic::NodeTools;
BuildingType::BuildingType(
std::string_view identifier, building_type_args_t& building_type_args
-) : Modifier { identifier, std::move(building_type_args.modifier) },
+) : Modifier { identifier, std::move(building_type_args.modifier), modifier_type_t::BUILDING },
type { building_type_args.type },
on_completion { building_type_args.on_completion },
completion_size { building_type_args.completion_size },
@@ -154,6 +154,7 @@ bool BuildingTypeManager::load_buildings_file(
Logger::error("No port building type found!");
ret = false;
}
+
if (province_building_types.empty()) {
Logger::error("No province building types found!");
ret = false;
diff --git a/src/openvic-simulation/economy/GoodDefinition.cpp b/src/openvic-simulation/economy/GoodDefinition.cpp
index 82d3719..ed24549 100644
--- a/src/openvic-simulation/economy/GoodDefinition.cpp
+++ b/src/openvic-simulation/economy/GoodDefinition.cpp
@@ -123,12 +123,5 @@ bool GoodDefinitionManager::generate_modifiers(ModifierManager& modifier_manager
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, PERCENTAGE_DECIMAL,
- StringUtils::append_string_views("$ENCOURAGEMENT_FOR$$", good.get_identifier(), "$")
- );
- }
-
return ret;
}
diff --git a/src/openvic-simulation/map/Crime.cpp b/src/openvic-simulation/map/Crime.cpp
index 03da0fc..fb521ad 100644
--- a/src/openvic-simulation/map/Crime.cpp
+++ b/src/openvic-simulation/map/Crime.cpp
@@ -6,16 +6,18 @@ using namespace OpenVic::NodeTools;
Crime::Crime(
std::string_view new_identifier, ModifierValue&& new_values, icon_t new_icon, ConditionScript&& new_trigger,
bool new_default_active
-) : TriggeredModifier { new_identifier, std::move(new_values), new_icon, std::move(new_trigger) },
+) : TriggeredModifier { new_identifier, std::move(new_values), modifier_type_t::CRIME, new_icon, std::move(new_trigger) },
default_active { new_default_active } {}
bool CrimeManager::add_crime_modifier(
- std::string_view identifier, ModifierValue&& values, Modifier::icon_t icon, ConditionScript&& trigger, bool default_active
+ std::string_view identifier, ModifierValue&& values, IconModifier::icon_t icon, ConditionScript&& trigger,
+ bool default_active
) {
if (identifier.empty()) {
Logger::error("Invalid crime modifier effect identifier - empty!");
return false;
}
+
return crime_modifiers.add_item(
{ identifier, std::move(values), icon, std::move(trigger), default_active }, duplicate_warning_callback
);
@@ -26,7 +28,7 @@ bool CrimeManager::load_crime_modifiers(ModifierManager const& modifier_manager,
crime_modifiers,
[this, &modifier_manager](std::string_view key, ast::NodeCPtr value) -> bool {
ModifierValue modifier_value;
- Modifier::icon_t icon = 0;
+ IconModifier::icon_t icon = 0;
ConditionScript trigger { scope_t::PROVINCE, scope_t::NO_SCOPE, scope_t::NO_SCOPE };
bool default_active = false;
bool ret = modifier_manager.expect_modifier_value_and_keys(
@@ -39,14 +41,18 @@ bool CrimeManager::load_crime_modifiers(ModifierManager const& modifier_manager,
return ret;
}
)(root);
+
lock_crime_modifiers();
+
return ret;
}
bool CrimeManager::parse_scripts(DefinitionManager const& definition_manager) {
bool ret = true;
+
for (Crime& crime : crime_modifiers.get_items()) {
ret &= crime.parse_scripts(definition_manager);
}
+
return ret;
}
diff --git a/src/openvic-simulation/map/Crime.hpp b/src/openvic-simulation/map/Crime.hpp
index 757a75e..91fc88a 100644
--- a/src/openvic-simulation/map/Crime.hpp
+++ b/src/openvic-simulation/map/Crime.hpp
@@ -24,7 +24,7 @@ namespace OpenVic {
public:
bool add_crime_modifier(
- std::string_view identifier, ModifierValue&& values, Modifier::icon_t icon, ConditionScript&& trigger,
+ std::string_view identifier, ModifierValue&& values, IconModifier::icon_t icon, ConditionScript&& trigger,
bool default_active
);
diff --git a/src/openvic-simulation/map/MapDefinition.cpp b/src/openvic-simulation/map/MapDefinition.cpp
index f3bb619..488133c 100644
--- a/src/openvic-simulation/map/MapDefinition.cpp
+++ b/src/openvic-simulation/map/MapDefinition.cpp
@@ -744,7 +744,7 @@ bool MapDefinition::load_climate_file(ModifierManager const& modifier_manager, a
if (cur_climate == nullptr) {
ModifierValue values;
ret &= modifier_manager.expect_modifier_value(move_variable_callback(values))(node);
- ret &= climates.add_item({ identifier, std::move(values) });
+ ret &= climates.add_item({ identifier, std::move(values), Modifier::modifier_type_t::CLIMATE });
} else {
ret &= expect_list_reserve_length(*cur_climate, expect_province_definition_identifier(
[cur_climate, &identifier](ProvinceDefinition& province) {
@@ -807,7 +807,7 @@ bool MapDefinition::load_continent_file(ModifierManager const& modifier_manager,
))
)(node);
- Continent continent = { identifier, std::move(values) };
+ Continent continent { identifier, std::move(values), Modifier::modifier_type_t::CONTINENT };
continent.add_provinces(prov_list);
continent.lock();
diff --git a/src/openvic-simulation/map/Region.cpp b/src/openvic-simulation/map/Region.cpp
index d8c5fc1..d35ff56 100644
--- a/src/openvic-simulation/map/Region.cpp
+++ b/src/openvic-simulation/map/Region.cpp
@@ -10,15 +10,19 @@ bool ProvinceSet::add_province(ProvinceDefinition const* province) {
Logger::error("Cannot add province to province set - locked!");
return false;
}
+
if (province == nullptr) {
Logger::error("Cannot add province to province set - null province!");
return false;
}
+
if (contains_province(province)) {
Logger::warning("Cannot add province ", province->get_identifier(), " to province set - already in the set!");
return false;
}
+
provinces.push_back(province);
+
return true;
}
@@ -27,16 +31,20 @@ bool ProvinceSet::remove_province(ProvinceDefinition const* province) {
Logger::error("Cannot remove province from province set - locked!");
return false;
}
+
if (province == nullptr) {
Logger::error("Cannot remove province from province set - null province!");
return false;
}
+
const decltype(provinces)::const_iterator it = std::find(provinces.begin(), provinces.end(), province);
if (it == provinces.end()) {
Logger::warning("Cannot remove province ", province->get_identifier(), " from province set - already not in the set!");
return false;
}
+
provinces.erase(it);
+
return true;
}
@@ -84,8 +92,8 @@ bool ProvinceSet::contains_province(ProvinceDefinition const* province) const {
return province != nullptr && std::find(provinces.begin(), provinces.end(), province) != provinces.end();
}
-ProvinceSetModifier::ProvinceSetModifier(std::string_view new_identifier, ModifierValue&& new_values)
- : Modifier { new_identifier, std::move(new_values) } {}
+ProvinceSetModifier::ProvinceSetModifier(std::string_view new_identifier, ModifierValue&& new_values, modifier_type_t new_type)
+ : Modifier { new_identifier, std::move(new_values), new_type } {}
Region::Region(std::string_view new_identifier, colour_t new_colour, bool new_meta)
: HasIdentifierAndColour { new_identifier, new_colour, false }, meta { new_meta } {}
diff --git a/src/openvic-simulation/map/Region.hpp b/src/openvic-simulation/map/Region.hpp
index ef25b7b..d08ccc4 100644
--- a/src/openvic-simulation/map/Region.hpp
+++ b/src/openvic-simulation/map/Region.hpp
@@ -48,7 +48,7 @@ namespace OpenVic {
struct ProvinceSetModifier : Modifier, ProvinceSet {
friend struct MapDefinition;
private:
- ProvinceSetModifier(std::string_view new_identifier, ModifierValue&& new_values);
+ ProvinceSetModifier(std::string_view new_identifier, ModifierValue&& new_values, modifier_type_t new_type);
public:
ProvinceSetModifier(ProvinceSetModifier&&) = default;
};
diff --git a/src/openvic-simulation/map/TerrainType.cpp b/src/openvic-simulation/map/TerrainType.cpp
index 704e79e..b4cc430 100644
--- a/src/openvic-simulation/map/TerrainType.cpp
+++ b/src/openvic-simulation/map/TerrainType.cpp
@@ -7,7 +7,8 @@ using namespace OpenVic::NodeTools;
TerrainType::TerrainType(
std::string_view new_identifier, colour_t new_colour, ModifierValue&& new_modifier, bool new_is_water
-) : Modifier { new_identifier, std::move(new_modifier) }, HasColour { new_colour, false }, is_water { new_is_water } {}
+) : Modifier { new_identifier, std::move(new_modifier), modifier_type_t::TERRAIN }, HasColour { new_colour, false },
+ is_water { new_is_water } {}
TerrainTypeMapping::TerrainTypeMapping(
std::string_view new_identifier, TerrainType const& new_type, std::vector<index_t>&& new_terrain_indicies,
@@ -22,6 +23,7 @@ bool TerrainTypeManager::add_terrain_type(
Logger::error("Invalid terrain type identifier - empty!");
return false;
}
+
return terrain_types.add_item({ identifier, colour, std::move(values), is_water });
}
@@ -33,17 +35,22 @@ bool TerrainTypeManager::add_terrain_type_mapping(
Logger::error("Cannot register terrain type mappings until terrain types are locked!");
return false;
}
+
if (identifier.empty()) {
Logger::error("Invalid terrain type mapping identifier - empty!");
return false;
}
+
if (type == nullptr) {
Logger::error("Null terrain type for mapping ", identifier);
return false;
}
+
bool ret = true;
+
for (TerrainTypeMapping::index_t idx : terrain_indicies) {
const terrain_type_mappings_map_t::const_iterator it = terrain_type_mappings_map.find(idx);
+
if (it == terrain_type_mappings_map.end()) {
terrain_type_mappings_map.emplace(idx, terrain_type_mappings.size());
} else {
@@ -54,7 +61,9 @@ bool TerrainTypeManager::add_terrain_type_mapping(
ret = false;
}
}
+
ret &= terrain_type_mappings.add_item({ identifier, *type, std::move(terrain_indicies), priority, has_texture });
+
return ret;
}
@@ -73,7 +82,9 @@ node_callback_t TerrainTypeManager::_load_terrain_type_categories(ModifierManage
return ret;
}
)(root);
+
lock_terrain_types();
+
return ret;
};
}
@@ -83,10 +94,12 @@ bool TerrainTypeManager::_load_terrain_type_mapping(std::string_view mapping_key
Logger::error("Cannot define terrain type mapping before terrain texture limit: ", mapping_key);
return false;
}
+
if (!terrain_types_are_locked()) {
Logger::error("Cannot define terrain type mapping before categories: ", mapping_key);
return false;
}
+
TerrainType const* type = nullptr;
std::vector<TerrainTypeMapping::index_t> terrain_indicies;
TerrainTypeMapping::index_t priority = 0;
@@ -107,18 +120,23 @@ bool TerrainTypeManager::_load_terrain_type_mapping(std::string_view mapping_key
"priority", ZERO_OR_ONE, expect_uint(assign_variable_callback(priority)),
"has_texture", ZERO_OR_ONE, expect_bool(assign_variable_callback(has_texture))
)(mapping_value);
+
if (has_texture && ++terrain_texture_count == terrain_texture_limit + 1) {
Logger::warning("More terrain textures than limit!");
}
+
ret &= add_terrain_type_mapping(mapping_key, type, std::move(terrain_indicies), priority, has_texture);
+
return true;
}
TerrainTypeMapping const* TerrainTypeManager::get_terrain_type_mapping_for(TerrainTypeMapping::index_t idx) const {
const terrain_type_mappings_map_t::const_iterator it = terrain_type_mappings_map.find(idx);
+
if (it != terrain_type_mappings_map.end()) {
return terrain_type_mappings.get_item_by_index(it->second);
}
+
return nullptr;
}
@@ -135,6 +153,8 @@ bool TerrainTypeManager::load_terrain_types(ModifierManager const& modifier_mana
"terrain", ONE_EXACTLY, expect_uint(assign_variable_callback(terrain_texture_limit)),
"categories", ONE_EXACTLY, _load_terrain_type_categories(modifier_manager)
)(root);
+
lock_terrain_type_mappings();
+
return ret;
}
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. */
diff --git a/src/openvic-simulation/modifier/Modifier.cpp b/src/openvic-simulation/modifier/Modifier.cpp
index 28aa777..b26b8dd 100644
--- a/src/openvic-simulation/modifier/Modifier.cpp
+++ b/src/openvic-simulation/modifier/Modifier.cpp
@@ -129,12 +129,17 @@ void ModifierValue::multiply_add(ModifierValue const& other, fixed_point_t multi
}
}
-Modifier::Modifier(std::string_view new_identifier, ModifierValue&& new_values, icon_t new_icon)
- : HasIdentifier { new_identifier }, ModifierValue { std::move(new_values) }, icon { new_icon } {}
+Modifier::Modifier(std::string_view new_identifier, ModifierValue&& new_values, modifier_type_t new_type)
+ : HasIdentifier { new_identifier }, ModifierValue { std::move(new_values) }, type { new_type } {}
+
+IconModifier::IconModifier(
+ std::string_view new_identifier, ModifierValue&& new_values, modifier_type_t new_type, icon_t new_icon
+) : Modifier { new_identifier, std::move(new_values), new_type }, icon { new_icon } {}
TriggeredModifier::TriggeredModifier(
- std::string_view new_identifier, ModifierValue&& new_values, icon_t new_icon, ConditionScript&& new_trigger
-) : Modifier { new_identifier, std::move(new_values), new_icon }, trigger { std::move(new_trigger) } {}
+ std::string_view new_identifier, ModifierValue&& new_values, modifier_type_t new_type, icon_t new_icon,
+ ConditionScript&& new_trigger
+) : IconModifier { new_identifier, std::move(new_values), new_type, new_icon }, trigger { std::move(new_trigger) } {}
bool TriggeredModifier::parse_scripts(DefinitionManager const& definition_manager) {
return trigger.parse_script(false, definition_manager);
@@ -317,13 +322,6 @@ bool ModifierManager::setup_modifier_effects() {
ret &= add_modifier_effect("unit_recruitment_time", false);
ret &= add_modifier_effect("war_exhaustion", false, PROPORTION_DECIMAL, "WAR_EXHAUST_BATTLES");
- /* State only */
- // replace $VAL$ with effect value * 30 (as proportion decimal, only used in national foci)
- ret &= add_modifier_effect("flashpoint_tension", true, PROPORTION_DECIMAL, "increase_tension_focus_desc");
- // capitalist likelihood for railroads vs factories
- // replace $VAL$ with effect value (as proportion decimal, only used in national foci)
- ret &= add_modifier_effect("railroads", true, PROPORTION_DECIMAL, "railroad_build_desc");
-
/* Province Modifier Effects */
ret &= add_modifier_effect("assimilation_rate", true);
ret &= add_modifier_effect("boost_strongest_party", false);
@@ -411,12 +409,15 @@ std::string ModifierManager::get_flat_identifier(
return StringUtils::append_string_views(complex_modifier_identifier, " ", variant_identifier);
}
-bool ModifierManager::add_event_modifier(std::string_view identifier, ModifierValue&& values, Modifier::icon_t icon) {
+bool ModifierManager::add_event_modifier(std::string_view identifier, ModifierValue&& values, IconModifier::icon_t icon) {
if (identifier.empty()) {
Logger::error("Invalid event modifier effect identifier - empty!");
return false;
}
- return event_modifiers.add_item({ identifier, std::move(values), icon }, duplicate_warning_callback);
+
+ return event_modifiers.add_item(
+ { identifier, std::move(values), Modifier::modifier_type_t::EVENT, icon }, duplicate_warning_callback
+ );
}
bool ModifierManager::load_event_modifiers(ast::NodeCPtr root) {
@@ -424,7 +425,7 @@ bool ModifierManager::load_event_modifiers(ast::NodeCPtr root) {
event_modifiers,
[this](std::string_view key, ast::NodeCPtr value) -> bool {
ModifierValue modifier_value;
- Modifier::icon_t icon = 0;
+ IconModifier::icon_t icon = 0;
bool ret = expect_modifier_value_and_keys(
move_variable_callback(modifier_value),
"icon", ZERO_OR_ONE, expect_uint(assign_variable_callback(icon))
@@ -433,7 +434,9 @@ bool ModifierManager::load_event_modifiers(ast::NodeCPtr root) {
return ret;
}
)(root);
+
lock_event_modifiers();
+
return ret;
}
@@ -442,7 +445,10 @@ bool ModifierManager::add_static_modifier(std::string_view identifier, ModifierV
Logger::error("Invalid static modifier effect identifier - empty!");
return false;
}
- return static_modifiers.add_item({ identifier, std::move(values), 0 }, duplicate_warning_callback);
+
+ return static_modifiers.add_item(
+ { identifier, std::move(values), Modifier::modifier_type_t::STATIC }, duplicate_warning_callback
+ );
}
bool ModifierManager::load_static_modifiers(ast::NodeCPtr root) {
@@ -455,18 +461,24 @@ bool ModifierManager::load_static_modifiers(ast::NodeCPtr root) {
return ret;
}
)(root);
+
lock_static_modifiers();
+
return ret;
}
bool ModifierManager::add_triggered_modifier(
- std::string_view identifier, ModifierValue&& values, Modifier::icon_t icon, ConditionScript&& trigger
+ std::string_view identifier, ModifierValue&& values, IconModifier::icon_t icon, ConditionScript&& trigger
) {
if (identifier.empty()) {
Logger::error("Invalid triggered modifier effect identifier - empty!");
return false;
}
- return triggered_modifiers.add_item({ identifier, std::move(values), icon, std::move(trigger) }, duplicate_warning_callback);
+
+ return triggered_modifiers.add_item(
+ { identifier, std::move(values), Modifier::modifier_type_t::TRIGGERED, icon, std::move(trigger) },
+ duplicate_warning_callback
+ );
}
bool ModifierManager::load_triggered_modifiers(ast::NodeCPtr root) {
@@ -474,7 +486,7 @@ bool ModifierManager::load_triggered_modifiers(ast::NodeCPtr root) {
triggered_modifiers,
[this](std::string_view key, ast::NodeCPtr value) -> bool {
ModifierValue modifier_value;
- Modifier::icon_t icon = 0;
+ IconModifier::icon_t icon = 0;
ConditionScript trigger { scope_t::COUNTRY, scope_t::COUNTRY, scope_t::NO_SCOPE };
bool ret = expect_modifier_value_and_keys(
@@ -486,15 +498,19 @@ bool ModifierManager::load_triggered_modifiers(ast::NodeCPtr root) {
return ret;
}
)(root);
+
lock_triggered_modifiers();
+
return ret;
}
bool ModifierManager::parse_scripts(DefinitionManager const& definition_manager) {
bool ret = true;
+
for (TriggeredModifier& modifier : triggered_modifiers.get_items()) {
ret &= modifier.parse_scripts(definition_manager);
}
+
return ret;
}
diff --git a/src/openvic-simulation/modifier/Modifier.hpp b/src/openvic-simulation/modifier/Modifier.hpp
index f525d6a..80d2db6 100644
--- a/src/openvic-simulation/modifier/Modifier.hpp
+++ b/src/openvic-simulation/modifier/Modifier.hpp
@@ -79,6 +79,24 @@ namespace OpenVic {
struct Modifier : HasIdentifier, ModifierValue {
friend struct ModifierManager;
+ enum struct modifier_type_t : uint8_t {
+ EVENT, STATIC, TRIGGERED, CRIME, TERRAIN, CLIMATE, CONTINENT, BUILDING, LEADER, NATIONAL_VALUE, NATIONAL_FOCUS,
+ ISSUE, REFORM, TECHNOLOGY, INVENTION, TECH_SCHOOL
+ };
+
+ private:
+ const modifier_type_t PROPERTY(type);
+
+ protected:
+ Modifier(std::string_view new_identifier, ModifierValue&& new_values, modifier_type_t new_type);
+
+ public:
+ Modifier(Modifier&&) = default;
+ };
+
+ struct IconModifier : Modifier {
+ friend struct ModifierManager;
+
using icon_t = uint8_t;
private:
@@ -86,13 +104,13 @@ namespace OpenVic {
const icon_t PROPERTY(icon);
protected:
- Modifier(std::string_view new_identifier, ModifierValue&& new_values, icon_t new_icon = 0);
+ IconModifier(std::string_view new_identifier, ModifierValue&& new_values, modifier_type_t new_type, icon_t new_icon);
public:
- Modifier(Modifier&&) = default;
+ IconModifier(IconModifier&&) = default;
};
- struct TriggeredModifier : Modifier {
+ struct TriggeredModifier : IconModifier {
friend struct ModifierManager;
private:
@@ -100,7 +118,8 @@ namespace OpenVic {
protected:
TriggeredModifier(
- std::string_view new_identifier, ModifierValue&& new_values, icon_t new_icon, ConditionScript&& new_trigger
+ std::string_view new_identifier, ModifierValue&& new_values, modifier_type_t new_type, icon_t new_icon,
+ ConditionScript&& new_trigger
);
bool parse_scripts(DefinitionManager const& definition_manager);
@@ -131,7 +150,7 @@ namespace OpenVic {
CaseInsensitiveIdentifierRegistry<ModifierEffect, RegistryStorageInfoDeque> IDENTIFIER_REGISTRY(modifier_effect);
case_insensitive_string_set_t complex_modifiers;
- IdentifierRegistry<Modifier> IDENTIFIER_REGISTRY(event_modifier);
+ IdentifierRegistry<IconModifier> IDENTIFIER_REGISTRY(event_modifier);
IdentifierRegistry<Modifier> IDENTIFIER_REGISTRY(static_modifier);
IdentifierRegistry<TriggeredModifier> IDENTIFIER_REGISTRY(triggered_modifier);
@@ -155,14 +174,14 @@ namespace OpenVic {
bool setup_modifier_effects();
- bool add_event_modifier(std::string_view identifier, ModifierValue&& values, Modifier::icon_t icon);
+ bool add_event_modifier(std::string_view identifier, ModifierValue&& values, IconModifier::icon_t icon);
bool load_event_modifiers(ast::NodeCPtr root);
bool add_static_modifier(std::string_view identifier, ModifierValue&& values);
bool load_static_modifiers(ast::NodeCPtr root);
bool add_triggered_modifier(
- std::string_view identifier, ModifierValue&& values, Modifier::icon_t icon, ConditionScript&& trigger
+ std::string_view identifier, ModifierValue&& values, IconModifier::icon_t icon, ConditionScript&& trigger
);
bool load_triggered_modifiers(ast::NodeCPtr root);
diff --git a/src/openvic-simulation/politics/Issue.cpp b/src/openvic-simulation/politics/Issue.cpp
index 4a08dea..3174e23 100644
--- a/src/openvic-simulation/politics/Issue.cpp
+++ b/src/openvic-simulation/politics/Issue.cpp
@@ -7,8 +7,8 @@ IssueGroup::IssueGroup(std::string_view new_identifier) : HasIdentifier { new_id
Issue::Issue(
std::string_view new_identifier, colour_t new_colour, ModifierValue&& new_values, IssueGroup const& new_group,
- RuleSet&& new_rules, bool new_jingoism
-) : Modifier { new_identifier, std::move(new_values) }, HasColour { new_colour, false }, group { new_group },
+ RuleSet&& new_rules, bool new_jingoism, modifier_type_t new_type
+) : Modifier { new_identifier, std::move(new_values), new_type }, HasColour { new_colour, false }, group { new_group },
rules { std::move(new_rules) }, jingoism { new_jingoism } {}
ReformType::ReformType(std::string_view new_identifier, bool new_uncivilised)
@@ -21,16 +21,19 @@ Reform::Reform(
std::string_view new_identifier, colour_t new_colour, ModifierValue&& new_values, ReformGroup const& new_group,
size_t new_ordinal, fixed_point_t new_administrative_multiplier, RuleSet&& new_rules, tech_cost_t new_technology_cost,
ConditionScript&& new_allow, ConditionScript&& new_on_execute_trigger, EffectScript&& new_on_execute_effect
-) : Issue { new_identifier, new_colour, std::move(new_values), new_group, std::move(new_rules), false },
- reform_group { new_group }, ordinal { new_ordinal }, administrative_multiplier { new_administrative_multiplier },
+) : Issue {
+ new_identifier, new_colour, std::move(new_values), new_group, std::move(new_rules), false, modifier_type_t::REFORM
+ }, reform_group { new_group }, ordinal { new_ordinal }, administrative_multiplier { new_administrative_multiplier },
technology_cost { new_technology_cost }, allow { std::move(new_allow) },
on_execute_trigger { std::move(new_on_execute_trigger) }, on_execute_effect { std::move(new_on_execute_effect) } {}
bool Reform::parse_scripts(DefinitionManager const& definition_manager) {
bool ret = true;
+
ret &= allow.parse_script(true, definition_manager);
ret &= on_execute_trigger.parse_script(true, definition_manager);
ret &= on_execute_effect.parse_script(true, definition_manager);
+
return ret;
}
@@ -176,14 +179,17 @@ bool IssueManager::_load_issue(
ModifierValue values;
RuleSet rules;
bool jingoism = false;
+
bool ret = modifier_manager.expect_modifier_value_and_keys(move_variable_callback(values),
"is_jingoism", ZERO_OR_ONE, expect_bool(assign_variable_callback(jingoism)),
"rules", ZERO_OR_ONE, rule_manager.expect_rule_set(move_variable_callback(rules))
)(node);
+
ret &= add_issue(
identifier, create_issue_reform_colour(get_issue_count() + get_reform_count()), std::move(values), group,
std::move(rules), jingoism
);
+
return ret;
}
@@ -191,12 +197,15 @@ bool IssueManager::_load_reform_group(
size_t& expected_reforms, std::string_view identifier, ReformType const* type, ast::NodeCPtr node
) {
bool ordered = false, administrative = false;
+
bool ret = expect_dictionary_keys_and_default(
increment_callback(expected_reforms),
"next_step_only", ZERO_OR_ONE, expect_bool(assign_variable_callback(ordered)),
"administrative", ZERO_OR_ONE, expect_bool(assign_variable_callback(administrative))
)(node);
+
ret &= add_reform_group(identifier, type, ordered, administrative);
+
return ret;
}
@@ -223,11 +232,13 @@ bool IssueManager::_load_reform(
"effect", ONE_EXACTLY, on_execute_effect.expect_script()
)
)(node);
+
ret &= add_reform(
identifier, create_issue_reform_colour(get_issue_count() + get_reform_count()), std::move(values), group, ordinal,
administrative_multiplier, std::move(rules), technology_cost, std::move(allow), std::move(on_execute_trigger),
std::move(on_execute_effect)
);
+
return ret;
}
@@ -272,6 +283,7 @@ bool IssueManager::load_issues_file(
}
}
)(root);
+
lock_reform_types();
reserve_more_issue_groups(expected_issue_groups);
@@ -306,6 +318,7 @@ bool IssueManager::load_issues_file(
}
}
)(root);
+
lock_issue_groups();
lock_reform_groups();
@@ -356,6 +369,7 @@ bool IssueManager::load_issues_file(
}
}
)(root);
+
lock_issues();
lock_reforms();
@@ -364,8 +378,10 @@ bool IssueManager::load_issues_file(
bool IssueManager::parse_scripts(DefinitionManager const& definition_manager) {
bool ret = true;
+
for (Reform& reform : reforms.get_items()) {
ret &= reform.parse_scripts(definition_manager);
}
+
return ret;
}
diff --git a/src/openvic-simulation/politics/Issue.hpp b/src/openvic-simulation/politics/Issue.hpp
index 9f2d842..c0ab86c 100644
--- a/src/openvic-simulation/politics/Issue.hpp
+++ b/src/openvic-simulation/politics/Issue.hpp
@@ -32,7 +32,7 @@ namespace OpenVic {
protected:
Issue(
std::string_view new_identifier, colour_t new_colour, ModifierValue&& new_values, IssueGroup const& new_group,
- RuleSet&& new_rules, bool new_jingoism
+ RuleSet&& new_rules, bool new_jingoism, modifier_type_t new_type = modifier_type_t::ISSUE
);
public:
diff --git a/src/openvic-simulation/politics/NationalFocus.cpp b/src/openvic-simulation/politics/NationalFocus.cpp
index 3132c3e..4887ed6 100644
--- a/src/openvic-simulation/politics/NationalFocus.cpp
+++ b/src/openvic-simulation/politics/NationalFocus.cpp
@@ -1,6 +1,8 @@
#include "NationalFocus.hpp"
+#include "openvic-simulation/economy/GoodDefinition.hpp"
#include "openvic-simulation/politics/Ideology.hpp"
+#include "openvic-simulation/pop/Pop.hpp"
using namespace OpenVic;
using namespace OpenVic::NodeTools;
@@ -12,20 +14,28 @@ NationalFocus::NationalFocus(
NationalFocusGroup const& new_group,
uint8_t new_icon,
bool new_has_flashpoint,
+ fixed_point_t new_flashpoint_tension,
bool new_own_provinces,
bool new_outliner_show_as_percent,
ModifierValue&& new_modifiers,
Ideology const* new_loyalty_ideology,
fixed_point_t new_loyalty_value,
+ fixed_point_t new_encourage_railroads,
+ fixed_point_map_t<GoodDefinition const*>&& new_encourage_goods,
+ fixed_point_map_t<PopType const*>&& new_encourage_pop_types,
ConditionScript&& new_limit
-) : Modifier { new_identifier, std::move(new_modifiers) },
+) : Modifier { new_identifier, std::move(new_modifiers), modifier_type_t::NATIONAL_FOCUS },
group { new_group },
icon { new_icon },
has_flashpoint { new_has_flashpoint },
+ flashpoint_tension { new_flashpoint_tension },
own_provinces { new_own_provinces },
outliner_show_as_percent { new_outliner_show_as_percent },
loyalty_ideology { new_loyalty_ideology },
loyalty_value { new_loyalty_value },
+ encourage_railroads { new_encourage_railroads },
+ encourage_goods { std::move(new_encourage_goods) },
+ encourage_pop_types { std::move(new_encourage_pop_types) },
limit { std::move(new_limit) } {}
bool NationalFocus::parse_scripts(DefinitionManager const& definition_manager) {
@@ -37,6 +47,7 @@ inline bool NationalFocusManager::add_national_focus_group(std::string_view iden
Logger::error("No identifier for national focus group!");
return false;
}
+
return national_focus_groups.add_item({ identifier });
}
@@ -45,30 +56,38 @@ inline bool NationalFocusManager::add_national_focus(
NationalFocusGroup const& group,
uint8_t icon,
bool has_flashpoint,
+ fixed_point_t flashpoint_tension,
bool own_provinces,
bool outliner_show_as_percent,
ModifierValue&& modifiers,
Ideology const* loyalty_ideology,
fixed_point_t loyalty_value,
+ fixed_point_t encourage_railroads,
+ fixed_point_map_t<GoodDefinition const*>&& encourage_goods,
+ fixed_point_map_t<PopType const*>&& encourage_pop_types,
ConditionScript&& limit
) {
if (identifier.empty()) {
Logger::error("No identifier for national focus!");
return false;
}
+
if (icon < 1) {
Logger::error("Invalid icon ", icon, " for national focus ", identifier);
return false;
}
+
if ((loyalty_ideology == nullptr) != (loyalty_value == 0)) {
Logger::warning(
"Party loyalty incorrectly defined for national focus ", identifier, ": ideology = ", loyalty_ideology,
", value = ", loyalty_value
);
}
+
return national_foci.add_item({
- identifier, group, icon, has_flashpoint, own_provinces, outliner_show_as_percent, std::move(modifiers),
- loyalty_ideology, loyalty_value, std::move(limit)
+ identifier, group, icon, has_flashpoint, flashpoint_tension, own_provinces, outliner_show_as_percent,
+ std::move(modifiers), loyalty_ideology, loyalty_value, encourage_railroads, std::move(encourage_goods),
+ std::move(encourage_pop_types), std::move(limit)
});
}
@@ -77,12 +96,14 @@ bool NationalFocusManager::load_national_foci_file(
GoodDefinitionManager const& good_definition_manager, ModifierManager const& modifier_manager, ast::NodeCPtr root
) {
size_t expected_national_foci = 0;
+
bool ret = expect_dictionary_reserve_length(
national_focus_groups,
[this, &expected_national_foci](std::string_view identifier, ast::NodeCPtr node) -> bool {
return expect_length(add_variable_callback(expected_national_foci))(node) & add_national_focus_group(identifier);
}
)(root);
+
lock_national_focus_groups();
reserve_more_national_foci(expected_national_foci);
@@ -97,29 +118,51 @@ bool NationalFocusManager::load_national_foci_file(
) -> bool {
uint8_t icon = 0;
bool has_flashpoint = false, own_provinces = true, outliner_show_as_percent = false;
+ fixed_point_t flashpoint_tension = 0;
ModifierValue modifiers;
Ideology const* loyalty_ideology = nullptr;
fixed_point_t loyalty_value = 0;
+ fixed_point_t encourage_railroads = 0;
+ fixed_point_map_t<GoodDefinition const*> encourage_goods;
+ fixed_point_map_t<PopType const*> encourage_pop_types;
ConditionScript limit {
scope_t::PROVINCE | scope_t::COUNTRY, scope_t::PROVINCE | scope_t::COUNTRY, scope_t::NO_SCOPE
};
- bool ret = modifier_manager.expect_modifier_value_and_keys(
+ bool ret = modifier_manager.expect_modifier_value_and_keys_and_default(
move_variable_callback(modifiers),
+ [&good_definition_manager, &encourage_goods, &pop_manager, &encourage_pop_types](
+ std::string_view key, ast::NodeCPtr value
+ ) -> bool {
+ GoodDefinition const* good = good_definition_manager.get_good_definition_by_identifier(key);
+ if (good != nullptr) {
+ return expect_fixed_point(map_callback(encourage_goods, good))(value);
+ }
+
+ PopType const* pop_type = pop_manager.get_pop_type_by_identifier(key);
+ if (pop_type != nullptr) {
+ return expect_fixed_point(map_callback(encourage_pop_types, pop_type))(value);
+ }
+
+ return key_value_invalid_callback(key, value);
+ },
"icon", ONE_EXACTLY, expect_uint(assign_variable_callback(icon)),
"ideology", ZERO_OR_ONE,
ideology_manager.expect_ideology_identifier(assign_variable_callback_pointer(loyalty_ideology)),
"loyalty_value", ZERO_OR_ONE, expect_fixed_point(assign_variable_callback(loyalty_value)),
"limit", ZERO_OR_ONE, limit.expect_script(),
"has_flashpoint", ZERO_OR_ONE, expect_bool(assign_variable_callback(has_flashpoint)),
+ "flashpoint_tension", ZERO_OR_ONE, expect_fixed_point(assign_variable_callback(flashpoint_tension)),
"own_provinces", ZERO_OR_ONE, expect_bool(assign_variable_callback(own_provinces)),
"outliner_show_as_percent", ZERO_OR_ONE,
- expect_bool(assign_variable_callback(outliner_show_as_percent))
+ expect_bool(assign_variable_callback(outliner_show_as_percent)),
+ "railroads", ZERO_OR_ONE, expect_fixed_point(assign_variable_callback(encourage_railroads))
)(node);
ret &= add_national_focus(
- identifier, group, icon, has_flashpoint, own_provinces, outliner_show_as_percent, std::move(modifiers),
- loyalty_ideology, loyalty_value, std::move(limit)
+ identifier, group, icon, has_flashpoint, flashpoint_tension, own_provinces, outliner_show_as_percent,
+ std::move(modifiers), loyalty_ideology, loyalty_value, encourage_railroads,
+ std::move(encourage_goods), std::move(encourage_pop_types), std::move(limit)
);
return ret;
@@ -127,6 +170,7 @@ bool NationalFocusManager::load_national_foci_file(
)(group_node);
}
)(root);
+
lock_national_foci();
return ret;
@@ -134,8 +178,10 @@ bool NationalFocusManager::load_national_foci_file(
bool NationalFocusManager::parse_scripts(DefinitionManager const& definition_manager) {
bool ret = true;
+
for (NationalFocus& national_focus : national_foci.get_items()) {
ret &= national_focus.parse_scripts(definition_manager);
}
+
return ret;
}
diff --git a/src/openvic-simulation/politics/NationalFocus.hpp b/src/openvic-simulation/politics/NationalFocus.hpp
index 327b25b..e046c7a 100644
--- a/src/openvic-simulation/politics/NationalFocus.hpp
+++ b/src/openvic-simulation/politics/NationalFocus.hpp
@@ -16,6 +16,8 @@ namespace OpenVic {
};
struct Ideology;
+ struct GoodDefinition;
+ struct PopType;
struct NationalFocus : Modifier {
friend struct NationalFocusManager;
@@ -24,10 +26,14 @@ namespace OpenVic {
NationalFocusGroup const& PROPERTY(group);
uint8_t PROPERTY(icon);
bool PROPERTY(has_flashpoint);
+ fixed_point_t PROPERTY(flashpoint_tension);
bool PROPERTY(own_provinces);
bool PROPERTY(outliner_show_as_percent);
Ideology const* PROPERTY(loyalty_ideology);
fixed_point_t PROPERTY(loyalty_value);
+ fixed_point_t PROPERTY(encourage_railroads);
+ fixed_point_map_t<GoodDefinition const*> PROPERTY(encourage_goods);
+ fixed_point_map_t<PopType const*> PROPERTY(encourage_pop_types);
ConditionScript PROPERTY(limit);
NationalFocus(
@@ -35,11 +41,15 @@ namespace OpenVic {
NationalFocusGroup const& new_group,
uint8_t new_icon,
bool new_has_flashpoint,
+ fixed_point_t new_flashpoint_tension,
bool new_own_provinces,
bool new_outliner_show_as_percent,
ModifierValue&& new_modifiers,
Ideology const* new_loyalty_ideology,
fixed_point_t new_loyalty_value,
+ fixed_point_t new_encourage_railroads,
+ fixed_point_map_t<GoodDefinition const*>&& new_encourage_goods,
+ fixed_point_map_t<PopType const*>&& new_encourage_pop_types,
ConditionScript&& new_limit
);
@@ -66,11 +76,15 @@ namespace OpenVic {
NationalFocusGroup const& group,
uint8_t icon,
bool has_flashpoint,
+ fixed_point_t flashpoint_tension,
bool own_provinces,
bool outliner_show_as_percent,
ModifierValue&& modifiers,
Ideology const* loyalty_ideology,
fixed_point_t loyalty_value,
+ fixed_point_t encourage_railroads,
+ fixed_point_map_t<GoodDefinition const*>&& encourage_goods,
+ fixed_point_map_t<PopType const*>&& encourage_pop_types,
ConditionScript&& limit
);
diff --git a/src/openvic-simulation/politics/NationalValue.cpp b/src/openvic-simulation/politics/NationalValue.cpp
index b780195..e9f7f2a 100644
--- a/src/openvic-simulation/politics/NationalValue.cpp
+++ b/src/openvic-simulation/politics/NationalValue.cpp
@@ -4,7 +4,7 @@ using namespace OpenVic;
using namespace OpenVic::NodeTools;
NationalValue::NationalValue(std::string_view new_identifier, ModifierValue&& new_modifiers)
- : Modifier { new_identifier, std::move(new_modifiers) } {}
+ : Modifier { new_identifier, std::move(new_modifiers), modifier_type_t::NATIONAL_VALUE } {}
bool NationalValueManager::add_national_value(std::string_view identifier, ModifierValue&& modifiers) {
if (identifier.empty()) {
diff --git a/src/openvic-simulation/pop/Pop.cpp b/src/openvic-simulation/pop/Pop.cpp
index d534fed..dd829d9 100644
--- a/src/openvic-simulation/pop/Pop.cpp
+++ b/src/openvic-simulation/pop/Pop.cpp
@@ -674,13 +674,6 @@ bool PopManager::generate_modifiers(ModifierManager& modifier_manager) const {
strata_modifier("_luxury_needs", false);
}
- for (PopType const& pop_type : get_pop_types()) {
- ret &= modifier_manager.add_modifier_effect(
- pop_type.get_identifier(), true, PROPORTION_DECIMAL,
- StringUtils::append_string_views("$ENCOURAGEMENT_FOR$$", pop_type.get_identifier(), "$")
- );
- }
-
return ret;
}
diff --git a/src/openvic-simulation/research/Invention.cpp b/src/openvic-simulation/research/Invention.cpp
index 5ecfcdc..299cefb 100644
--- a/src/openvic-simulation/research/Invention.cpp
+++ b/src/openvic-simulation/research/Invention.cpp
@@ -18,7 +18,7 @@ Invention::Invention(
bool new_unlock_gas_defence,
ConditionScript&& new_limit,
ConditionalWeight&& new_chance
-) : Modifier { new_identifier, std::move(new_values) },
+) : Modifier { new_identifier, std::move(new_values), modifier_type_t::INVENTION },
news { new_news },
activated_units { std::move(new_activated_units) },
activated_buildings { std::move(new_activated_buildings) },
@@ -30,8 +30,10 @@ Invention::Invention(
bool Invention::parse_scripts(DefinitionManager const& definition_manager) {
bool ret = true;
+
ret &= limit.parse_script(false, definition_manager);
ret &= chance.parse_scripts(definition_manager);
+
return ret;
}
@@ -104,8 +106,10 @@ bool InventionManager::load_inventions_file(
bool InventionManager::parse_scripts(DefinitionManager const& definition_manager) {
bool ret = true;
+
for (Invention& invention : inventions.get_items()) {
ret &= invention.parse_scripts(definition_manager);
}
+
return ret;
}
diff --git a/src/openvic-simulation/research/Technology.cpp b/src/openvic-simulation/research/Technology.cpp
index 847c4b0..a5256f3 100644
--- a/src/openvic-simulation/research/Technology.cpp
+++ b/src/openvic-simulation/research/Technology.cpp
@@ -19,7 +19,7 @@ Technology::Technology(
building_set_t&& new_activated_buildings,
ModifierValue&& new_values,
ConditionalWeight&& new_ai_chance
-) : Modifier { new_identifier, std::move(new_values) },
+) : Modifier { new_identifier, std::move(new_values), modifier_type_t::TECHNOLOGY },
area { new_area },
year { new_year },
cost { new_cost },
@@ -34,7 +34,7 @@ bool Technology::parse_scripts(DefinitionManager const& definition_manager) {
}
TechnologySchool::TechnologySchool(std::string_view new_identifier, ModifierValue&& new_values)
- : Modifier { new_identifier, std::move(new_values) } {}
+ : Modifier { new_identifier, std::move(new_values), modifier_type_t::TECH_SCHOOL } {}
bool TechnologyManager::add_technology_folder(std::string_view identifier) {
if (identifier.empty()) {