diff options
author | hop311 <hop3114@gmail.com> | 2024-02-04 15:08:32 +0100 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-02-04 15:08:32 +0100 |
commit | 3f6d7351816b0e089495b2f15dc1c956f3151f5a (patch) | |
tree | 606aacf5861d3897f102917cc3af1d6be3471f9f /src/openvic-simulation/history | |
parent | 068c13ede817d17df599ca3481261bf17ed95604 (diff) |
Reworked ReturnByValue, warn_or_error, expect_date_[identifier_or_]string
Diffstat (limited to 'src/openvic-simulation/history')
-rw-r--r-- | src/openvic-simulation/history/DiplomaticHistory.cpp | 46 | ||||
-rw-r--r-- | src/openvic-simulation/history/Period.cpp | 2 |
2 files changed, 24 insertions, 24 deletions
diff --git a/src/openvic-simulation/history/DiplomaticHistory.cpp b/src/openvic-simulation/history/DiplomaticHistory.cpp index 55d6d6b..22ee765 100644 --- a/src/openvic-simulation/history/DiplomaticHistory.cpp +++ b/src/openvic-simulation/history/DiplomaticHistory.cpp @@ -32,20 +32,20 @@ AllianceHistory::AllianceHistory( Country const* new_first, Country const* new_second, const Period new_period -) : first { new_first }, second { new_second }, period {new_period} {} +) : first { new_first }, second { new_second }, period { new_period } {} ReparationsHistory::ReparationsHistory( Country const* new_receiver, Country const* new_sender, const Period new_period -) : receiver { new_receiver }, sender { new_sender }, period {new_period} {} +) : receiver { new_receiver }, sender { new_sender }, period { new_period } {} SubjectHistory::SubjectHistory( Country const* new_overlord, Country const* new_subject, const type_t new_type, const Period new_period -) : overlord { new_overlord }, subject { new_subject }, type { new_type }, period {new_period} {} +) : overlord { new_overlord }, subject { new_subject }, type { new_type }, period { new_period } {} void DiplomaticHistoryManager::reserve_more_wars(size_t size) { if (locked) { @@ -115,10 +115,10 @@ bool DiplomaticHistoryManager::load_diplomacy_history_file(CountryManager const& std::optional<Date> end {}; bool ret = expect_dictionary_keys( - "first", ONE_EXACTLY, expect_identifier_or_string(country_manager.expect_country_str(assign_variable_callback_pointer(first))), - "second", ONE_EXACTLY, expect_identifier_or_string(country_manager.expect_country_str(assign_variable_callback_pointer(second))), - "start_date", ONE_EXACTLY, expect_identifier_or_string(expect_date_str(assign_variable_callback(start))), - "end_date", ZERO_OR_ONE, expect_identifier_or_string(expect_date_str(assign_variable_callback(end))) + "first", ONE_EXACTLY, country_manager.expect_country_identifier_or_string(assign_variable_callback_pointer(first)), + "second", ONE_EXACTLY, country_manager.expect_country_identifier_or_string(assign_variable_callback_pointer(second)), + "start_date", ONE_EXACTLY, expect_date_identifier_or_string(assign_variable_callback(start)), + "end_date", ZERO_OR_ONE, expect_date_identifier_or_string(assign_variable_callback(end)) )(node); alliances.push_back({ first, second, { start, end } }); @@ -131,10 +131,10 @@ bool DiplomaticHistoryManager::load_diplomacy_history_file(CountryManager const& std::optional<Date> end {}; bool ret = expect_dictionary_keys( - "first", ONE_EXACTLY, expect_identifier_or_string(country_manager.expect_country_str(assign_variable_callback_pointer(overlord))), - "second", ONE_EXACTLY, expect_identifier_or_string(country_manager.expect_country_str(assign_variable_callback_pointer(subject))), - "start_date", ONE_EXACTLY, expect_identifier_or_string(expect_date_str(assign_variable_callback(start))), - "end_date", ZERO_OR_ONE, expect_identifier_or_string(expect_date_str(assign_variable_callback(end))) + "first", ONE_EXACTLY, country_manager.expect_country_identifier_or_string(assign_variable_callback_pointer(overlord)), + "second", ONE_EXACTLY, country_manager.expect_country_identifier_or_string(assign_variable_callback_pointer(subject)), + "start_date", ONE_EXACTLY, expect_date_identifier_or_string(assign_variable_callback(start)), + "end_date", ZERO_OR_ONE, expect_date_identifier_or_string(assign_variable_callback(end)) )(node); subjects.push_back({ overlord, subject, SubjectHistory::type_t::VASSAL, { start, end } }); @@ -147,10 +147,10 @@ bool DiplomaticHistoryManager::load_diplomacy_history_file(CountryManager const& std::optional<Date> end {}; bool ret = expect_dictionary_keys( - "first", ONE_EXACTLY, country_manager.expect_country_identifier(assign_variable_callback_pointer(overlord)), - "second", ONE_EXACTLY, country_manager.expect_country_identifier(assign_variable_callback_pointer(subject)), - "start_date", ONE_EXACTLY, expect_date(assign_variable_callback(start)), - "end_date", ZERO_OR_ONE, expect_date(assign_variable_callback(end)) + "first", ONE_EXACTLY, country_manager.expect_country_identifier_or_string(assign_variable_callback_pointer(overlord)), + "second", ONE_EXACTLY, country_manager.expect_country_identifier_or_string(assign_variable_callback_pointer(subject)), + "start_date", ONE_EXACTLY, expect_date_identifier_or_string(assign_variable_callback(start)), + "end_date", ZERO_OR_ONE, expect_date_identifier_or_string(assign_variable_callback(end)) )(node); subjects.push_back({ overlord, subject, SubjectHistory::type_t::UNION, { start, end } }); @@ -163,10 +163,10 @@ bool DiplomaticHistoryManager::load_diplomacy_history_file(CountryManager const& std::optional<Date> end {}; bool ret = expect_dictionary_keys( - "first", ONE_EXACTLY, country_manager.expect_country_identifier(assign_variable_callback_pointer(overlord)), - "second", ONE_EXACTLY, country_manager.expect_country_identifier(assign_variable_callback_pointer(subject)), - "start_date", ONE_EXACTLY, expect_date(assign_variable_callback(start)), - "end_date", ZERO_OR_ONE, expect_date(assign_variable_callback(end)) + "first", ONE_EXACTLY, country_manager.expect_country_identifier_or_string(assign_variable_callback_pointer(overlord)), + "second", ONE_EXACTLY, country_manager.expect_country_identifier_or_string(assign_variable_callback_pointer(subject)), + "start_date", ONE_EXACTLY, expect_date_identifier_or_string(assign_variable_callback(start)), + "end_date", ZERO_OR_ONE, expect_date_identifier_or_string(assign_variable_callback(end)) )(node); subjects.push_back({ overlord, subject, SubjectHistory::type_t::SUBSTATE, { start, end } }); @@ -179,10 +179,10 @@ bool DiplomaticHistoryManager::load_diplomacy_history_file(CountryManager const& std::optional<Date> end {}; bool ret = expect_dictionary_keys( - "first", ONE_EXACTLY, country_manager.expect_country_identifier(assign_variable_callback_pointer(receiver)), - "second", ONE_EXACTLY, country_manager.expect_country_identifier(assign_variable_callback_pointer(sender)), - "start_date", ONE_EXACTLY, expect_date(assign_variable_callback(start)), - "end_date", ZERO_OR_ONE, expect_date(assign_variable_callback(end)) + "first", ONE_EXACTLY, country_manager.expect_country_identifier_or_string(assign_variable_callback_pointer(receiver)), + "second", ONE_EXACTLY, country_manager.expect_country_identifier_or_string(assign_variable_callback_pointer(sender)), + "start_date", ONE_EXACTLY, expect_date_identifier_or_string(assign_variable_callback(start)), + "end_date", ZERO_OR_ONE, expect_date_identifier_or_string(assign_variable_callback(end)) )(node); reparations.push_back({ receiver, sender, { start, end } }); diff --git a/src/openvic-simulation/history/Period.cpp b/src/openvic-simulation/history/Period.cpp index cb133dd..37758a1 100644 --- a/src/openvic-simulation/history/Period.cpp +++ b/src/openvic-simulation/history/Period.cpp @@ -5,7 +5,7 @@ using namespace OpenVic; Period::Period( const Date new_start_date, const std::optional<Date> new_end_date -) : start_date {new_start_date}, end_date {new_end_date} {} +) : start_date { new_start_date }, end_date { new_end_date } {} bool Period::is_date_in_period(const Date date) const { return start_date <= date && (!end_date.has_value() || end_date.value() >= date); |