17 auto content = retrieve<dcon::cb_type_id>(
state,
parent);
25 dcon::cb_type_id content = retrieve<dcon::cb_type_id>(
state,
parent);
27 if(content == selected)
34 dcon::cb_type_id content = retrieve<dcon::cb_type_id>(
state,
parent);
35 dcon::nation_id target = retrieve<dcon::nation_id>(
state,
parent);
36 auto target_state = retrieve<dcon::state_definition_id>(
state,
parent);
44 if(
state.world.nation_get_infamy(
state.local_player_nation) + cb_infamy >=
state.defines.badboy_limit) {
58 dcon::cb_type_id content = retrieve<dcon::cb_type_id>(
state,
parent);
59 dcon::nation_id target = retrieve<dcon::nation_id>(
state,
parent);
66 if(
state.world.nation_get_infamy(
state.local_player_nation) + cb_infamy >=
state.defines.badboy_limit) {
71 if(fat_id.get_can_use()) {
75 if(
auto allowed_substates = fat_id.get_allowed_substate_regions(); allowed_substates) {
77 if(
state.world.nation_get_is_substate(target)) {
78 auto ruler =
state.world.overlord_get_ruler(
state.world.nation_get_overlord_as_subject(target));
84 uint32_t(
state.current_date.value),
uint32_t((
state.local_player_nation.index() << 7) ^ target.index() ^ (fat_id.id.index() << 3)));
90 if(
auto allowed_states = fat_id.get_allowed_states(); allowed_states) {
91 bool described =
false;
92 for(
auto si :
state.world.nation_get_state_ownership(target)) {
109 if(
name ==
"wargoal_icon") {
110 auto ptr = make_element_by_type<wargoal_type_item_icon>(
state,
id);
113 }
else if(
name ==
"select_goal_invalid") {
114 return make_element_by_type<invisible_element>(
state,
id);
115 }
else if(
name ==
"select_goal") {
116 auto ptr = make_element_by_type<wargoal_type_item_button>(
state,
id);
128 return "wargoal_item";
135 auto selected_cb = retrieve<dcon::cb_type_id>(
state,
parent);
142 dcon::nation_id content = retrieve<dcon::nation_id>(
state,
parent);
146 for(
auto cb_type :
state.world.in_cb_type) {
154 bool cb_fabbed =
false;
155 for(
auto& fab_cb :
state.world.nation_get_available_cbs(
state.local_player_nation)) {
156 if(fab_cb.cb_type == cb_type && fab_cb.target == content) {
167 if(
state.world.war_get_is_great(w)) {
168 if(jingoism_perc >=
state.defines.wargoal_jingoism_requirement *
state.defines.gw_wargoal_jingoism_requirement_mod) {
173 if(jingoism_perc >=
state.defines.wargoal_jingoism_requirement) {
190 auto other_cbs =
state.world.nation_get_available_cbs(
state.local_player_nation);
191 for(
auto cb :
state.world.in_cb_type) {
196 for(
auto& fabbed : other_cbs) {
197 if(fabbed.cb_type == cb && fabbed.target == content)
216 if(
name ==
"wargoal_list") {
217 return make_element_by_type<wargoal_type_listbox>(
state,
id);
218 }
else if(
name ==
"cancel_select") {
219 return make_element_by_type<wargoal_cancel_button>(
state,
id);
229 dcon::national_identity_id content = retrieve<dcon::national_identity_id>(
state,
parent);
234 dcon::national_identity_id content = retrieve<dcon::national_identity_id>(
state,
parent);
242 dcon::cb_type_id cb = retrieve<dcon::cb_type_id>(
state,
parent);
243 if(
auto allowed_countries =
state.world.cb_type_get_allowed_countries(cb); allowed_countries) {
244 dcon::nation_id target = retrieve<dcon::nation_id>(
state,
parent);
245 auto holder =
state.world.national_identity_get_nation_from_identity_holder(retrieve<dcon::national_identity_id>(
state,
parent));
254 if(
name ==
"select_country") {
255 return make_element_by_type<wargoal_country_item_button>(
state,
id);
265 return "wargoal_country_item";
272 dcon::nation_id target = retrieve<dcon::nation_id>(
state,
parent);
273 auto actor =
state.local_player_nation;
274 dcon::cb_type_id cb = retrieve<dcon::cb_type_id>(
state,
parent);
277 dcon::trigger_key allowed_countries =
state.world.cb_type_get_allowed_countries(cb);
278 if(!allowed_countries) {
283 for(
auto n :
state.world.in_nation) {
285 auto id =
state.world.nation_get_identity_from_identity_holder(n);
318 if(
name ==
"country_list") {
319 return make_element_by_type<wargoal_country_listbox>(
state,
id);
320 }
else if(
name ==
"cancel_select") {
321 return make_element_by_type<wargoal_cancel_country_select>(
state,
id);
332 auto cb = retrieve<dcon::cb_type_id>(
state,
parent);
333 auto target = retrieve<dcon::nation_id>(
state,
parent);
334 auto source =
state.local_player_nation;
336 dcon::nation_id real_target = target;
338 auto target_ol_rel =
state.world.nation_get_overlord_as_subject(target);
339 if(
state.world.overlord_get_ruler(target_ol_rel))
340 real_target =
state.world.overlord_get_ruler(target_ol_rel);
364 auto cb = retrieve<dcon::cb_type_id>(
state,
parent);
365 auto target = retrieve<dcon::nation_id>(
state,
parent);
366 auto target_state = retrieve<dcon::state_definition_id>(
state,
parent);
368 auto source =
state.local_player_nation;
370 dcon::nation_id real_target = target;
372 auto target_ol_rel =
state.world.nation_get_overlord_as_subject(target);
373 if(
state.world.overlord_get_ruler(target_ol_rel))
374 real_target =
state.world.overlord_get_ruler(target_ol_rel);
400 auto cb = retrieve<dcon::cb_type_id>(
state,
parent);
401 auto target = retrieve<dcon::nation_id>(
state,
parent);
402 auto source =
state.local_player_nation;
404 dcon::nation_id real_target = target;
406 auto target_ol_rel =
state.world.nation_get_overlord_as_subject(target);
407 if(
state.world.overlord_get_ruler(target_ol_rel))
408 real_target =
state.world.overlord_get_ruler(target_ol_rel);
441 if(
name ==
"wargoal_gain_effect_text") {
442 return make_element_by_type<wargoal_add_header>(
state,
id);
443 }
else if(
name ==
"prestige_icon") {
444 return make_element_by_type<image_element_base>(
state,
id);
445 }
else if(
name ==
"prestige") {
446 return make_element_by_type<wargoal_add_prestige>(
state,
id);
447 }
else if(
name ==
"infamy_icon") {
448 return make_element_by_type<image_element_base>(
state,
id);
449 }
else if(
name ==
"infamy") {
450 return make_element_by_type<wargoal_add_infamy>(
state,
id);
451 }
else if(
name ==
"militancy_icon") {
452 return make_element_by_type<image_element_base>(
state,
id);
453 }
else if(
name ==
"militancy") {
454 return make_element_by_type<wargoal_add_militancy>(
state,
id);
473 auto cb = retrieve<dcon::cb_type_id>(
state,
parent);
474 auto source =
state.local_player_nation;
478 if(prestige_gain > 0) {
503 if(
name ==
"wargoal_gain_effect_text") {
504 return make_element_by_type<wargoal_success_header>(
state,
id);
505 }
else if(
name ==
"prestige_icon") {
506 return make_element_by_type<image_element_base>(
state,
id);
507 }
else if(
name ==
"prestige") {
508 return make_element_by_type<wargoal_success_prestige>(
state,
id);
509 }
else if(
name ==
"infamy_icon") {
510 return make_element_by_type<image_element_base>(
state,
id);
511 }
else if(
name ==
"infamy") {
512 return make_element_by_type<fixed_zero>(
state,
id);
513 }
else if(
name ==
"militancy_icon") {
514 return make_element_by_type<image_element_base>(
state,
id);
515 }
else if(
name ==
"militancy") {
516 return make_element_by_type<fixed_zero>(
state,
id);
526 auto cb = retrieve<dcon::cb_type_id>(
state,
parent);
527 auto source =
state.local_player_nation;
531 if(prestige_loss < 0) {
548 auto cb = retrieve<dcon::cb_type_id>(
state,
parent);
550 auto pop_militancy =
state.defines.war_failed_goal_militancy *
state.world.cb_type_get_penalty_factor(cb);
552 if(pop_militancy > 0) {
577 if(
name ==
"wargoal_gain_effect_text") {
578 return make_element_by_type<wargoal_failure_header>(
state,
id);
579 }
else if(
name ==
"prestige_icon") {
580 return make_element_by_type<image_element_base>(
state,
id);
581 }
else if(
name ==
"prestige") {
582 return make_element_by_type<wargoal_failure_prestige>(
state,
id);
583 }
else if(
name ==
"infamy_icon") {
584 return make_element_by_type<image_element_base>(
state,
id);
585 }
else if(
name ==
"infamy") {
586 return make_element_by_type<fixed_zero>(
state,
id);
587 }
else if(
name ==
"militancy_icon") {
588 return make_element_by_type<image_element_base>(
state,
id);
589 }
else if(
name ==
"militancy") {
590 return make_element_by_type<wargoal_failure_militancy>(
state,
id);
620 auto wg_ready = retrieve<check_wg_completion>(
state,
parent).done;
626 dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
627 dcon::state_definition_id s = retrieve<dcon::state_definition_id>(
state,
parent);
628 dcon::national_identity_id ni = retrieve<dcon::national_identity_id>(
state,
parent);
629 dcon::cb_type_id c = retrieve<dcon::cb_type_id>(
state,
parent);
634 state.world.national_identity_get_nation_from_identity_holder(ni));
637 state.world.national_identity_get_nation_from_identity_holder(ni));
642 dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
643 dcon::state_definition_id s = retrieve<dcon::state_definition_id>(
state,
parent);
644 dcon::national_identity_id ni = retrieve<dcon::national_identity_id>(
state,
parent);
645 dcon::cb_type_id c = retrieve<dcon::cb_type_id>(
state,
parent);
647 auto checkboxes = retrieve<diplomacy_declare_war_run_state>(
state,
parent);
651 state.world.national_identity_get_nation_from_identity_holder(ni));
654 state.world.national_identity_get_nation_from_identity_holder(ni),
666 auto wg_ready = retrieve<check_wg_completion>(
state,
parent).done;
672 dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
673 dcon::state_definition_id s = retrieve<dcon::state_definition_id>(
state,
parent);
674 dcon::national_identity_id ni = retrieve<dcon::national_identity_id>(
state,
parent);
675 dcon::cb_type_id c = retrieve<dcon::cb_type_id>(
state,
parent);
678 state.world.national_identity_get_nation_from_identity_holder(ni))) {
689 auto rel =
state.world.get_diplomatic_relation_by_diplomatic_pair(
state.local_player_nation, n);
690 if(
state.world.diplomatic_relation_get_are_allied(rel)) {
697 bool target_in_war =
false;
698 for(
auto par :
state.world.war_get_war_participant(w)) {
699 if(par.get_nation() == n) {
701 target_in_war =
true;
707 text::add_line_with_condition(
state, contents,
"alice_wg_condition_3", !(
military::war_goal_would_be_duplicate(
state,
state.local_player_nation, w, n, c, s, ni,
state.world.national_identity_get_nation_from_identity_holder(ni))));
710 bool cb_fabbed =
false;
711 for(
auto& fab_cb :
state.world.nation_get_available_cbs(
state.local_player_nation)) {
712 if(fab_cb.cb_type == c && fab_cb.target == n) {
721 if(
state.world.war_get_is_great(w)) {
735 if(
auto can_use =
state.world.cb_type_get_can_use(c); can_use) {
768 for(
auto si :
state.world.in_state_instance) {
769 if(si.get_definition() == state_def) {
773 cost +=
military::peace_cost(
state, war,
id,
state.local_player_nation, si.get_nation_from_state_ownership(), dcon::nation_id{}, state_def, second_nation);
775 cost +=
military::peace_cost(
state, war,
id,
state.local_player_nation, si.get_nation_from_state_ownership(),
state.world.national_identity_get_nation_from_identity_holder(second_nation), state_def, dcon::national_identity_id{});
777 cost +=
military::peace_cost(
state, war,
id,
state.local_player_nation, si.get_nation_from_state_ownership(), dcon::nation_id{}, state_def, dcon::national_identity_id{});
783 for(
auto si :
state.world.in_state_instance) {
784 if(si.get_definition() == state_def) {
785 auto n = si.get_nation_from_state_ownership();
786 auto no = n.get_overlord_as_subject().get_ruler();
787 if(n == target || no == target) {
789 cost +=
military::peace_cost(
state, dcon::war_id{}, id,
state.local_player_nation, si.get_nation_from_state_ownership(), dcon::nation_id{}, state_def, second_nation);
791 cost +=
military::peace_cost(
state, dcon::war_id{}, id,
state.local_player_nation, si.get_nation_from_state_ownership(),
state.world.national_identity_get_nation_from_identity_holder(second_nation), state_def, dcon::national_identity_id{});
793 cost +=
military::peace_cost(
state, dcon::war_id{}, id,
state.local_player_nation, si.get_nation_from_state_ownership(), dcon::nation_id{}, state_def, dcon::national_identity_id{});
815 auto id = retrieve<dcon::cb_type_id>(
state,
parent);
818 auto target = retrieve<dcon::nation_id>(
state,
parent);
833 auto state_def = retrieve<dcon::state_definition_id>(
state,
parent);
834 auto second_nation = retrieve<dcon::national_identity_id>(
state,
parent);
847 auto id = retrieve<dcon::cb_type_id>(
state,
parent);
849 auto content = retrieve<dcon::nation_id>(
state,
parent);
850 auto sdef = retrieve<dcon::state_definition_id>(
state,
parent);
851 auto nid = retrieve<dcon::national_identity_id>(
state,
parent);
874 auto content = retrieve<diplomacy_declare_war_run_state>(
state,
parent);
886 auto content = retrieve<diplomacy_declare_war_run_state>(
state,
parent);
888 frame = checked ? 1 : 0;
904 auto target = retrieve<dcon::nation_id>(
state,
parent);
906 bool has_allies =
false;
907 for(
auto dr :
state.world.nation_get_diplomatic_relation(
state.local_player_nation)) {
908 if(dr.get_are_allied()) {
909 auto other = dr.get_related_nations(0) ==
state.local_player_nation ? dr.get_related_nations(1) : dr.get_related_nations(0);
910 if(other.get_is_player_controlled()) {
916 bool will_join =
false;
920 if(
state.world.nation_get_ai_rival(other) == target)
947 auto content = retrieve<diplomacy_declare_war_run_state>(
state,
parent);
960 auto content = retrieve<diplomacy_declare_war_run_state>(
state,
parent);
967 frame = checked ? 1 : 0;
1015 dcon::cb_type_id cb_to_use;
1016 dcon::state_definition_id target_state;
1017 dcon::national_identity_id target_country;
1019 bool wargoal_decided_upon =
false;
1024 dcon::nation_id target = retrieve<dcon::nation_id>(
state,
parent);
1025 auto actor =
state.local_player_nation;
1026 dcon::cb_type_id cb = cb_to_use;
1028 auto secondary_tag = target_country;
1029 auto allowed_substate_regions =
state.world.cb_type_get_allowed_substate_regions(cb);
1032 for(
auto available_cb :
state.world.nation_get_available_cbs(
state.local_player_nation)) {
1033 if(available_cb.cb_type != cb || available_cb.target != target || !available_cb.target_state) {
1037 auto def = available_cb.target_state;
1044 if(allowed_substate_regions) {
1045 for(
auto v :
state.world.nation_get_overlord_as_ruler(target)) {
1046 if(v.get_subject().get_is_substate()) {
1047 for(
auto si :
state.world.nation_get_state_ownership(target)) {
1049 auto def = si.get_state().get_definition().id;
1060 auto allowed_states =
state.world.cb_type_get_allowed_states(cb);
1061 if(
auto ac =
state.world.cb_type_get_allowed_countries(cb); ac) {
1062 auto in_nation =
state.world.national_identity_get_nation_from_identity_holder(secondary_tag);
1063 for(
auto si :
state.world.nation_get_state_ownership(target)) {
1065 auto def = si.get_state().get_definition().id;
1072 for(
auto si :
state.world.nation_get_state_ownership(target)) {
1074 auto def = si.get_state().get_definition().id;
1084 target_state = sdef;
1085 wargoal_decided_upon =
true;
1091 target_state = dcon::state_definition_id{};
1096 cb_to_use = dcon::cb_type_id{};
1097 wargoal_decided_upon =
false;
1103 state.start_state_selection(seldata);
1107 cb_to_use = dcon::cb_type_id{};
1108 target_state = dcon::state_definition_id{};
1109 target_country = dcon::national_identity_id{};
1111 wargoal_decided_upon =
false;
1117 if(
name ==
"background") {
1118 auto ptr = make_element_by_type<draggable_target>(
state,
id);
1121 }
else if(
name ==
"diplo_declarewar_bg") {
1122 return make_element_by_type<image_element_base>(
state,
id);
1123 }
else if(
name ==
"leftshield") {
1124 return make_element_by_type<nation_player_flag>(
state,
id);
1125 }
else if(
name ==
"rightshield") {
1126 return make_element_by_type<flag_button>(
state,
id);
1127 }
else if(
name ==
"title") {
1128 return make_element_by_type<diplomacy_declare_war_title>(
state,
id);
1129 }
else if(
name ==
"description") {
1130 return make_element_by_type<diplomacy_declare_war_description1>(
state,
id);
1131 }
else if(
name ==
"wargoal_add_effect") {
1132 return make_element_by_type<diplomacy_wargoal_add_window>(
state,
id);
1133 }
else if(
name ==
"wargoal_success_effect") {
1134 return make_element_by_type<diplomacy_wargoal_success_window>(
state,
id);
1135 }
else if(
name ==
"wargoal_failure_effect") {
1136 return make_element_by_type<diplomacy_wargoal_failure_window>(
state,
id);
1137 }
else if(
name ==
"description2") {
1138 return make_element_by_type<diplomacy_declare_war_description2>(
state,
id);
1139 }
else if(
name ==
"acceptance") {
1140 return make_element_by_type<simple_text_element_base>(
state,
id);
1141 }
else if(
name ==
"call_allies_checkbox") {
1142 return make_element_by_type<diplomacy_declare_war_call_allies_checkbox>(
state,
id);
1143 }
else if(
name ==
"run_conference_checkbox") {
1144 return make_element_by_type<diplomacy_declare_war_run_conference_checkbox>(
state,
id);
1145 }
else if(
name ==
"call_allies_text") {
1146 return make_element_by_type<diplomacy_declare_war_call_allies_text>(
state,
id);
1147 }
else if(
name ==
"agreebutton") {
1148 return make_element_by_type<diplomacy_declare_war_agree_button>(
state,
id);
1149 }
else if(
name ==
"declinebutton") {
1150 return make_element_by_type<cancel_pick_wg_button>(
state,
id);
1151 }
else if(
name ==
"wargoal_setup") {
1152 auto ptr = make_element_by_type<wargoal_setup_window>(
state,
id);
1153 wargoal_setup_win = ptr.
get();
1154 ptr->set_visible(
state,
true);
1156 }
else if(
name ==
"wargoal_state_select") {
1157 return make_element_by_type<invisible_element>(
state,
id);
1158 }
else if(
name ==
"wargoal_country_select") {
1159 auto ptr = make_element_by_type<wargoal_country_select_window>(
state,
id);
1160 wargoal_country_win = ptr.
get();
1161 ptr->set_visible(
state,
false);
1169 if(payload.holds_type<dcon::war_id>()) {
1170 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
1172 payload.emplace<dcon::war_id>(w);
1178 cb_to_use = any_cast<element_selection_wrapper<dcon::cb_type_id>>(payload).data;
1180 wargoal_decided_upon =
false;
1189 wargoal_decided_upon =
true;
1196 target_country = any_cast<element_selection_wrapper<dcon::national_identity_id>>(payload).data;
1197 if(target_country) {
1203 wargoal_decided_upon =
true;
1208 wargoal_decided_upon =
false;
1209 cb_to_use = dcon::cb_type_id{};
1216 checkboxes_state = any_cast<element_selection_wrapper<diplomacy_declare_war_run_state>>(payload).data;
1219 }
else if(payload.holds_type<dcon::cb_type_id>()) {
1220 payload.emplace<dcon::cb_type_id>(cb_to_use);
1222 }
else if(payload.holds_type<dcon::state_definition_id>()) {
1223 payload.emplace<dcon::state_definition_id>(target_state);
1225 }
else if(payload.holds_type<dcon::national_identity_id>()) {
1226 payload.emplace<dcon::national_identity_id>(target_country);
1249 auto id = retrieve<dcon::cb_type_id>(
state,
parent);
1252 auto target = retrieve<get_target>(
state,
parent).n;
1267 auto state_def = retrieve<dcon::state_definition_id>(
state,
parent);
1268 auto second_nation = retrieve<dcon::national_identity_id>(
state,
parent);
1281 auto id = retrieve<dcon::cb_type_id>(
state,
parent);
1283 auto content = retrieve<get_target>(
state,
parent).n;
1284 auto dest = retrieve<get_offer_to>(
state,
parent).n;
1285 auto staat = retrieve<dcon::state_definition_id>(
state,
parent);
1286 auto nacion = retrieve<dcon::national_identity_id>(
state,
parent);
1311 auto wg_ready = retrieve<check_wg_completion>(
state,
parent).done;
1316 auto ni = retrieve<dcon::national_identity_id>(
state,
parent);
1317 disabled = !
command::can_invite_to_crisis(
state,
state.local_player_nation, retrieve<get_offer_to>(
state,
parent).n, retrieve<get_target>(
state,
parent).n, retrieve<dcon::cb_type_id>(
state,
parent), retrieve<dcon::state_definition_id>(
state,
parent), ni,
state.world.national_identity_get_nation_from_identity_holder(ni));
1321 auto ni = retrieve<dcon::national_identity_id>(
state,
parent);
1322 command::invite_to_crisis(
state,
state.local_player_nation, retrieve<get_offer_to>(
state,
parent).n, retrieve<get_target>(
state,
parent).n, retrieve<dcon::cb_type_id>(
state,
parent), retrieve<dcon::state_definition_id>(
state,
parent), ni,
state.world.national_identity_get_nation_from_identity_holder(ni));
1331 auto wg_ready = retrieve<check_wg_completion>(
state,
parent).done;
1351 auto cb = retrieve<dcon::cb_type_id>(
state,
parent);
1352 auto target = retrieve<get_target>(
state,
parent).n;
1353 auto target_state = retrieve<dcon::state_definition_id>(
state,
parent);
1354 auto offered = retrieve<get_offer_to>(
state,
parent).n;
1357 state.defines.crisis_wargoal_infamy_mult;
1373 if(
name ==
"wargoal_gain_effect_text") {
1374 return make_element_by_type<wargoal_add_header>(
state,
id);
1375 }
else if(
name ==
"prestige_icon") {
1376 return make_element_by_type<image_element_base>(
state,
id);
1377 }
else if(
name ==
"prestige") {
1378 return make_element_by_type<fixed_zero>(
state,
id);
1379 }
else if(
name ==
"infamy_icon") {
1380 return make_element_by_type<image_element_base>(
state,
id);
1381 }
else if(
name ==
"infamy") {
1382 return make_element_by_type<wargoal_offer_add_infamy>(
state,
id);
1383 }
else if(
name ==
"militancy_icon") {
1384 return make_element_by_type<image_element_base>(
state,
id);
1385 }
else if(
name ==
"militancy") {
1386 return make_element_by_type<fixed_zero>(
state,
id);
1396 return "wargoal_item";
1403 auto selected_cb = retrieve<dcon::cb_type_id>(
state,
parent);
1410 dcon::nation_id actor = retrieve<get_offer_to>(
state,
parent).n;
1411 dcon::nation_id content = retrieve<get_target>(
state,
parent).n;
1413 for(
auto cb_type :
state.world.in_cb_type) {
1430 if(
name ==
"country_list") {
1431 return make_element_by_type<wargoal_offer_type_listbox>(
state,
id);
1432 }
else if(
name ==
"cancel_select") {
1433 return make_element_by_type<wargoal_cancel_button>(
state,
id);
1444 auto n = retrieve<dcon::nation_id>(
state,
parent);
1449 auto n = retrieve<dcon::nation_id>(
state,
parent);
1456 dcon::cb_type_id cb = retrieve<dcon::cb_type_id>(
state,
parent);
1457 if(
auto allowed_countries =
state.world.cb_type_get_allowed_countries(cb); allowed_countries) {
1458 dcon::nation_id target = retrieve<dcon::nation_id>(
state,
parent);
1459 auto holder =
state.world.national_identity_get_nation_from_identity_holder(retrieve<dcon::national_identity_id>(
state,
parent));
1468 if(
name ==
"select_country") {
1469 return make_element_by_type<wargoal_target_country_item_button>(
state,
id);
1479 return "wargoal_country_item";
1485 for(
auto& par :
state.crisis_participants) {
1489 if(!par.merely_interested) {
1490 if(
state.local_player_nation ==
state.primary_crisis_attacker && !par.supports_attacker)
1492 else if(
state.local_player_nation ==
state.primary_crisis_defender && par.supports_attacker)
1504 if(
name ==
"wargoal_list") {
1505 return make_element_by_type<wargoal_target_country_listbox>(
state,
id);
1515 return "wargoal_country_item";
1522 dcon::nation_id target = retrieve<get_target>(
state,
parent).n;
1523 auto actor = retrieve<get_offer_to>(
state,
parent).n;
1524 dcon::cb_type_id cb = retrieve<dcon::cb_type_id>(
state,
parent);
1526 dcon::trigger_key allowed_countries =
state.world.cb_type_get_allowed_countries(cb);
1527 if(!allowed_countries) {
1532 for(
auto n :
state.world.in_nation) {
1534 row_contents.push_back(
state.world.nation_get_identity_from_identity_holder(n));
1544 if(
name ==
"country_list") {
1545 return make_element_by_type<wargoal_offer_country_listbox>(
state,
id);
1546 }
else if(
name ==
"cancel_select") {
1547 return make_element_by_type<wargoal_cancel_country_select>(
state,
id);
1560 dcon::nation_id offer_made_to;
1561 dcon::nation_id wargoal_against;
1562 dcon::cb_type_id cb_to_use;
1563 dcon::state_definition_id target_state;
1564 dcon::national_identity_id target_country;
1565 bool will_call_allies =
false;
1566 bool wargoal_decided_upon =
false;
1572 dcon::nation_id target = wargoal_against;
1573 auto actor =
state.local_player_nation;
1574 dcon::cb_type_id cb = cb_to_use;
1575 auto secondary_tag = target_country;
1576 auto allowed_substate_regions =
state.world.cb_type_get_allowed_substate_regions(cb);
1577 if(allowed_substate_regions) {
1578 auto in_nation =
state.world.national_identity_get_nation_from_identity_holder(secondary_tag);
1579 for(
auto v :
state.world.nation_get_overlord_as_ruler(target)) {
1580 if(v.get_subject().get_is_substate()) {
1581 for(
auto si :
state.world.nation_get_state_ownership(target)) {
1590 auto allowed_states =
state.world.cb_type_get_allowed_states(cb);
1591 if(
auto allowed_countries =
state.world.cb_type_get_allowed_countries(cb); allowed_countries) {
1592 auto in_nation =
state.world.national_identity_get_nation_from_identity_holder(secondary_tag);
1593 for(
auto si :
state.world.nation_get_state_ownership(target)) {
1600 auto in_nation =
state.world.national_identity_get_nation_from_identity_holder(secondary_tag);
1601 for(
auto si :
state.world.nation_get_state_ownership(target)) {
1610 target_state = sdef;
1611 wargoal_decided_upon =
true;
1617 target_state = dcon::state_definition_id{};
1623 cb_to_use = dcon::cb_type_id{};
1624 wargoal_decided_upon =
false;
1631 state.start_state_selection(seldata);
1635 wargoal_against = dcon::nation_id{};
1636 offer_made_to = offer_to;
1637 cb_to_use = dcon::cb_type_id{};
1638 target_state = dcon::state_definition_id{};
1639 target_country = dcon::national_identity_id{};
1640 will_call_allies =
false;
1641 wargoal_decided_upon =
false;
1650 if(
name ==
"background") {
1651 auto ptr = make_element_by_type<draggable_target>(
state,
id);
1654 }
else if(
name ==
"leftshield") {
1655 return make_element_by_type<nation_player_flag>(
state,
id);
1656 }
else if(
name ==
"rightshield") {
1657 return make_element_by_type<flag_button>(
state,
id);
1658 }
else if(
name ==
"title") {
1659 return make_element_by_type<wargoal_offer_title>(
state,
id);
1660 }
else if(
name ==
"description") {
1661 return make_element_by_type<wargoal_offer_description1>(
state,
id);
1662 }
else if(
name ==
"wargoal_add_effect") {
1663 return make_element_by_type<wargoal_offer_add_window>(
state,
id);
1664 }
else if(
name ==
"wargoal_success_effect" ||
name ==
"wargoal_failure_effect") {
1665 return make_element_by_type<invisible_element>(
state,
id);
1666 }
else if(
name ==
"description2") {
1667 return make_element_by_type<wargoal_offer_description2>(
state,
id);
1668 }
else if(
name ==
"acceptance") {
1669 return make_element_by_type<simple_text_element_base>(
state,
id);
1670 }
else if(
name ==
"call_allies_checkbox") {
1671 return make_element_by_type<invisible_element>(
state,
id);
1672 }
if(
name ==
"call_allies_checkbox") {
1673 return make_element_by_type<invisible_element>(
state,
id);
1674 }
else if(
name ==
"run_conference_checkbox") {
1675 return make_element_by_type<invisible_element>(
state,
id);
1676 }
else if(
name ==
"agreebutton") {
1677 return make_element_by_type<wargoal_offer_agree_button>(
state,
id);
1678 }
else if(
name ==
"declinebutton") {
1679 return make_element_by_type<cancel_pick_wg_button>(
state,
id);
1680 }
else if(
name ==
"wargoal_setup") {
1681 auto ptr = make_element_by_type<wargoal_target_country_select_window>(
state,
id);
1682 wargoal_target_win = ptr.
get();
1683 ptr->set_visible(
state,
true);
1685 }
else if(
name ==
"wargoal_state_select") {
1686 return make_element_by_type<invisible_element>(
state,
id);
1687 }
else if(
name ==
"wargoal_country_select") {
1689 auto ptr = make_element_by_type<wargoal_offer_setup_window>(
state,
id);
1690 wargoal_setup_win = ptr.
get();
1691 ptr->set_visible(
state,
false);
1695 auto ptr = make_element_by_type<wargoal_offer_country_select_window>(
state,
id);
1696 wargoal_country_win = ptr.
get();
1697 ptr->set_visible(
state,
false);
1706 if(payload.holds_type<dcon::nation_id>()) {
1707 payload.emplace<dcon::nation_id>(offer_made_to);
1708 }
else if(payload.holds_type<
get_target>()) {
1716 cb_to_use = any_cast<element_selection_wrapper<dcon::cb_type_id>>(payload).data;
1718 wargoal_against = dcon::nation_id{};
1719 cb_to_use = dcon::cb_type_id{};
1720 target_state = dcon::state_definition_id{};
1721 target_country = dcon::national_identity_id{};
1722 wargoal_decided_upon =
false;
1740 wargoal_decided_upon =
true;
1749 target_country = any_cast<element_selection_wrapper<dcon::national_identity_id>>(payload).data;
1751 if(target_country) {
1763 wargoal_decided_upon =
true;
1766 wargoal_decided_upon =
false;
1767 cb_to_use = dcon::cb_type_id{};
1776 }
else if(payload.holds_type<
set_target>()) {
1777 wargoal_against = any_cast<set_target>(payload).n;
1778 if(wargoal_against) {
1779 wargoal_decided_upon =
false;
1780 cb_to_use = dcon::cb_type_id{};
1787 }
else if(payload.holds_type<dcon::cb_type_id>()) {
1788 payload.emplace<dcon::cb_type_id>(cb_to_use);
1790 }
else if(payload.holds_type<dcon::state_definition_id>()) {
1791 payload.emplace<dcon::state_definition_id>(target_state);
1793 }
else if(payload.holds_type<dcon::national_identity_id>()) {
1794 payload.emplace<dcon::national_identity_id>(target_country);
1796 }
else if(payload.holds_type<
bool>()) {
1797 payload.emplace<
bool>(will_call_allies);
dcon::text_key get_name() noexcept
void add_child_to_front(std::unique_ptr< element_base > child) noexcept final
void impl_on_update(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void button_action(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void on_update(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
void populate_layout(sys::state &state, text::endless_layout &contents) noexcept override
void populate_layout(sys::state &state, text::endless_layout &contents) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
void reset_window(sys::state &state)
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
virtual message_result get(sys::state &state, Cyto::Any &payload) noexcept
message_result impl_get(sys::state &state, Cyto::Any &payload) noexcept
void set_visible(sys::state &state, bool vis)
void on_create(sys::state &state) noexcept override
std::vector< dcon::cb_type_id > row_contents
void update(sys::state &state)
void reset_window(sys::state &state, dcon::nation_id offer_to)
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
void on_create(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
std::string_view get_row_element_name() override
void on_update(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
std::string_view get_row_element_name() override
void on_update(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
void populate_layout(sys::state &state, text::endless_layout &contents) noexcept override
void populate_layout(sys::state &state, text::endless_layout &contents) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
void on_create(sys::state &state) noexcept override
std::string_view get_row_element_name() override
void on_update(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
void on_update(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
std::string_view get_row_element_name() override
void on_update(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
void on_update(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
std::string_view get_row_element_name() override
void on_update(sys::state &state) noexcept override
bool can_invite_to_crisis(sys::state &state, dcon::nation_id source, dcon::nation_id invitation_to, dcon::nation_id target, dcon::cb_type_id primary_cb, dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag, dcon::nation_id cb_secondary_nation)
bool can_add_war_goal(sys::state &state, dcon::nation_id source, dcon::war_id w, dcon::nation_id target, dcon::cb_type_id cb_type, dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag, dcon::nation_id cb_secondary_nation)
bool can_declare_war(sys::state &state, dcon::nation_id source, dcon::nation_id target, dcon::cb_type_id primary_cb, dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag, dcon::nation_id cb_secondary_nation)
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
constexpr dcon::demographics_key total(0)
dcon::demographics_key to_key(sys::state const &state, dcon::pop_type_id v)
void switch_scene(sys::state &state, scene_id ui_scene)
constexpr uint32_t is_not_constructing_cb
constexpr uint32_t always
bool are_allied_in_war(sys::state const &state, dcon::nation_id a, dcon::nation_id b)
float truce_break_cb_prestige_cost(sys::state &state, dcon::cb_type_id t)
bool cb_conditions_satisfied(sys::state &state, dcon::nation_id actor, dcon::nation_id target, dcon::cb_type_id cb)
float crisis_cb_addition_infamy_cost(sys::state &state, dcon::cb_type_id type, dcon::nation_id from, dcon::nation_id target, dcon::state_definition_id cb_state)
bool can_use_cb_against(sys::state &state, dcon::nation_id from, dcon::nation_id target)
bool has_truce_with(sys::state &state, dcon::nation_id attacker, dcon::nation_id target)
float cb_addition_infamy_cost(sys::state &state, dcon::war_id war, dcon::cb_type_id type, dcon::nation_id from, dcon::nation_id target, dcon::state_definition_id cb_state)
war_role get_role(sys::state const &state, dcon::war_id w, dcon::nation_id n)
bool is_attacker(sys::state &state, dcon::war_id w, dcon::nation_id n)
float truce_break_cb_infamy(sys::state &state, dcon::cb_type_id t, dcon::nation_id target, dcon::state_definition_id cb_state)
bool cb_requires_selection_of_a_valid_nation(sys::state const &state, dcon::cb_type_id t)
bool are_in_common_war(sys::state const &state, dcon::nation_id a, dcon::nation_id b)
dcon::war_id find_war_between(sys::state const &state, dcon::nation_id a, dcon::nation_id b)
bool cb_instance_conditions_satisfied(sys::state &state, dcon::nation_id actor, dcon::nation_id target, dcon::cb_type_id cb, dcon::state_definition_id st, dcon::national_identity_id tag, dcon::nation_id secondary)
float truce_break_cb_militancy(sys::state &state, dcon::cb_type_id t)
float cb_infamy(sys::state &state, dcon::cb_type_id t, dcon::nation_id target, dcon::state_definition_id cb_state)
bool are_at_war(sys::state const &state, dcon::nation_id a, dcon::nation_id b)
bool cb_requires_selection_of_a_liberatable_tag(sys::state const &state, dcon::cb_type_id t)
int32_t peace_cost(sys::state &state, dcon::war_id war, dcon::cb_type_id wargoal, dcon::nation_id from, dcon::nation_id target, dcon::nation_id secondary_nation, dcon::state_definition_id wargoal_state, dcon::national_identity_id wargoal_tag)
bool can_add_always_cb_to_war(sys::state &state, dcon::nation_id actor, dcon::nation_id target, dcon::cb_type_id cb, dcon::war_id w)
bool defenders_have_status_quo_wargoal(sys::state const &state, dcon::war_id w)
bool war_goal_would_be_duplicate(sys::state &state, dcon::nation_id source, dcon::war_id w, dcon::nation_id target, dcon::cb_type_id cb_type, dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag, dcon::nation_id cb_secondary_nation)
float successful_cb_prestige(sys::state &state, dcon::cb_type_id t, dcon::nation_id actor)
bool cb_requires_selection_of_a_state(sys::state const &state, dcon::cb_type_id t)
bool are_allied(sys::state &state, dcon::nation_id a, dcon::nation_id b)
float prestige_score(sys::state const &state, dcon::nation_id n)
uint32_t pack_color(float r, float g, float b)
void add_to_layout_box(sys::state &state, layout_base &dest, layout_box &box, embedded_flag ico)
layout_box open_layout_box(layout_base &dest, int32_t indent)
void localised_format_box(sys::state &state, layout_base &dest, layout_box &box, std::string_view key, text::substitution_map const &sub)
std::string format_float(float num, size_t digits)
void add_line(sys::state &state, layout_base &dest, dcon::text_key txt, int32_t indent)
void add_line_with_condition(sys::state &state, layout_base &dest, std::string_view key, bool condition_met, int32_t indent)
void add_to_substitution_map(substitution_map &mp, variable_type key, substitution value)
ankerl::unordered_dense::map< uint32_t, substitution > substitution_map
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
dcon::text_key get_name(sys::state &state, dcon::nation_id id)
void close_layout_box(columnar_layout &dest, layout_box &box)
int32_t to_generic(dcon::province_id v)
bool evaluate(sys::state &state, dcon::trigger_key key, int32_t primary, int32_t this_slot, int32_t from_slot)
int32_t calculate_partial_score(sys::state &state, dcon::nation_id target, dcon::cb_type_id id, dcon::state_definition_id state_def, dcon::national_identity_id second_nation)
void effect_description(sys::state &state, text::layout_base &layout, dcon::effect_key k, int32_t primary_slot, int32_t this_slot, int32_t from_slot, uint32_t r_lo, uint32_t r_hi)
diplomacy_declare_war_run_state
void send(sys::state &state, element_base *parent, T value)
void trigger_description(sys::state &state, text::layout_base &layout, dcon::trigger_key k, int32_t primary_slot=-1, int32_t this_slot=-1, int32_t from_slot=-1)
std::vector< dcon::state_definition_id > selectable_states
std::function< void(sys::state &, dcon::state_definition_id)> on_select
std::function< void(sys::state &)> on_cancel
Holds important data about the game world, state, and other data regarding windowing,...