Skip to content

Commit 2f283f5

Browse files
committed
Add missing conditions + some comments
1 parent 1c69dfa commit 2f283f5

File tree

3 files changed

+123
-12
lines changed

3 files changed

+123
-12
lines changed

src/openvic-simulation/military/Wargoal.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ bool WargoalTypeManager::load_wargoal_file(ovdl::v2script::Parser const& parser)
9797
WargoalType::peace_modifiers_t modifiers;
9898
ConditionScript can_use { COUNTRY, COUNTRY, COUNTRY };
9999
ConditionScript is_valid { COUNTRY, COUNTRY, COUNTRY };
100-
ConditionScript allowed_states { PROVINCE, COUNTRY, COUNTRY };
100+
ConditionScript allowed_states { STATE, COUNTRY, COUNTRY };
101101
ConditionScript allowed_substate_regions { PROVINCE, COUNTRY, COUNTRY };
102-
ConditionScript allowed_states_in_crisis { PROVINCE, COUNTRY, COUNTRY };
102+
ConditionScript allowed_states_in_crisis { STATE, COUNTRY, COUNTRY };
103103
ConditionScript allowed_countries { COUNTRY, COUNTRY, COUNTRY };
104104
EffectScript on_add, on_po_accepted; //country as default scope for both
105105

src/openvic-simulation/scripts/Condition.cpp

