aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/military
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-01-02 15:40:00 +0100
committer GitHub <noreply@github.com>2024-01-02 15:40:00 +0100
commit4c8da86c3bede8834f381fa63edaa3e140131f69 (patch)
treeff3433a63e91b9239eb7226e75054314182d6c1f /src/openvic-simulation/military
parent66b80459c9d49895de902432bce11176b1270878 (diff)
parent5f64f983d0cead266a28791be42162c443fd2a75 (diff)
Merge pull request #112 from OpenVicProject/script-framework
Added framework for loading all Conditions and Effects
Diffstat (limited to 'src/openvic-simulation/military')
-rw-r--r--src/openvic-simulation/military/MilitaryManager.hpp2
-rw-r--r--src/openvic-simulation/military/Wargoal.cpp258
-rw-r--r--src/openvic-simulation/military/Wargoal.hpp115
3 files changed, 174 insertions, 201 deletions
diff --git a/src/openvic-simulation/military/MilitaryManager.hpp b/src/openvic-simulation/military/MilitaryManager.hpp
index aeb5a7b..2efa3ea 100644
--- a/src/openvic-simulation/military/MilitaryManager.hpp
+++ b/src/openvic-simulation/military/MilitaryManager.hpp
@@ -11,6 +11,6 @@ namespace OpenVic {
UnitManager PROPERTY_REF(unit_manager);
LeaderTraitManager PROPERTY_REF(leader_trait_manager);
DeploymentManager PROPERTY_REF(deployment_manager);
- WargoalTypeManager PROPERTY_REF(wargoal_manager);
+ WargoalTypeManager PROPERTY_REF(wargoal_type_manager);
};
}
diff --git a/src/openvic-simulation/military/Wargoal.cpp b/src/openvic-simulation/military/Wargoal.cpp
index 7a12b7e..28cbc51 100644
--- a/src/openvic-simulation/military/Wargoal.cpp
+++ b/src/openvic-simulation/military/Wargoal.cpp
@@ -6,84 +6,98 @@ using namespace OpenVic;
using namespace OpenVic::NodeTools;
WargoalType::WargoalType(
- std::string_view new_identifier,
- std::string_view new_sprite,
- std::string_view new_war_name,
- Timespan new_available_length,
- Timespan new_truce_length,
- bool new_triggered_only,
- bool new_civil_war,
- bool new_constructing,
- bool new_crisis,
- bool new_great_war,
- bool new_mutual,
- const peace_modifiers_t&& new_modifiers,
- peace_options_t new_peace_options
-) : HasIdentifier { new_identifier },
- sprite { new_sprite },
- war_name { new_war_name },
- available_length { new_available_length },
- truce_length { new_truce_length },
- triggered_only { new_triggered_only },
- civil_war { new_civil_war },
- constructing { new_constructing },
- crisis { new_crisis },
- great_war { new_great_war },
- mutual { new_mutual },
- modifiers { std::move(new_modifiers) },
- peace_options { new_peace_options } {}
-
-const std::vector<WargoalType const*>& WargoalTypeManager::get_peace_priority_list() const {
- return peace_priorities;
+ std::string_view new_identifier, std::string_view new_war_name, Timespan new_available_length,
+ Timespan new_truce_length, sprite_t new_sprite_index, bool new_triggered_only, bool new_civil_war,
+ bool new_constructing, bool new_crisis, bool new_great_war_obligatory, bool new_mutual,
+ bool new_all_allowed_states, bool new_always, peace_modifiers_t&& new_modifiers, peace_options_t new_peace_options,
+ ConditionScript&& new_can_use, ConditionScript&& new_is_valid, ConditionScript&& new_allowed_states,
+ ConditionScript&& new_allowed_substate_regions, ConditionScript&& new_allowed_states_in_crisis,
+ ConditionScript&& new_allowed_countries, EffectScript&& new_on_add, EffectScript&& new_on_po_accepted
+) : HasIdentifier { new_identifier }, war_name { new_war_name }, available_length { new_available_length },
+ truce_length { new_truce_length }, sprite_index { new_sprite_index }, triggered_only { new_triggered_only },
+ civil_war { new_civil_war }, constructing { new_constructing }, crisis { new_crisis },
+ great_war_obligatory { new_great_war_obligatory }, mutual { new_mutual }, all_allowed_states { new_all_allowed_states },
+ always { new_always }, modifiers { std::move(new_modifiers) }, peace_options { new_peace_options },
+ can_use { std::move(new_can_use) }, is_valid { std::move(new_is_valid) }, allowed_states { std::move(new_allowed_states) },
+ allowed_substate_regions { std::move(new_allowed_substate_regions) },
+ allowed_states_in_crisis { std::move(new_allowed_states_in_crisis) },
+ allowed_countries { std::move(new_allowed_countries) }, on_add { std::move(new_on_add) },
+ on_po_accepted { std::move(new_on_po_accepted) } {}
+
+bool WargoalType::parse_scripts(GameManager& game_manager) {
+ bool ret = true;
+ ret &= can_use.parse_script(true, game_manager);
+ ret &= is_valid.parse_script(true, game_manager);
+ ret &= allowed_states.parse_script(true, game_manager);
+ ret &= allowed_substate_regions.parse_script(true, game_manager);
+ ret &= allowed_states_in_crisis.parse_script(true, game_manager);
+ ret &= allowed_countries.parse_script(true, game_manager);
+ ret &= on_add.parse_script(true, game_manager);
+ ret &= on_po_accepted.parse_script(true, game_manager);
+ return ret;
}
bool WargoalTypeManager::add_wargoal_type(
- std::string_view identifier,
- std::string_view sprite,
- std::string_view war_name,
- Timespan available_length,
- Timespan truce_length,
- bool triggered_only,
- bool civil_war,
- bool constructing,
- bool crisis,
- bool great_war,
- bool mutual,
- WargoalType::peace_modifiers_t&& modifiers,
- peace_options_t peace_options
+ std::string_view identifier, std::string_view war_name, Timespan available_length,
+ Timespan truce_length, WargoalType::sprite_t sprite_index, bool triggered_only, bool civil_war,
+ bool constructing, bool crisis, bool great_war_obligatory, bool mutual, bool all_allowed_states,
+ bool always, WargoalType::peace_modifiers_t&& modifiers, peace_options_t peace_options,
+ ConditionScript&& can_use, ConditionScript&& is_valid, ConditionScript&& allowed_states,
+ ConditionScript&& allowed_substate_regions, ConditionScript&& allowed_states_in_crisis,
+ ConditionScript&& allowed_countries, EffectScript&& on_add, EffectScript&& on_po_accepted
) {
if (identifier.empty()) {
Logger::error("Invalid wargoal identifier - empty!");
return false;
}
- if (sprite.empty()) {
- Logger::error("Invalid sprite for wargoal ", identifier, " - empty!");
- return false;
- }
-
if (war_name.empty()) {
Logger::error("Invalid war name for wargoal ", identifier, " - empty!");
return false;
}
+ if (sprite_index == 0) {
+ Logger::warning("Invalid sprite for wargoal ", identifier, " - 0");
+ }
+
return wargoal_types.add_item({
- identifier, sprite, war_name, available_length, truce_length, triggered_only, civil_war, constructing, crisis,
- great_war, mutual, std::move(modifiers), peace_options
+ identifier, war_name, available_length, truce_length, sprite_index, triggered_only, civil_war, constructing, crisis,
+ great_war_obligatory, mutual, all_allowed_states, always, std::move(modifiers), peace_options, std::move(can_use),
+ std::move(is_valid), std::move(allowed_states), std::move(allowed_substate_regions),
+ std::move(allowed_states_in_crisis), std::move(allowed_countries), std::move(on_add), std::move(on_po_accepted)
});
}
bool WargoalTypeManager::load_wargoal_file(ast::NodeCPtr root) {
bool ret = expect_dictionary(
[this](std::string_view identifier, ast::NodeCPtr value) -> bool {
- if (identifier == "peace_order") return true;
+ if (identifier == "peace_order") {
+ return true;
+ }
- std::string_view sprite, war_name;
- Timespan available, truce;
- bool triggered_only = false, civil_war = false, constructing = true, crisis = true, great_war = false,
- mutual = false;
- peace_options_t peace_options {};
+ using enum peace_options_t;
+
+ std::string_view war_name;
+ Timespan available {}, truce {};
+ WargoalType::sprite_t sprite_index = 0;
+ bool triggered_only = false, civil_war = false, constructing = true, crisis = true, great_war_obligatory = false,
+ mutual = false, all_allowed_states = false, always = false;
+ peace_options_t peace_options = NO_PEACE_OPTIONS;
WargoalType::peace_modifiers_t modifiers;
+ ConditionScript can_use, is_valid, allowed_states, allowed_substate_regions, allowed_states_in_crisis,
+ allowed_countries;
+ EffectScript on_add, on_po_accepted;
+
+ const auto expect_peace_option = [&peace_options](peace_options_t peace_option) -> node_callback_t {
+ return expect_bool([&peace_options, peace_option](bool val) -> bool {
+ if (val) {
+ peace_options |= peace_option;
+ } else {
+ peace_options &= ~peace_option;
+ }
+ return true;
+ });
+ };
bool ret = expect_dictionary_keys_and_default(
[&modifiers, &identifier](std::string_view key, ast::NodeCPtr value) -> bool {
@@ -113,105 +127,53 @@ bool WargoalTypeManager::load_wargoal_file(ast::NodeCPtr root) {
Logger::error("Modifier ", key, " in wargoal ", identifier, " is invalid.");
return false;
},
- "sprite_index", ONE_EXACTLY, expect_identifier(assign_variable_callback(sprite)),
"war_name", ONE_EXACTLY, expect_identifier_or_string(assign_variable_callback(war_name)),
"months", ZERO_OR_ONE, expect_months(assign_variable_callback(available)),
"truce_months", ONE_EXACTLY, expect_months(assign_variable_callback(truce)),
+ "sprite_index", ONE_EXACTLY, expect_uint(assign_variable_callback(sprite_index)),
"is_triggered_only", ZERO_OR_ONE, expect_bool(assign_variable_callback(triggered_only)),
"is_civil_war", ZERO_OR_ONE, expect_bool(assign_variable_callback(civil_war)),
"constructing_cb", ZERO_OR_ONE, expect_bool(assign_variable_callback(constructing)),
"crisis", ZERO_OR_ONE, expect_bool(assign_variable_callback(crisis)),
- "great_war_obligatory", ZERO_OR_ONE, expect_bool(assign_variable_callback(great_war)),
+ "great_war_obligatory", ZERO_OR_ONE, expect_bool(assign_variable_callback(great_war_obligatory)),
"mutual", ZERO_OR_ONE, expect_bool(assign_variable_callback(mutual)),
- /* PEACE OPTIONS */
- "po_annex", ZERO_OR_ONE, expect_bool([&peace_options](bool annex) -> bool {
- if (annex) peace_options |= peace_options_t::PO_ANNEX;
- return true;
- }),
- "po_demand_state", ZERO_OR_ONE, expect_bool([&peace_options](bool demand_state) -> bool {
- if (demand_state) peace_options |= peace_options_t::PO_DEMAND_STATE;
- return true;
- }),
- "po_add_to_sphere", ZERO_OR_ONE, expect_bool([&peace_options](bool add_to_sphere) -> bool {
- if (add_to_sphere) peace_options |= peace_options_t::PO_ADD_TO_SPHERE;
- return true;
- }),
- "po_disarmament", ZERO_OR_ONE, expect_bool([&peace_options](bool disarm) -> bool {
- if (disarm) peace_options |= peace_options_t::PO_DISARMAMENT;
- return true;
- }),
- "po_destroy_forts", ZERO_OR_ONE, expect_bool([&peace_options](bool disarm) -> bool {
- if (disarm) peace_options |= peace_options_t::PO_REMOVE_FORTS;
- return true;
- }),
- "po_destroy_naval_bases", ZERO_OR_ONE, expect_bool([&peace_options](bool disarm) -> bool {
- if (disarm) peace_options |= peace_options_t::PO_REMOVE_NAVAL_BASES;
- return true;
- }),
- "po_reparations", ZERO_OR_ONE, expect_bool([&peace_options](bool reps) -> bool {
- if (reps) peace_options |= peace_options_t::PO_REPARATIONS;
- return true;
- }),
- "po_transfer_provinces", ZERO_OR_ONE, expect_bool([&peace_options](bool provinces) -> bool {
- if (provinces) peace_options |= peace_options_t::PO_TRANSFER_PROVINCES;
- return true;
- }),
- "po_remove_prestige", ZERO_OR_ONE, expect_bool([&peace_options](bool humiliate) -> bool {
- if (humiliate) peace_options |= peace_options_t::PO_REMOVE_PRESTIGE;
- return true;
- }),
- "po_make_puppet", ZERO_OR_ONE, expect_bool([&peace_options](bool puppet) -> bool {
- if (puppet) peace_options |= peace_options_t::PO_MAKE_PUPPET;
- return true;
- }),
- "po_release_puppet", ZERO_OR_ONE, expect_bool([&peace_options](bool puppet) -> bool {
- if (puppet) peace_options |= peace_options_t::PO_RELEASE_PUPPET;
- return true;
- }),
- "po_status_quo", ZERO_OR_ONE, expect_bool([&peace_options](bool status_quo) -> bool {
- if (status_quo) peace_options |= peace_options_t::PO_STATUS_QUO;
- return true;
- }),
- "po_install_communist_gov_type", ZERO_OR_ONE, expect_bool([&peace_options](bool puppet) -> bool {
- if (puppet) peace_options |= peace_options_t::PO_INSTALL_COMMUNISM;
- return true;
- }),
- "po_uninstall_communist_gov_type", ZERO_OR_ONE, expect_bool([&peace_options](bool puppet) -> bool {
- if (puppet) peace_options |= peace_options_t::PO_REMOVE_COMMUNISM;
- return true;
- }),
- "po_remove_cores", ZERO_OR_ONE, expect_bool([&peace_options](bool uncore) -> bool {
- if (uncore) peace_options |= peace_options_t::PO_REMOVE_CORES;
- return true;
- }),
- "po_colony", ZERO_OR_ONE, expect_bool([&peace_options](bool colony) -> bool {
- if (colony) peace_options |= peace_options_t::PO_COLONY;
- return true;
- }),
- "po_gunboat", ZERO_OR_ONE, expect_bool([&peace_options](bool gunboat) -> bool {
- if (gunboat) peace_options |= peace_options_t::PO_REPAY_DEBT;
- return true;
- }),
- "po_clear_union_sphere", ZERO_OR_ONE, expect_bool([&peace_options](bool clear) -> bool {
- if (clear) peace_options |= peace_options_t::PO_CLEAR_UNION_SPHERE;
- return true;
- }),
- /* TODO: CONDITION & EFFECT BLOCKS */
- "can_use", ZERO_OR_ONE, success_callback,
- "is_valid", ZERO_OR_ONE, success_callback,
- "on_add", ZERO_OR_ONE, success_callback,
- "on_po_accepted", ZERO_OR_ONE, success_callback,
- "allowed_states", ZERO_OR_ONE, success_callback,
- "all_allowed_states", ZERO_OR_ONE, success_callback,
- "allowed_substate_regions", ZERO_OR_ONE, success_callback,
- "allowed_states_in_crisis", ZERO_OR_ONE, success_callback,
- "allowed_countries", ZERO_OR_ONE, success_callback,
- "always", ZERO_OR_ONE, success_callback // usage unknown / quirk
+ /* START PEACE OPTIONS */
+ "po_annex", ZERO_OR_ONE, expect_peace_option(PO_ANNEX),
+ "po_demand_state", ZERO_OR_ONE, expect_peace_option(PO_DEMAND_STATE),
+ "po_add_to_sphere", ZERO_OR_ONE, expect_peace_option(PO_ADD_TO_SPHERE),
+ "po_disarmament", ZERO_OR_ONE, expect_peace_option(PO_DISARMAMENT),
+ "po_destroy_forts", ZERO_OR_ONE, expect_peace_option(PO_REMOVE_FORTS),
+ "po_destroy_naval_bases", ZERO_OR_ONE, expect_peace_option(PO_REMOVE_NAVAL_BASES),
+ "po_reparations", ZERO_OR_ONE, expect_peace_option(PO_REPARATIONS),
+ "po_transfer_provinces", ZERO_OR_ONE, expect_peace_option(PO_TRANSFER_PROVINCES),
+ "po_remove_prestige", ZERO_OR_ONE, expect_peace_option(PO_REMOVE_PRESTIGE),
+ "po_make_puppet", ZERO_OR_ONE, expect_peace_option(PO_MAKE_PUPPET),
+ "po_release_puppet", ZERO_OR_ONE, expect_peace_option(PO_RELEASE_PUPPET),
+ "po_status_quo", ZERO_OR_ONE, expect_peace_option(PO_STATUS_QUO),
+ "po_install_communist_gov_type", ZERO_OR_ONE, expect_peace_option(PO_INSTALL_COMMUNISM),
+ "po_uninstall_communist_gov_type", ZERO_OR_ONE, expect_peace_option(PO_REMOVE_COMMUNISM),
+ "po_remove_cores", ZERO_OR_ONE, expect_peace_option(PO_REMOVE_CORES),
+ "po_colony", ZERO_OR_ONE, expect_peace_option(PO_COLONY),
+ "po_gunboat", ZERO_OR_ONE, expect_peace_option(PO_REPAY_DEBT),
+ "po_clear_union_sphere", ZERO_OR_ONE, expect_peace_option(PO_CLEAR_UNION_SPHERE),
+ /* END PEACE OPTIONS */
+ "can_use", ZERO_OR_ONE, can_use.expect_script(),
+ "is_valid", ZERO_OR_ONE, is_valid.expect_script(),
+ "on_add", ZERO_OR_ONE, on_add.expect_script(),
+ "on_po_accepted", ZERO_OR_ONE, on_po_accepted.expect_script(),
+ "allowed_states", ZERO_OR_ONE, allowed_states.expect_script(),
+ "all_allowed_states", ZERO_OR_ONE, expect_bool(assign_variable_callback(all_allowed_states)),
+ "allowed_substate_regions", ZERO_OR_ONE, allowed_substate_regions.expect_script(),
+ "allowed_states_in_crisis", ZERO_OR_ONE, allowed_states_in_crisis.expect_script(),
+ "allowed_countries", ZERO_OR_ONE, allowed_countries.expect_script(),
+ "always", ZERO_OR_ONE, expect_bool(assign_variable_callback(always))
)(value);
add_wargoal_type(
- identifier, sprite, war_name, available, truce, triggered_only, civil_war, constructing, crisis, great_war,
- mutual, std::move(modifiers), peace_options
+ identifier, war_name, available, truce, sprite_index, triggered_only, civil_war, constructing, crisis,
+ great_war_obligatory, mutual, all_allowed_states, always, std::move(modifiers), peace_options,
+ std::move(can_use), std::move(is_valid), std::move(allowed_states), std::move(allowed_substate_regions),
+ std::move(allowed_states_in_crisis), std::move(allowed_countries), std::move(on_add), std::move(on_po_accepted)
);
return ret;
}
@@ -237,4 +199,12 @@ bool WargoalTypeManager::load_wargoal_file(ast::NodeCPtr root) {
lock_wargoal_types();
return ret;
-} \ No newline at end of file
+}
+
+bool WargoalTypeManager::parse_scripts(GameManager& game_manager) {
+ bool ret = true;
+ for (WargoalType& wargoal_type : wargoal_types.get_items()) {
+ ret &= wargoal_type.parse_scripts(game_manager);
+ }
+ return ret;
+}
diff --git a/src/openvic-simulation/military/Wargoal.hpp b/src/openvic-simulation/military/Wargoal.hpp
index 66fce90..a4f2e7c 100644
--- a/src/openvic-simulation/military/Wargoal.hpp
+++ b/src/openvic-simulation/military/Wargoal.hpp
@@ -1,6 +1,8 @@
#pragma once
#include "openvic-simulation/misc/Modifier.hpp"
+#include "openvic-simulation/scripts/ConditionScript.hpp"
+#include "openvic-simulation/scripts/EffectScript.hpp"
#include "openvic-simulation/types/EnumBitfield.hpp"
#include "openvic-simulation/types/IdentifierRegistry.hpp"
#include "openvic-simulation/utility/Getters.hpp"
@@ -9,30 +11,33 @@ namespace OpenVic {
struct WargoalTypeManager;
enum class peace_options_t : uint32_t {
- PO_ANNEX = 0b100000000000000000,
- PO_DEMAND_STATE = 0b010000000000000000,
- PO_COLONY = 0b001000000000000000,
- PO_ADD_TO_SPHERE = 0b000100000000000000,
- PO_DISARMAMENT = 0b000010000000000000,
- PO_REMOVE_FORTS = 0b000001000000000000,
- PO_REMOVE_NAVAL_BASES = 0b000000100000000000,
- PO_REPARATIONS = 0b000000010000000000,
- PO_REPAY_DEBT = 0b000000001000000000,
- PO_REMOVE_PRESTIGE = 0b000000000100000000,
- PO_MAKE_PUPPET = 0b000000000010000000,
- PO_RELEASE_PUPPET = 0b000000000001000000,
- PO_STATUS_QUO = 0b000000000000100000,
- PO_INSTALL_COMMUNISM = 0b000000000000010000,
- PO_REMOVE_COMMUNISM = 0b000000000000001000,
- PO_REMOVE_CORES = 0b000000000000000100, // only usable with ANNEX, DEMAND_STATE, or TRANSFER_PROVINCES
- PO_TRANSFER_PROVINCES = 0b000000000000000010,
- PO_CLEAR_UNION_SPHERE = 0b000000000000000001
+ NO_PEACE_OPTIONS = 0,
+ PO_ANNEX = 1 << 0,
+ PO_DEMAND_STATE = 1 << 1,
+ PO_COLONY = 1 << 2,
+ PO_ADD_TO_SPHERE = 1 << 3,
+ PO_DISARMAMENT = 1 << 4,
+ PO_REMOVE_FORTS = 1 << 5,
+ PO_REMOVE_NAVAL_BASES = 1 << 6,
+ PO_REPARATIONS = 1 << 7,
+ PO_REPAY_DEBT = 1 << 8,
+ PO_REMOVE_PRESTIGE = 1 << 9,
+ PO_MAKE_PUPPET = 1 << 10,
+ PO_RELEASE_PUPPET = 1 << 11,
+ PO_STATUS_QUO = 1 << 12,
+ PO_INSTALL_COMMUNISM = 1 << 13,
+ PO_REMOVE_COMMUNISM = 1 << 14,
+ PO_REMOVE_CORES = 1 << 15, // only usable with ANNEX, DEMAND_STATE, or TRANSFER_PROVINCES
+ PO_TRANSFER_PROVINCES = 1 << 16,
+ PO_CLEAR_UNION_SPHERE = 1 << 17
};
template<> struct enable_bitfield<peace_options_t> : std::true_type{};
struct WargoalType : HasIdentifier {
friend struct WargoalTypeManager;
+ using sprite_t = uint8_t;
+
enum class PEACE_MODIFIERS {
BADBOY_FACTOR,
PRESTIGE_FACTOR,
@@ -50,37 +55,41 @@ namespace OpenVic {
using peace_modifiers_t = fixed_point_map_t<PEACE_MODIFIERS>;
private:
- const std::string PROPERTY(sprite);
- const std::string PROPERTY(war_name);
+ std::string PROPERTY(war_name);
const Timespan PROPERTY(available_length);
const Timespan PROPERTY(truce_length);
- const bool PROPERTY(triggered_only); // only able to be added via effects (or within the code)
- const bool PROPERTY(civil_war);
+ const sprite_t PROPERTY(sprite_index);
+ const bool PROPERTY_CUSTOM_PREFIX(triggered_only, is); // only able to be added via effects or on_actions
+ const bool PROPERTY_CUSTOM_PREFIX(civil_war, is);
const bool PROPERTY(constructing); // can be added to existing wars or justified
const bool PROPERTY(crisis); // able to be added to crises
- const bool PROPERTY(great_war); // automatically add to great wars
- const bool PROPERTY(mutual); // attacked and defender share wargoal
- const peace_modifiers_t PROPERTY(modifiers);
- const peace_options_t PROPERTY(peace_options);
-
- // TODO: can_use, prerequisites, on_add, on_po_accepted
+ const bool PROPERTY_CUSTOM_PREFIX(great_war_obligatory, is); // automatically add to great war peace offers/demands
+ const bool PROPERTY_CUSTOM_PREFIX(mutual, is); // attacked and defender share wargoal
+ const bool PROPERTY(all_allowed_states); // take all valid states rather than just one
+ const bool PROPERTY(always); // available without justifying
+ peace_modifiers_t PROPERTY(modifiers);
+ peace_options_t PROPERTY(peace_options);
+ ConditionScript PROPERTY(can_use);
+ ConditionScript PROPERTY(is_valid);
+ ConditionScript PROPERTY(allowed_states);
+ ConditionScript PROPERTY(allowed_substate_regions);
+ ConditionScript PROPERTY(allowed_states_in_crisis);
+ ConditionScript PROPERTY(allowed_countries);
+ EffectScript PROPERTY(on_add);
+ EffectScript PROPERTY(on_po_accepted);
WargoalType(
- std::string_view new_identifier,
- std::string_view new_sprite,
- std::string_view new_war_name,
- Timespan new_available_length,
- Timespan new_truce_length,
- bool new_triggered_only,
- bool new_civil_war,
- bool new_constructing,
- bool new_crisis,
- bool new_great_war,
- bool new_mutual,
- const peace_modifiers_t&& new_modifiers,
- peace_options_t new_peace_options
+ std::string_view new_identifier, std::string_view new_war_name, Timespan new_available_length,
+ Timespan new_truce_length, sprite_t new_sprite_index, bool new_triggered_only, bool new_civil_war,
+ bool new_constructing, bool new_crisis, bool new_great_war_obligatory, bool new_mutual,
+ bool new_all_allowed_states, bool new_always, peace_modifiers_t&& new_modifiers, peace_options_t new_peace_options,
+ ConditionScript&& new_can_use, ConditionScript&& new_is_valid, ConditionScript&& new_allowed_states,
+ ConditionScript&& new_allowed_substate_regions, ConditionScript&& new_allowed_states_in_crisis,
+ ConditionScript&& new_allowed_countries, EffectScript&& new_on_add, EffectScript&& new_on_po_accepted
);
+ bool parse_scripts(GameManager& game_manager);
+
public:
WargoalType(WargoalType&&) = default;
};
@@ -91,24 +100,18 @@ namespace OpenVic {
std::vector<WargoalType const*> PROPERTY(peace_priorities);
public:
- const std::vector<WargoalType const*>& get_peace_priority_list() const;
-
bool add_wargoal_type(
- std::string_view identifier,
- std::string_view sprite,
- std::string_view war_name,
- Timespan available_length,
- Timespan truce_length,
- bool triggered_only,
- bool civil_war,
- bool constructing,
- bool crisis,
- bool great_war,
- bool mutual,
- WargoalType::peace_modifiers_t&& modifiers,
- peace_options_t peace_options
+ std::string_view identifier, std::string_view war_name, Timespan available_length,
+ Timespan truce_length, WargoalType::sprite_t sprite_index, bool triggered_only, bool civil_war,
+ bool constructing, bool crisis, bool great_war_obligatory, bool mutual, bool all_allowed_states,
+ bool always, WargoalType::peace_modifiers_t&& modifiers, peace_options_t peace_options,
+ ConditionScript&& can_use, ConditionScript&& is_valid, ConditionScript&& allowed_states,
+ ConditionScript&& allowed_substate_regions, ConditionScript&& allowed_states_in_crisis,
+ ConditionScript&& allowed_countries, EffectScript&& on_add, EffectScript&& on_po_accepted
);
bool load_wargoal_file(ast::NodeCPtr root);
+
+ bool parse_scripts(GameManager& game_manager);
};
} // namespace OpenVic \ No newline at end of file