aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/pop
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/pop')
-rw-r--r--src/openvic-simulation/pop/Culture.cpp15
-rw-r--r--src/openvic-simulation/pop/Culture.hpp12
-rw-r--r--src/openvic-simulation/pop/Pop.cpp23
-rw-r--r--src/openvic-simulation/pop/Pop.hpp3
-rw-r--r--src/openvic-simulation/pop/Religion.cpp3
5 files changed, 36 insertions, 20 deletions
diff --git a/src/openvic-simulation/pop/Culture.cpp b/src/openvic-simulation/pop/Culture.cpp
index 85c96a0..ebac344 100644
--- a/src/openvic-simulation/pop/Culture.cpp
+++ b/src/openvic-simulation/pop/Culture.cpp
@@ -57,7 +57,8 @@ bool CultureManager::add_graphical_culture_type(std::string_view identifier) {
return graphical_culture_types.add_item({ identifier });
}
-bool CultureManager::add_culture_group(std::string_view identifier, std::string_view leader, GraphicalCultureType const* graphical_culture_type, bool is_overseas) {
+bool CultureManager::add_culture_group(std::string_view identifier, std::string_view leader,
+ GraphicalCultureType const* graphical_culture_type, bool is_overseas) {
if (!graphical_culture_types.is_locked()) {
Logger::error("Cannot register culture groups until graphical culture types are locked!");
return false;
@@ -77,7 +78,8 @@ bool CultureManager::add_culture_group(std::string_view identifier, std::string_
return culture_groups.add_item({ identifier, leader, *graphical_culture_type, is_overseas });
}
-bool CultureManager::add_culture(std::string_view identifier, colour_t colour, CultureGroup const* group, std::vector<std::string>&& first_names, std::vector<std::string>&& last_names) {
+bool CultureManager::add_culture(std::string_view identifier, colour_t colour, CultureGroup const* group,
+ std::vector<std::string>&& first_names, std::vector<std::string>&& last_names) {
if (!culture_groups.is_locked()) {
Logger::error("Cannot register cultures until culture groups are locked!");
return false;
@@ -119,7 +121,8 @@ bool CultureManager::_load_culture_group(size_t& total_expected_cultures,
bool ret = expect_dictionary_keys_and_default(
increment_callback(total_expected_cultures),
"leader", ONE_EXACTLY, expect_identifier(assign_variable_callback(leader)),
- "unit", ZERO_OR_ONE, expect_graphical_culture_type_identifier(assign_variable_callback_pointer(unit_graphical_culture_type)),
+ "unit", ZERO_OR_ONE,
+ expect_graphical_culture_type_identifier(assign_variable_callback_pointer(unit_graphical_culture_type)),
"union", ZERO_OR_ONE, success_callback,
"is_overseas", ZERO_OR_ONE, expect_bool(assign_variable_callback(is_overseas))
)(culture_group_node);
@@ -171,7 +174,8 @@ bool CultureManager::load_culture_file(ast::NodeCPtr root) {
}
static const std::string default_unit_graphical_culture_type_identifier = "Generic";
- GraphicalCultureType const* const default_unit_graphical_culture_type = get_graphical_culture_type_by_identifier(default_unit_graphical_culture_type_identifier);
+ GraphicalCultureType const* const default_unit_graphical_culture_type =
+ get_graphical_culture_type_by_identifier(default_unit_graphical_culture_type_identifier);
if (default_unit_graphical_culture_type == nullptr) {
Logger::error("Failed to find default unit graphical culture type: ", default_unit_graphical_culture_type_identifier);
}
@@ -179,7 +183,8 @@ bool CultureManager::load_culture_file(ast::NodeCPtr root) {
size_t total_expected_cultures = 0;
bool ret = expect_dictionary_reserve_length(
culture_groups,
- [this, default_unit_graphical_culture_type, &total_expected_cultures](std::string_view key, ast::NodeCPtr value) -> bool {
+ [this, default_unit_graphical_culture_type, &total_expected_cultures](
+ std::string_view key, ast::NodeCPtr value) -> bool {
return _load_culture_group(total_expected_cultures, default_unit_graphical_culture_type, key, value);
}
)(root);
diff --git a/src/openvic-simulation/pop/Culture.hpp b/src/openvic-simulation/pop/Culture.hpp
index 688733e..ca70c16 100644
--- a/src/openvic-simulation/pop/Culture.hpp
+++ b/src/openvic-simulation/pop/Culture.hpp
@@ -26,7 +26,8 @@ namespace OpenVic {
// TODO - union tag
- CultureGroup(std::string_view new_identifier, std::string_view new_leader, GraphicalCultureType const& new_unit_graphical_culture_type, bool new_is_overseas);
+ CultureGroup(std::string_view new_identifier, std::string_view new_leader,
+ GraphicalCultureType const& new_unit_graphical_culture_type, bool new_is_overseas);
public:
CultureGroup(CultureGroup&&) = default;
@@ -45,7 +46,8 @@ namespace OpenVic {
// TODO - radicalism, primary tag
- Culture(std::string_view new_identifier, colour_t new_colour, CultureGroup const& new_group, std::vector<std::string>&& new_first_names, std::vector<std::string>&& new_last_names);
+ Culture(std::string_view new_identifier, colour_t new_colour, CultureGroup const& new_group,
+ std::vector<std::string>&& new_first_names, std::vector<std::string>&& new_last_names);
public:
Culture(Culture&&) = default;
@@ -71,10 +73,12 @@ namespace OpenVic {
bool add_graphical_culture_type(std::string_view identifier);
IDENTIFIER_REGISTRY_ACCESSORS(graphical_culture_type)
- bool add_culture_group(std::string_view identifier, std::string_view leader, GraphicalCultureType const* new_graphical_culture_type, bool is_overseas);
+ bool add_culture_group(std::string_view identifier, std::string_view leader,
+ GraphicalCultureType const* new_graphical_culture_type, bool is_overseas);
IDENTIFIER_REGISTRY_ACCESSORS(culture_group)
- bool add_culture(std::string_view identifier, colour_t colour, CultureGroup const* group, std::vector<std::string>&& first_names, std::vector<std::string>&& last_names);
+ bool add_culture(std::string_view identifier, colour_t colour, CultureGroup const* group,
+ std::vector<std::string>&& first_names, std::vector<std::string>&& last_names);
IDENTIFIER_REGISTRY_ACCESSORS(culture)
bool load_graphical_culture_type_file(ast::NodeCPtr root);
diff --git a/src/openvic-simulation/pop/Pop.cpp b/src/openvic-simulation/pop/Pop.cpp
index 5286393..761e5ff 100644
--- a/src/openvic-simulation/pop/Pop.cpp
+++ b/src/openvic-simulation/pop/Pop.cpp
@@ -147,15 +147,17 @@ bool PopManager::add_pop_type(std::string_view identifier, colour_t colour, PopT
Logger::error("Invalid pop type merge max size for ", identifier, ": ", merge_max_size);
return false;
}
- return pop_types.add_item({ identifier, colour, strata, sprite, std::move(life_needs), std::move(everyday_needs),
- std::move(luxury_needs), std::move(rebel_units), max_size, merge_max_size, state_capital_only, demote_migrant,
- is_artisan, is_slave });
+ return pop_types.add_item({
+ identifier, colour, strata, sprite, std::move(life_needs), std::move(everyday_needs), std::move(luxury_needs),
+ std::move(rebel_units), max_size, merge_max_size, state_capital_only, demote_migrant, is_artisan, is_slave
+ });
}
/* REQUIREMENTS:
* POP-3, POP-4, POP-5, POP-6, POP-7, POP-8, POP-9, POP-10, POP-11, POP-12, POP-13, POP-14
*/
-bool PopManager::load_pop_type_file(std::string_view filestem, UnitManager const& unit_manager, GoodManager const& good_manager, ast::NodeCPtr root) {
+bool PopManager::load_pop_type_file(std::string_view filestem, UnitManager const& unit_manager,
+ GoodManager const& good_manager, ast::NodeCPtr root) {
static const string_map_t<PopType::strata_t> strata_map = {
{ "poor", PopType::strata_t::POOR },
{ "middle", PopType::strata_t::MIDDLE },
@@ -209,13 +211,15 @@ bool PopManager::load_pop_type_file(std::string_view filestem, UnitManager const
"unemployment", ZERO_OR_ONE, success_callback
)(root);
- ret &= add_pop_type(filestem, colour, strata, sprite, std::move(life_needs), std::move(everyday_needs),
- std::move(luxury_needs), std::move(rebel_units), max_size, merge_max_size, state_capital_only, demote_migrant,
- is_artisan, is_slave);
+ ret &= add_pop_type(
+ filestem, colour, strata, sprite, std::move(life_needs), std::move(everyday_needs), std::move(luxury_needs),
+ std::move(rebel_units), max_size, merge_max_size, state_capital_only, demote_migrant, is_artisan, is_slave
+ );
return ret;
}
-bool PopManager::load_pop_into_province(Province& province, std::string_view pop_type_identifier, ast::NodeCPtr pop_node) const {
+bool PopManager::load_pop_into_province(Province& province, std::string_view pop_type_identifier,
+ ast::NodeCPtr pop_node) const {
PopType const* type = get_pop_type_by_identifier(pop_type_identifier);
Culture const* culture = nullptr;
Religion const* religion = nullptr;
@@ -231,7 +235,8 @@ bool PopManager::load_pop_into_province(Province& province, std::string_view pop
if (type != nullptr && culture != nullptr && religion != nullptr && size > 0) {
ret &= province.add_pop({ *type, *culture, *religion, size });
} else {
- Logger::warning("Some pop arguments are invalid: province = ", province, ", type = ", type, ", culture = ", culture, ", religion = ", religion, ", size = ", size);
+ Logger::warning("Some pop arguments are invalid: province = ", province, ", type = ", type,
+ ", culture = ", culture, ", religion = ", religion, ", size = ", size);
}
return ret;
}
diff --git a/src/openvic-simulation/pop/Pop.hpp b/src/openvic-simulation/pop/Pop.hpp
index 7261831..cba9f3c 100644
--- a/src/openvic-simulation/pop/Pop.hpp
+++ b/src/openvic-simulation/pop/Pop.hpp
@@ -108,7 +108,8 @@ namespace OpenVic {
bool state_capital_only, bool demote_migrant, bool is_artisan, bool is_slave);
IDENTIFIER_REGISTRY_ACCESSORS(pop_type)
- bool load_pop_type_file(std::string_view filestem, UnitManager const& unit_manager, GoodManager const& good_manager, ast::NodeCPtr root);
+ bool load_pop_type_file(std::string_view filestem, UnitManager const& unit_manager,
+ GoodManager const& good_manager, ast::NodeCPtr root);
bool load_pop_into_province(Province& province, std::string_view pop_type_identifier, ast::NodeCPtr pop_node) const;
};
}
diff --git a/src/openvic-simulation/pop/Religion.cpp b/src/openvic-simulation/pop/Religion.cpp
index 1152ae5..a685fca 100644
--- a/src/openvic-simulation/pop/Religion.cpp
+++ b/src/openvic-simulation/pop/Religion.cpp
@@ -40,7 +40,8 @@ bool ReligionManager::add_religion_group(std::string_view identifier) {
return religion_groups.add_item({ identifier });
}
-bool ReligionManager::add_religion(std::string_view identifier, colour_t colour, ReligionGroup const* group, Religion::icon_t icon, bool pagan) {
+bool ReligionManager::add_religion(std::string_view identifier, colour_t colour,
+ ReligionGroup const* group, Religion::icon_t icon, bool pagan) {
if (!religion_groups.is_locked()) {
Logger::error("Cannot register religions until religion groups are locked!");
return false;