Lines changed: 115 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,6 +1801,7 @@ bool ConditionManager::setup_conditions(DefinitionManager const& definition_mana
18011801
"brigades_compare",
18021802
_parse_condition_node_value_callback<fixed_point_t, COUNTRY>,
18031803
// TODO - what does this compare against? current scope vs this scope, or a previous/outer current country scope?
1804+
// brigades_compare first checks if there is a country in THIS scope, if not, then it checks for FROM
18041805
_execute_condition_node_unimplemented
18051806
);
18061807
ret &= add_condition(
@@ -1922,6 +1923,11 @@ bool ConditionManager::setup_conditions(DefinitionManager const& definition_mana
19221923
)
19231924
)
19241925
);
1926+
ret &= add_condition(
1927+
"constructing_cb",
1928+
_parse_condition_node_value_callback<CountryDefinition const*, COUNTRY | THIS | FROM>,
1929+
_execute_condition_node_unimplemented
1930+
);
19251931
ret &= add_condition(
19261932
"constructing_cb_progress",
19271933
_parse_condition_node_value_callback<fixed_point_t, COUNTRY>,
@@ -2097,11 +2103,6 @@ bool ConditionManager::setup_conditions(DefinitionManager const& definition_mana
20972103
_parse_condition_node_value_callback<bool>,
20982104
_execute_condition_node_unimplemented
20992105
);
2100-
ret &= add_condition(
2101-
"have_core_in",
2102-
_parse_condition_node_value_callback<CountryDefinition const*, COUNTRY | THIS | FROM>,
2103-
_execute_condition_node_unimplemented
2104-
);
21052106
ret &= add_condition(
21062107
"has_country_flag",
21072108
_parse_condition_node_value_callback<std::string, COUNTRY | PROVINCE>,
@@ -2158,6 +2159,8 @@ bool ConditionManager::setup_conditions(DefinitionManager const& definition_mana
21582159
_execute_condition_node_unimplemented
21592160
);
21602161
ret &= add_condition(
2162+
// checks if the country has lost a war in the last 5 years (losing = making a concession offer,
2163+
// even giving white peace (but clicking on the "offer" tab) counts as losing)
21612164
"has_recently_lost_war",
21622165
_parse_condition_node_value_callback<bool, COUNTRY>,
21632166
_execute_condition_node_unimplemented
@@ -2226,6 +2229,12 @@ bool ConditionManager::setup_conditions(DefinitionManager const& definition_mana
22262229
_parse_condition_node_value_callback<bool, COUNTRY>,
22272230
_execute_condition_node_unimplemented
22282231
);
2232+
ret &= add_condition(
2233+
// TODO - Unused trigger, but is recognized as a valid trigger (does it ever return true?)
2234+
"is_influence_crisis",
2235+
_parse_condition_node_value_callback<bool, COUNTRY>,
2236+
_execute_condition_node_unimplemented
2237+
);
22292238
ret &= add_condition(
22302239
"is_cultural_union",
22312240
_parse_condition_node_value_callback<
@@ -2767,6 +2776,7 @@ bool ConditionManager::setup_conditions(DefinitionManager const& definition_mana
27672776
_execute_condition_node_unimplemented
27682777
);
27692778
// Shows up in allow decision tooltips but is always false
2779+
// TODO - "unit_has_leader = no" is the same as "unit_has_leader = yes"
27702780
// ret &= add_condition("unit_has_leader", BOOLEAN, COUNTRY);
27712781
ret &= add_condition(
27722782
"unit_in_battle",
@@ -2812,6 +2822,12 @@ bool ConditionManager::setup_conditions(DefinitionManager const& definition_mana
28122822
_parse_condition_node_value_callback<CountryDefinition const*, COUNTRY | THIS | FROM>,
28132823
_execute_condition_node_unimplemented
28142824
);
2825+
// TODO - Undocumented, only seen used in PDM and Victoria 1.02 as "someone_can_form_union_tag = FROM", recognized by the game engine as valid
2826+
ret &= add_condition(
2827+
"someone_can_form_union_tag",
2828+
_parse_condition_node_value_callback<CountryDefinition const*, COUNTRY | THIS | FROM>,
2829+
_execute_condition_node_unimplemented
2830+
);
28152831

28162832
/* State Scope Conditions */
28172833
ret &= add_condition(
@@ -2909,6 +2925,7 @@ bool ConditionManager::setup_conditions(DefinitionManager const& definition_mana
29092925
_parse_condition_node_value_callback<bool, PROVINCE>,
29102926
_execute_condition_node_unimplemented
29112927
);
2928+
// TODO - Usage returns false always - warn about it?
29122929
ret &= add_condition(
29132930
"has_province_flag",
29142931
_parse_condition_node_value_callback<std::string, PROVINCE>,
@@ -3325,6 +3342,99 @@ bool ConditionManager::setup_conditions(DefinitionManager const& definition_mana
33253342
);
33263343
}
33273344

3345+
/* Newspaper conditions */
3346+
ret &= add_condition(
3347+
"tags_eq",
3348+
_parse_condition_node_unimplemented,
3349+
_execute_condition_node_unimplemented
3350+
);
3351+
ret &= add_condition(
3352+
"values_eq",
3353+
_parse_condition_node_unimplemented,
3354+
_execute_condition_node_unimplemented
3355+
);
3356+
ret &= add_condition(
3357+
"strings_eq",
3358+
_parse_condition_node_unimplemented,
3359+
_execute_condition_node_unimplemented
3360+
);
3361+
ret &= add_condition(
3362+
"dates_eq",
3363+
_parse_condition_node_unimplemented,
3364+
_execute_condition_node_unimplemented
3365+
);
3366+
ret &= add_condition(
3367+
"tags_greater",
3368+
_parse_condition_node_unimplemented,
3369+
_execute_condition_node_unimplemented
3370+
);
3371+
ret &= add_condition(
3372+
"values_greater",
3373+
_parse_condition_node_unimplemented,
3374+
_execute_condition_node_unimplemented
3375+
);
3376+
ret &= add_condition(
3377+
"strings_greater",
3378+
_parse_condition_node_unimplemented,
3379+
_execute_condition_node_unimplemented
3380+
);
3381+
ret &= add_condition(
3382+
"dates_greater",
3383+
_parse_condition_node_unimplemented,
3384+
_execute_condition_node_unimplemented
3385+
);
3386+
ret &= add_condition(
3387+
"tags_match",
3388+
_parse_condition_node_unimplemented,
3389+
_execute_condition_node_unimplemented
3390+
);
3391+
ret &= add_condition(
3392+
"values_match",
3393+
_parse_condition_node_unimplemented,
3394+
_execute_condition_node_unimplemented
3395+
);
3396+
ret &= add_condition(
3397+
"strings_match",
3398+
_parse_condition_node_unimplemented,
3399+
_execute_condition_node_unimplemented
3400+
);
3401+
ret &= add_condition(
3402+
"dates_match",
3403+
_parse_condition_node_unimplemented,
3404+
_execute_condition_node_unimplemented
3405+
);
3406+
ret &= add_condition(
3407+
"tags_contains",
3408+
_parse_condition_node_unimplemented,
3409+
_execute_condition_node_unimplemented
3410+
);
3411+
ret &= add_condition(
3412+
"values_contains",
3413+
_parse_condition_node_unimplemented,
3414+
_execute_condition_node_unimplemented
3415+
);
3416+
ret &= add_condition(
3417+
"strings_contains",
3418+
_parse_condition_node_unimplemented,
3419+
_execute_condition_node_unimplemented
3420+
);
3421+
ret &= add_condition(
3422+
"dates_contains",
3423+
_parse_condition_node_unimplemented,
3424+
_execute_condition_node_unimplemented
3425+
);
3426+
ret &= add_condition(
3427+
"length_greater",
3428+
_parse_condition_node_unimplemented,
3429+
_execute_condition_node_unimplemented
3430+
);
3431+
// Amount printed, NOTE: Seems to be buggy when used on decisions and events
3432+
ret &= add_condition(
3433+
"news_printing_count",
3434+
_parse_condition_node_unimplemented,
3435+
_execute_condition_node_unimplemented
3436+
);
3437+
33283438
if (
33293439
add_condition(
33303440
"root condition",

src/openvic-simulation/scripts/Condition.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ namespace OpenVic {
5959
NO_SCOPE = 0,
6060
POP = 1 << 0,
6161
PROVINCE = 1 << 1,
62-
COUNTRY = 1 << 2,
63-
THIS = 1 << 3, // Indicator bit for scope switching ("use the THIS scope", not a scope in and of itself)
64-
FROM = 1 << 4, // Indicator bit for scope switching ("use the FROM scope", not a scope in and of itself)
65-
FULL_SCOPE_MASK = (1 << 5) - 1, // All possible scope bits (including THIS and FROM)
66-
ALL_SCOPES = POP | PROVINCE | COUNTRY // All real scopes (without THIS and FROM)
62+
STATE = 1 << 2,
63+
COUNTRY = 1 << 3,
64+
THIS = 1 << 4, // Indicator bit for scope switching ("use the THIS scope", not a scope in and of itself)
65+
FROM = 1 << 5, // Indicator bit for scope switching ("use the FROM scope", not a scope in and of itself)
66+
FULL_SCOPE_MASK = (1 << 6) - 1, // All possible scope bits (including THIS and FROM)
67+
ALL_SCOPES = POP | PROVINCE | STATE | COUNTRY // All real scopes (without THIS and FROM)
6768
};
6869

6970
/* Allows enum types to be used with bitwise operators. */

0 commit comments

Comments
 (0)