aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/pop
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-11-22 17:16:34 +0100
committer zaaarf <zaaarf@proton.me>2023-11-22 17:16:34 +0100
commit1683859e333f98fb63f1c72d926bb366a3b89f0b (patch)
treee11dde918a7f1f228d3383ba8f9287385e43b4f5 /src/openvic-simulation/pop
parent5c6caf6fbb7c606f4ebe0c397cc15c97d776f13d (diff)
chore: use PROPERTY and its variants when possible
Diffstat (limited to 'src/openvic-simulation/pop')
-rw-r--r--src/openvic-simulation/pop/Culture.cpp24
-rw-r--r--src/openvic-simulation/pop/Culture.hpp19
-rw-r--r--src/openvic-simulation/pop/Pop.cpp76
-rw-r--r--src/openvic-simulation/pop/Pop.hpp49
-rw-r--r--src/openvic-simulation/pop/Religion.cpp12
-rw-r--r--src/openvic-simulation/pop/Religion.hpp10
6 files changed, 28 insertions, 162 deletions
diff --git a/src/openvic-simulation/pop/Culture.cpp b/src/openvic-simulation/pop/Culture.cpp
index 376e2a3..bc17290 100644
--- a/src/openvic-simulation/pop/Culture.cpp
+++ b/src/openvic-simulation/pop/Culture.cpp
@@ -13,36 +13,12 @@ CultureGroup::CultureGroup(
) : HasIdentifier { new_identifier }, leader { new_leader }, unit_graphical_culture_type { new_unit_graphical_culture_type },
is_overseas { new_is_overseas } {}
-std::string_view CultureGroup::get_leader() const {
- return leader;
-}
-
-GraphicalCultureType const& CultureGroup::get_unit_graphical_culture_type() const {
- return unit_graphical_culture_type;
-}
-
-bool CultureGroup::get_is_overseas() const {
- return is_overseas;
-}
-
Culture::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
) : HasIdentifierAndColour { new_identifier, new_colour, false, false }, group { new_group },
first_names { std::move(new_first_names) }, last_names { std::move(new_last_names) } {}
-CultureGroup const& Culture::get_group() const {
- return group;
-}
-
-std::vector<std::string> const& Culture::get_first_names() const {
- return first_names;
-}
-
-std::vector<std::string> const& Culture::get_last_names() const {
- return last_names;
-}
-
CultureManager::CultureManager()
: graphical_culture_types { "graphical culture types" }, culture_groups { "culture groups" }, cultures { "cultures" } {}
diff --git a/src/openvic-simulation/pop/Culture.hpp b/src/openvic-simulation/pop/Culture.hpp
index 2abe77d..ff5f7c5 100644
--- a/src/openvic-simulation/pop/Culture.hpp
+++ b/src/openvic-simulation/pop/Culture.hpp
@@ -20,9 +20,9 @@ namespace OpenVic {
friend struct CultureManager;
private:
- const std::string leader;
- GraphicalCultureType const& unit_graphical_culture_type;
- const bool is_overseas;
+ const std::string PROPERTY(leader);
+ GraphicalCultureType const& PROPERTY(unit_graphical_culture_type);
+ const bool PROPERTY(is_overseas);
// TODO - union tag
@@ -33,18 +33,15 @@ namespace OpenVic {
public:
CultureGroup(CultureGroup&&) = default;
-
- std::string_view get_leader() const;
- GraphicalCultureType const& get_unit_graphical_culture_type() const;
- bool get_is_overseas() const;
};
struct Culture : HasIdentifierAndColour {
friend struct CultureManager;
private:
- CultureGroup const& group;
- const std::vector<std::string> first_names, last_names;
+ CultureGroup const& PROPERTY(group);
+ const std::vector<std::string> PROPERTY(first_names);
+ const std::vector<std::string> PROPERTY(last_names);
// TODO - radicalism, primary tag
@@ -55,10 +52,6 @@ namespace OpenVic {
public:
Culture(Culture&&) = default;
-
- CultureGroup const& get_group() const;
- std::vector<std::string> const& get_first_names() const;
- std::vector<std::string> const& get_last_names() const;
};
struct CultureManager {
diff --git a/src/openvic-simulation/pop/Pop.cpp b/src/openvic-simulation/pop/Pop.cpp
index 0b61096..31ab6d5 100644
--- a/src/openvic-simulation/pop/Pop.cpp
+++ b/src/openvic-simulation/pop/Pop.cpp
@@ -15,34 +15,6 @@ Pop::Pop(
assert(size > 0);
}
-PopType const& Pop::get_type() const {
- return type;
-}
-
-Culture const& Pop::get_culture() const {
- return culture;
-}
-
-Religion const& Pop::get_religion() const {
- return religion;
-}
-
-Pop::pop_size_t Pop::get_size() const {
- return size;
-}
-
-Pop::pop_size_t Pop::get_num_promoted() const {
- return num_promoted;
-}
-
-Pop::pop_size_t Pop::get_num_demoted() const {
- return num_demoted;
-}
-
-Pop::pop_size_t Pop::get_num_migrated() const {
- return num_migrated;
-}
-
Pop::pop_size_t Pop::get_pop_daily_change() const {
return Pop::get_num_promoted() - (Pop::get_num_demoted() + Pop::get_num_migrated());
}
@@ -62,54 +34,6 @@ PopType::PopType(
assert(merge_max_size >= 0);
}
-PopType::sprite_t PopType::get_sprite() const {
- return sprite;
-}
-
-Good::good_map_t const& PopType::get_life_needs() const {
- return life_needs;
-}
-
-Good::good_map_t const& PopType::get_everyday_needs() const {
- return everyday_needs;
-}
-
-Good::good_map_t const& PopType::get_luxury_needs() const {
- return luxury_needs;
-}
-
-PopType::rebel_units_t const& PopType::get_rebel_units() const {
- return rebel_units;
-}
-
-PopType::strata_t PopType::get_strata() const {
- return strata;
-}
-
-Pop::pop_size_t PopType::get_max_size() const {
- return max_size;
-}
-
-Pop::pop_size_t PopType::get_merge_max_size() const {
- return merge_max_size;
-}
-
-bool PopType::get_state_capital_only() const {
- return state_capital_only;
-}
-
-bool PopType::get_demote_migrant() const {
- return demote_migrant;
-}
-
-bool PopType::get_is_artisan() const {
- return is_artisan;
-}
-
-bool PopType::get_is_slave() const {
- return is_slave;
-}
-
PopManager::PopManager() : pop_types { "pop types" } {}
bool PopManager::add_pop_type(
diff --git a/src/openvic-simulation/pop/Pop.hpp b/src/openvic-simulation/pop/Pop.hpp
index f7f20fe..ff4ff5f 100644
--- a/src/openvic-simulation/pop/Pop.hpp
+++ b/src/openvic-simulation/pop/Pop.hpp
@@ -19,10 +19,13 @@ namespace OpenVic {
using pop_size_t = int64_t;
private:
- PopType const& type;
- Culture const& culture;
- Religion const& religion;
- pop_size_t size, num_promoted, num_demoted, num_migrated;
+ PopType const& PROPERTY(type);
+ Culture const& PROPERTY(culture);
+ Religion const& PROPERTY(religion);
+ pop_size_t PROPERTY(size);
+ pop_size_t PROPERTY(num_promoted);
+ pop_size_t PROPERTY(num_demoted);
+ pop_size_t PROPERTY(num_migrated);
Pop(PopType const& new_type, Culture const& new_culture, Religion const& new_religion, pop_size_t new_size);
@@ -32,13 +35,6 @@ namespace OpenVic {
Pop& operator=(Pop const&) = delete;
Pop& operator=(Pop&&) = delete;
- PopType const& get_type() const;
- Culture const& get_culture() const;
- Religion const& get_religion() const;
- pop_size_t get_size() const;
- pop_size_t get_num_promoted() const;
- pop_size_t get_num_demoted() const;
- pop_size_t get_num_migrated() const;
pop_size_t get_pop_daily_change() const;
};
@@ -52,12 +48,18 @@ namespace OpenVic {
using rebel_units_t = fixed_point_map_t<Unit const*>;
private:
- const enum class strata_t { POOR, MIDDLE, RICH } strata;
- const sprite_t sprite;
- const Good::good_map_t life_needs, everyday_needs, luxury_needs;
- const rebel_units_t rebel_units;
- const Pop::pop_size_t max_size, merge_max_size;
- const bool state_capital_only, demote_migrant, is_artisan, is_slave;
+ const enum class strata_t { POOR, MIDDLE, RICH } PROPERTY(strata);
+ const sprite_t PROPERTY(sprite);
+ const Good::good_map_t PROPERTY(life_needs);
+ const Good::good_map_t PROPERTY(everyday_needs);
+ const Good::good_map_t PROPERTY(luxury_needs);
+ const rebel_units_t PROPERTY(rebel_units);
+ const Pop::pop_size_t PROPERTY(max_size);
+ const Pop::pop_size_t PROPERTY(merge_max_size);
+ const bool PROPERTY(state_capital_only);
+ const bool PROPERTY(demote_migrant);
+ const bool PROPERTY(is_artisan);
+ const bool PROPERTY(is_slave);
// TODO - country and province migration targets, promote_to targets, ideologies and issues
@@ -70,19 +72,6 @@ namespace OpenVic {
public:
PopType(PopType&&) = default;
-
- strata_t get_strata() const;
- sprite_t get_sprite() const;
- Good::good_map_t const& get_life_needs() const;
- Good::good_map_t const& get_everyday_needs() const;
- Good::good_map_t const& get_luxury_needs() const;
- rebel_units_t const& get_rebel_units() const;
- Pop::pop_size_t get_max_size() const;
- Pop::pop_size_t get_merge_max_size() const;
- bool get_state_capital_only() const;
- bool get_demote_migrant() const;
- bool get_is_artisan() const;
- bool get_is_slave() const;
};
struct Province;
diff --git a/src/openvic-simulation/pop/Religion.cpp b/src/openvic-simulation/pop/Religion.cpp
index f52ed3e..644618d 100644
--- a/src/openvic-simulation/pop/Religion.cpp
+++ b/src/openvic-simulation/pop/Religion.cpp
@@ -14,18 +14,6 @@ Religion::Religion(
assert(icon > 0);
}
-ReligionGroup const& Religion::get_group() const {
- return group;
-}
-
-Religion::icon_t Religion::get_icon() const {
- return icon;
-}
-
-bool Religion::get_pagan() const {
- return pagan;
-}
-
ReligionManager::ReligionManager() : religion_groups { "religion groups" }, religions { "religions" } {}
bool ReligionManager::add_religion_group(std::string_view identifier) {
diff --git a/src/openvic-simulation/pop/Religion.hpp b/src/openvic-simulation/pop/Religion.hpp
index 4cc8403..6f34eee 100644
--- a/src/openvic-simulation/pop/Religion.hpp
+++ b/src/openvic-simulation/pop/Religion.hpp
@@ -23,9 +23,9 @@ namespace OpenVic {
using icon_t = uint8_t;
private:
- ReligionGroup const& group;
- const icon_t icon;
- const bool pagan;
+ ReligionGroup const& PROPERTY(group);
+ const icon_t PROPERTY(icon);
+ const bool PROPERTY(pagan);
Religion(
std::string_view new_identifier, colour_t new_colour, ReligionGroup const& new_group, icon_t new_icon,
@@ -34,10 +34,6 @@ namespace OpenVic {
public:
Religion(Religion&&) = default;
-
- ReligionGroup const& get_group() const;
- icon_t get_icon() const;
- bool get_pagan() const;
};
struct ReligionManager {