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);
42 if(
state.world.nation_get_infamy(
state.local_player_nation) + cb_infamy >=
state.defines.badboy_limit) {
56 dcon::cb_type_id content = retrieve<dcon::cb_type_id>(
state,
parent);
57 dcon::nation_id target = retrieve<dcon::nation_id>(
state,
parent);
64 if(
state.world.nation_get_infamy(
state.local_player_nation) + cb_infamy >=
state.defines.badboy_limit) {
69 if(fat_id.get_can_use()) {
73 if(
auto allowed_substates = fat_id.get_allowed_substate_regions(); allowed_substates) {
75 if(
state.world.nation_get_is_substate(target)) {
76 auto ruler =
state.world.overlord_get_ruler(
state.world.nation_get_overlord_as_subject(target));
82 uint32_t(
state.current_date.value),
uint32_t((
state.local_player_nation.index() << 7) ^ target.index() ^ (fat_id.id.index() << 3)));
88 if(
auto allowed_states = fat_id.get_allowed_states(); allowed_states) {
89 bool described =
false;
90 for(
auto si :
state.world.nation_get_state_ownership(target)) {
107 if(
name ==
"wargoal_icon") {
108 auto ptr = make_element_by_type<wargoal_type_item_icon>(
state,
id);
111 }
else if(
name ==
"select_goal_invalid") {
112 return make_element_by_type<invisible_element>(
state,
id);
113 }
else if(
name ==
"select_goal") {
114 auto ptr = make_element_by_type<wargoal_type_item_button>(
state,
id);
126 return "wargoal_item";
133 auto selected_cb = retrieve<dcon::cb_type_id>(
state,
parent);
140 dcon::nation_id content = retrieve<dcon::nation_id>(
state,
parent);
144 for(
auto cb_type :
state.world.in_cb_type) {
152 bool cb_fabbed =
false;
153 for(
auto& fab_cb :
state.world.nation_get_available_cbs(
state.local_player_nation)) {
154 if(fab_cb.cb_type == cb_type && fab_cb.target == content) {
165 if(
state.world.war_get_is_great(w)) {
166 if(jingoism_perc >=
state.defines.wargoal_jingoism_requirement *
state.defines.gw_wargoal_jingoism_requirement_mod) {
171 if(jingoism_perc >=
state.defines.wargoal_jingoism_requirement) {
188 auto other_cbs =
state.world.nation_get_available_cbs(
state.local_player_nation);
189 for(
auto cb :
state.world.in_cb_type) {
194 for(
auto& fabbed : other_cbs) {
195 if(fabbed.cb_type == cb && fabbed.target == content)
214 if(
name ==
"wargoal_list") {
215 return make_element_by_type<wargoal_type_listbox>(
state,
id);
216 }
else if(
name ==
"cancel_select") {
217 return make_element_by_type<wargoal_cancel_button>(
state,
id);
227 dcon::national_identity_id content = retrieve<dcon::national_identity_id>(
state,
parent);
232 dcon::national_identity_id content = retrieve<dcon::national_identity_id>(
state,
parent);
240 dcon::cb_type_id cb = retrieve<dcon::cb_type_id>(
state,
parent);
241 if(
auto allowed_countries =
state.world.cb_type_get_allowed_countries(cb); allowed_countries) {
242 dcon::nation_id target = retrieve<dcon::nation_id>(
state,
parent);
243 auto holder =
state.world.national_identity_get_nation_from_identity_holder(retrieve<dcon::national_identity_id>(
state,
parent));
252 if(
name ==
"select_country") {
253 return make_element_by_type<wargoal_country_item_button>(
state,
id);
263 return "wargoal_country_item";
270 dcon::nation_id target = retrieve<dcon::nation_id>(
state,
parent);
271 auto actor =
state.local_player_nation;
272 dcon::cb_type_id cb = retrieve<dcon::cb_type_id>(
state,
parent);
275 dcon::trigger_key allowed_countries =
state.world.cb_type_get_allowed_countries(cb);
276 if(!allowed_countries) {
281 for(
auto n :
state.world.in_nation) {
283 auto id =
state.world.nation_get_identity_from_identity_holder(n);
316 if(
name ==
"country_list") {
317 return make_element_by_type<wargoal_country_listbox>(
state,
id);
318 }
else if(
name ==
"cancel_select") {
319 return make_element_by_type<wargoal_cancel_country_select>(
state,
id);
330 auto cb = retrieve<dcon::cb_type_id>(
state,
parent);
331 auto target = retrieve<dcon::nation_id>(
state,
parent);
332 auto source =
state.local_player_nation;
334 dcon::nation_id real_target = target;
336 auto target_ol_rel =
state.world.nation_get_overlord_as_subject(target);
337 if(
state.world.overlord_get_ruler(target_ol_rel))
338 real_target =
state.world.overlord_get_ruler(target_ol_rel);
362 auto cb = retrieve<dcon::cb_type_id>(
state,
parent);
363 auto target = retrieve<dcon::nation_id>(
state,
parent);
364 auto source =
state.local_player_nation;
366 dcon::nation_id real_target = target;
368 auto target_ol_rel =
state.world.nation_get_overlord_as_subject(target);
369 if(
state.world.overlord_get_ruler(target_ol_rel))
370 real_target =
state.world.overlord_get_ruler(target_ol_rel);
396 auto cb = retrieve<dcon::cb_type_id>(
state,
parent);
397 auto target = retrieve<dcon::nation_id>(
state,
parent);
398 auto source =
state.local_player_nation;
400 dcon::nation_id real_target = target;
402 auto target_ol_rel =
state.world.nation_get_overlord_as_subject(target);
403 if(
state.world.overlord_get_ruler(target_ol_rel))
404 real_target =
state.world.overlord_get_ruler(target_ol_rel);
437 if(
name ==
"wargoal_gain_effect_text") {
438 return make_element_by_type<wargoal_add_header>(
state,
id);
439 }
else if(
name ==
"prestige_icon") {
440 return make_element_by_type<image_element_base>(
state,
id);
441 }
else if(
name ==
"prestige") {
442 return make_element_by_type<wargoal_add_prestige>(
state,
id);
443 }
else if(
name ==
"infamy_icon") {
444 return make_element_by_type<image_element_base>(
state,
id);
445 }
else if(
name ==
"infamy") {
446 return make_element_by_type<wargoal_add_infamy>(
state,
id);
447 }
else if(
name ==
"militancy_icon") {
448 return make_element_by_type<image_element_base>(
state,
id);
449 }
else if(
name ==
"militancy") {
450 return make_element_by_type<wargoal_add_militancy>(
state,
id);
469 auto cb = retrieve<dcon::cb_type_id>(
state,
parent);
470 auto source =
state.local_player_nation;
474 if(prestige_gain > 0) {
499 if(
name ==
"wargoal_gain_effect_text") {
500 return make_element_by_type<wargoal_success_header>(
state,
id);
501 }
else if(
name ==
"prestige_icon") {
502 return make_element_by_type<image_element_base>(
state,
id);
503 }
else if(
name ==
"prestige") {
504 return make_element_by_type<wargoal_success_prestige>(
state,
id);
505 }
else if(
name ==
"infamy_icon") {
506 return make_element_by_type<image_element_base>(
state,
id);
507 }
else if(
name ==
"infamy") {
508 return make_element_by_type<fixed_zero>(
state,
id);
509 }
else if(
name ==
"militancy_icon") {
510 return make_element_by_type<image_element_base>(
state,
id);
511 }
else if(
name ==
"militancy") {
512 return make_element_by_type<fixed_zero>(
state,
id);
522 auto cb = retrieve<dcon::cb_type_id>(
state,
parent);
523 auto source =
state.local_player_nation;
527 if(prestige_loss < 0) {
544 auto cb = retrieve<dcon::cb_type_id>(
state,
parent);
546 auto pop_militancy =
state.defines.war_failed_goal_militancy *
state.world.cb_type_get_penalty_factor(cb);
548 if(pop_militancy > 0) {
573 if(
name ==
"wargoal_gain_effect_text") {
574 return make_element_by_type<wargoal_failure_header>(
state,
id);
575 }
else if(
name ==
"prestige_icon") {
576 return make_element_by_type<image_element_base>(
state,
id);
577 }
else if(
name ==
"prestige") {
578 return make_element_by_type<wargoal_failure_prestige>(
state,
id);
579 }
else if(
name ==
"infamy_icon") {
580 return make_element_by_type<image_element_base>(
state,
id);
581 }
else if(
name ==
"infamy") {
582 return make_element_by_type<fixed_zero>(
state,
id);
583 }
else if(
name ==
"militancy_icon") {
584 return make_element_by_type<image_element_base>(
state,
id);
585 }
else if(
name ==
"militancy") {
586 return make_element_by_type<wargoal_failure_militancy>(
state,
id);
612 auto wg_ready = retrieve<check_wg_completion>(
state,
parent).done;
618 dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
619 dcon::state_definition_id s = retrieve<dcon::state_definition_id>(
state,
parent);
620 dcon::national_identity_id ni = retrieve<dcon::national_identity_id>(
state,
parent);
621 dcon::cb_type_id c = retrieve<dcon::cb_type_id>(
state,
parent);
626 state.world.national_identity_get_nation_from_identity_holder(ni));
629 state.world.national_identity_get_nation_from_identity_holder(ni));
634 dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
635 dcon::state_definition_id s = retrieve<dcon::state_definition_id>(
state,
parent);
636 dcon::national_identity_id ni = retrieve<dcon::national_identity_id>(
state,
parent);
637 dcon::cb_type_id c = retrieve<dcon::cb_type_id>(
state,
parent);
641 state.world.national_identity_get_nation_from_identity_holder(ni));
644 state.world.national_identity_get_nation_from_identity_holder(ni), retrieve<bool>(
state,
parent));
654 auto wg_ready = retrieve<check_wg_completion>(
state,
parent).done;
660 dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
661 dcon::state_definition_id s = retrieve<dcon::state_definition_id>(
state,
parent);
662 dcon::national_identity_id ni = retrieve<dcon::national_identity_id>(
state,
parent);
663 dcon::cb_type_id c = retrieve<dcon::cb_type_id>(
state,
parent);
666 state.world.national_identity_get_nation_from_identity_holder(ni))) {
677 auto rel =
state.world.get_diplomatic_relation_by_diplomatic_pair(
state.local_player_nation, n);
678 if(
state.world.diplomatic_relation_get_are_allied(rel)) {
685 bool target_in_war =
false;
686 for(
auto par :
state.world.war_get_war_participant(w)) {
687 if(par.get_nation() == n) {
689 target_in_war =
true;
695 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))));
698 bool cb_fabbed =
false;
699 for(
auto& fab_cb :
state.world.nation_get_available_cbs(
state.local_player_nation)) {
700 if(fab_cb.cb_type == c && fab_cb.target == n) {
709 if(
state.world.war_get_is_great(w)) {
723 if(
auto can_use =
state.world.cb_type_get_can_use(c); can_use) {
756 for(
auto si :
state.world.in_state_instance) {
757 if(si.get_definition() == state_def) {
761 cost +=
military::peace_cost(
state, war,
id,
state.local_player_nation, si.get_nation_from_state_ownership(), dcon::nation_id{}, state_def, second_nation);
763 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{});
765 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{});
771 for(
auto si :
state.world.in_state_instance) {
772 if(si.get_definition() == state_def) {
773 auto n = si.get_nation_from_state_ownership();
774 auto no = n.get_overlord_as_subject().get_ruler();
775 if(n == target || no == target) {
777 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);
779 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{});
781 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{});
803 auto id = retrieve<dcon::cb_type_id>(
state,
parent);
806 auto target = retrieve<dcon::nation_id>(
state,
parent);
821 auto state_def = retrieve<dcon::state_definition_id>(
state,
parent);
822 auto second_nation = retrieve<dcon::national_identity_id>(
state,
parent);
835 auto id = retrieve<dcon::cb_type_id>(
state,
parent);
837 auto content = retrieve<dcon::nation_id>(
state,
parent);
838 auto sdef = retrieve<dcon::state_definition_id>(
state,
parent);
839 auto nid = retrieve<dcon::national_identity_id>(
state,
parent);
870 frame = content ? 1 : 0;
886 auto target = retrieve<dcon::nation_id>(
state,
parent);
888 bool has_allies =
false;
889 for(
auto dr :
state.world.nation_get_diplomatic_relation(
state.local_player_nation)) {
890 if(dr.get_are_allied()) {
891 auto other = dr.get_related_nations(0) ==
state.local_player_nation ? dr.get_related_nations(1) : dr.get_related_nations(0);
892 if(other.get_is_player_controlled()) {
898 bool will_join =
false;
902 if(
state.world.nation_get_ai_rival(other) == target)
953 dcon::cb_type_id cb_to_use;
954 dcon::state_definition_id target_state;
955 dcon::national_identity_id target_country;
956 bool will_call_allies =
false;
957 bool wargoal_decided_upon =
false;
962 dcon::nation_id target = retrieve<dcon::nation_id>(
state,
parent);
963 auto actor =
state.local_player_nation;
964 dcon::cb_type_id cb = cb_to_use;
966 auto secondary_tag = target_country;
967 auto allowed_substate_regions =
state.world.cb_type_get_allowed_substate_regions(cb);
968 if(allowed_substate_regions) {
969 for(
auto v :
state.world.nation_get_overlord_as_ruler(target)) {
970 if(v.get_subject().get_is_substate()) {
971 for(
auto si :
state.world.nation_get_state_ownership(target)) {
973 auto def = si.get_state().get_definition().id;
984 auto allowed_states =
state.world.cb_type_get_allowed_states(cb);
985 if(
auto ac =
state.world.cb_type_get_allowed_countries(cb); ac) {
986 auto in_nation =
state.world.national_identity_get_nation_from_identity_holder(secondary_tag);
987 for(
auto si :
state.world.nation_get_state_ownership(target)) {
989 auto def = si.get_state().get_definition().id;
996 for(
auto si :
state.world.nation_get_state_ownership(target)) {
998 auto def = si.get_state().get_definition().id;
1007 target_state = sdef;
1008 wargoal_decided_upon =
true;
1014 target_state = dcon::state_definition_id{};
1019 cb_to_use = dcon::cb_type_id{};
1020 wargoal_decided_upon =
false;
1026 state.start_state_selection(seldata);
1030 cb_to_use = dcon::cb_type_id{};
1031 target_state = dcon::state_definition_id{};
1032 target_country = dcon::national_identity_id{};
1033 will_call_allies =
false;
1034 wargoal_decided_upon =
false;
1040 if(
name ==
"background") {
1041 auto ptr = make_element_by_type<draggable_target>(
state,
id);
1044 }
else if(
name ==
"diplo_declarewar_bg") {
1045 return make_element_by_type<image_element_base>(
state,
id);
1046 }
else if(
name ==
"leftshield") {
1047 return make_element_by_type<nation_player_flag>(
state,
id);
1048 }
else if(
name ==
"rightshield") {
1049 return make_element_by_type<flag_button>(
state,
id);
1050 }
else if(
name ==
"title") {
1051 return make_element_by_type<diplomacy_declare_war_title>(
state,
id);
1052 }
else if(
name ==
"description") {
1053 return make_element_by_type<diplomacy_declare_war_description1>(
state,
id);
1054 }
else if(
name ==
"wargoal_add_effect") {
1055 return make_element_by_type<diplomacy_wargoal_add_window>(
state,
id);
1056 }
else if(
name ==
"wargoal_success_effect") {
1057 return make_element_by_type<diplomacy_wargoal_success_window>(
state,
id);
1058 }
else if(
name ==
"wargoal_failure_effect") {
1059 return make_element_by_type<diplomacy_wargoal_failure_window>(
state,
id);
1060 }
else if(
name ==
"description2") {
1061 return make_element_by_type<diplomacy_declare_war_description2>(
state,
id);
1062 }
else if(
name ==
"acceptance") {
1063 return make_element_by_type<simple_text_element_base>(
state,
id);
1064 }
else if(
name ==
"call_allies_checkbox") {
1065 return make_element_by_type<diplomacy_declare_war_call_allies_checkbox>(
state,
id);
1066 }
else if(
name ==
"call_allies_text") {
1067 return make_element_by_type<diplomacy_declare_war_call_allies_text>(
state,
id);
1068 }
else if(
name ==
"agreebutton") {
1069 return make_element_by_type<diplomacy_declare_war_agree_button>(
state,
id);
1070 }
else if(
name ==
"declinebutton") {
1071 return make_element_by_type<cancel_pick_wg_button>(
state,
id);
1072 }
else if(
name ==
"wargoal_setup") {
1073 auto ptr = make_element_by_type<wargoal_setup_window>(
state,
id);
1074 wargoal_setup_win = ptr.
get();
1075 ptr->set_visible(
state,
true);
1077 }
else if(
name ==
"wargoal_state_select") {
1078 return make_element_by_type<invisible_element>(
state,
id);
1079 }
else if(
name ==
"wargoal_country_select") {
1080 auto ptr = make_element_by_type<wargoal_country_select_window>(
state,
id);
1081 wargoal_country_win = ptr.
get();
1082 ptr->set_visible(
state,
false);
1090 if(payload.holds_type<dcon::war_id>()) {
1091 const dcon::nation_id n = retrieve<dcon::nation_id>(
state,
parent);
1093 payload.emplace<dcon::war_id>(w);
1099 cb_to_use = any_cast<element_selection_wrapper<dcon::cb_type_id>>(payload).data;
1101 wargoal_decided_upon =
false;
1110 wargoal_decided_upon =
true;
1117 target_country = any_cast<element_selection_wrapper<dcon::national_identity_id>>(payload).data;
1118 if(target_country) {
1124 wargoal_decided_upon =
true;
1129 wargoal_decided_upon =
false;
1130 cb_to_use = dcon::cb_type_id{};
1137 will_call_allies = any_cast<element_selection_wrapper<bool>>(payload).data;
1140 }
else if(payload.holds_type<dcon::cb_type_id>()) {
1141 payload.emplace<dcon::cb_type_id>(cb_to_use);
1143 }
else if(payload.holds_type<dcon::state_definition_id>()) {
1144 payload.emplace<dcon::state_definition_id>(target_state);
1146 }
else if(payload.holds_type<dcon::national_identity_id>()) {
1147 payload.emplace<dcon::national_identity_id>(target_country);
1149 }
else if(payload.holds_type<
bool>()) {
1150 payload.emplace<
bool>(will_call_allies);
1170 auto id = retrieve<dcon::cb_type_id>(
state,
parent);
1173 auto target = retrieve<get_target>(
state,
parent).n;
1188 auto state_def = retrieve<dcon::state_definition_id>(
state,
parent);
1189 auto second_nation = retrieve<dcon::national_identity_id>(
state,
parent);
1202 auto id = retrieve<dcon::cb_type_id>(
state,
parent);
1204 auto content = retrieve<get_target>(
state,
parent).n;
1205 auto dest = retrieve<get_offer_to>(
state,
parent).n;
1206 auto staat = retrieve<dcon::state_definition_id>(
state,
parent);
1207 auto nacion = retrieve<dcon::national_identity_id>(
state,
parent);
1232 auto wg_ready = retrieve<check_wg_completion>(
state,
parent).done;
1237 auto ni = retrieve<dcon::national_identity_id>(
state,
parent);
1238 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));
1242 auto ni = retrieve<dcon::national_identity_id>(
state,
parent);
1243 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));
1252 auto wg_ready = retrieve<check_wg_completion>(
state,
parent).done;
1272 auto cb = retrieve<dcon::cb_type_id>(
state,
parent);
1273 auto target = retrieve<get_target>(
state,
parent).n;
1274 auto offered = retrieve<get_offer_to>(
state,
parent).n;
1277 state.defines.crisis_wargoal_infamy_mult;
1293 if(
name ==
"wargoal_gain_effect_text") {
1294 return make_element_by_type<wargoal_add_header>(
state,
id);
1295 }
else if(
name ==
"prestige_icon") {
1296 return make_element_by_type<image_element_base>(
state,
id);
1297 }
else if(
name ==
"prestige") {
1298 return make_element_by_type<fixed_zero>(
state,
id);
1299 }
else if(
name ==
"infamy_icon") {
1300 return make_element_by_type<image_element_base>(
state,
id);
1301 }
else if(
name ==
"infamy") {
1302 return make_element_by_type<wargoal_offer_add_infamy>(
state,
id);
1303 }
else if(
name ==
"militancy_icon") {
1304 return make_element_by_type<image_element_base>(
state,
id);
1305 }
else if(
name ==
"militancy") {
1306 return make_element_by_type<fixed_zero>(
state,
id);
1316 return "wargoal_item";
1323 auto selected_cb = retrieve<dcon::cb_type_id>(
state,
parent);
1330 dcon::nation_id actor = retrieve<get_offer_to>(
state,
parent).n;
1331 dcon::nation_id content = retrieve<get_target>(
state,
parent).n;
1333 for(
auto cb_type :
state.world.in_cb_type) {
1350 if(
name ==
"country_list") {
1351 return make_element_by_type<wargoal_offer_type_listbox>(
state,
id);
1352 }
else if(
name ==
"cancel_select") {
1353 return make_element_by_type<wargoal_cancel_button>(
state,
id);
1364 auto n = retrieve<dcon::nation_id>(
state,
parent);
1369 auto n = retrieve<dcon::nation_id>(
state,
parent);
1376 dcon::cb_type_id cb = retrieve<dcon::cb_type_id>(
state,
parent);
1377 if(
auto allowed_countries =
state.world.cb_type_get_allowed_countries(cb); allowed_countries) {
1378 dcon::nation_id target = retrieve<dcon::nation_id>(
state,
parent);
1379 auto holder =
state.world.national_identity_get_nation_from_identity_holder(retrieve<dcon::national_identity_id>(
state,
parent));
1388 if(
name ==
"select_country") {
1389 return make_element_by_type<wargoal_target_country_item_button>(
state,
id);
1399 return "wargoal_country_item";
1405 for(
auto& par :
state.crisis_participants) {
1409 if(!par.merely_interested) {
1410 if(
state.local_player_nation ==
state.primary_crisis_attacker && !par.supports_attacker)
1412 else if(
state.local_player_nation ==
state.primary_crisis_defender && par.supports_attacker)
1424 if(
name ==
"wargoal_list") {
1425 return make_element_by_type<wargoal_target_country_listbox>(
state,
id);
1435 return "wargoal_country_item";
1442 dcon::nation_id target = retrieve<get_target>(
state,
parent).n;
1443 auto actor = retrieve<get_offer_to>(
state,
parent).n;
1444 dcon::cb_type_id cb = retrieve<dcon::cb_type_id>(
state,
parent);
1446 dcon::trigger_key allowed_countries =
state.world.cb_type_get_allowed_countries(cb);
1447 if(!allowed_countries) {
1452 for(
auto n :
state.world.in_nation) {
1454 row_contents.push_back(
state.world.nation_get_identity_from_identity_holder(n));
1464 if(
name ==
"country_list") {
1465 return make_element_by_type<wargoal_offer_country_listbox>(
state,
id);
1466 }
else if(
name ==
"cancel_select") {
1467 return make_element_by_type<wargoal_cancel_country_select>(
state,
id);
1480 dcon::nation_id offer_made_to;
1481 dcon::nation_id wargoal_against;
1482 dcon::cb_type_id cb_to_use;
1483 dcon::state_definition_id target_state;
1484 dcon::national_identity_id target_country;
1485 bool will_call_allies =
false;
1486 bool wargoal_decided_upon =
false;
1492 dcon::nation_id target = wargoal_against;
1493 auto actor =
state.local_player_nation;
1494 dcon::cb_type_id cb = cb_to_use;
1495 auto secondary_tag = target_country;
1496 auto allowed_substate_regions =
state.world.cb_type_get_allowed_substate_regions(cb);
1497 if(allowed_substate_regions) {
1498 for(
auto v :
state.world.nation_get_overlord_as_ruler(target)) {
1499 if(v.get_subject().get_is_substate()) {
1500 for(
auto si :
state.world.nation_get_state_ownership(target)) {
1508 auto allowed_states =
state.world.cb_type_get_allowed_states(cb);
1509 if(
auto allowed_countries =
state.world.cb_type_get_allowed_countries(cb); allowed_countries) {
1510 auto in_nation =
state.world.national_identity_get_nation_from_identity_holder(secondary_tag);
1511 for(
auto si :
state.world.nation_get_state_ownership(target)) {
1517 for(
auto si :
state.world.nation_get_state_ownership(target)) {
1525 target_state = sdef;
1526 wargoal_decided_upon =
true;
1532 target_state = dcon::state_definition_id{};
1538 cb_to_use = dcon::cb_type_id{};
1539 wargoal_decided_upon =
false;
1546 state.start_state_selection(seldata);
1550 wargoal_against = dcon::nation_id{};
1551 offer_made_to = offer_to;
1552 cb_to_use = dcon::cb_type_id{};
1553 target_state = dcon::state_definition_id{};
1554 target_country = dcon::national_identity_id{};
1555 will_call_allies =
false;
1556 wargoal_decided_upon =
false;
1565 if(
name ==
"background") {
1566 auto ptr = make_element_by_type<draggable_target>(
state,
id);
1569 }
else if(
name ==
"leftshield") {
1570 return make_element_by_type<nation_player_flag>(
state,
id);
1571 }
else if(
name ==
"rightshield") {
1572 return make_element_by_type<flag_button>(
state,
id);
1573 }
else if(
name ==
"title") {
1574 return make_element_by_type<wargoal_offer_title>(
state,
id);
1575 }
else if(
name ==
"description") {
1576 return make_element_by_type<wargoal_offer_description1>(
state,
id);
1577 }
else if(
name ==
"wargoal_add_effect") {
1578 return make_element_by_type<wargoal_offer_add_window>(
state,
id);
1579 }
else if(
name ==
"wargoal_success_effect" ||
name ==
"wargoal_failure_effect") {
1580 return make_element_by_type<invisible_element>(
state,
id);
1581 }
else if(
name ==
"description2") {
1582 return make_element_by_type<wargoal_offer_description2>(
state,
id);
1583 }
else if(
name ==
"acceptance") {
1584 return make_element_by_type<simple_text_element_base>(
state,
id);
1585 }
else if(
name ==
"call_allies_checkbox") {
1586 return make_element_by_type<invisible_element>(
state,
id);
1587 }
else if(
name ==
"call_allies_text") {
1588 return make_element_by_type<invisible_element>(
state,
id);
1589 }
else if(
name ==
"agreebutton") {
1590 return make_element_by_type<wargoal_offer_agree_button>(
state,
id);
1591 }
else if(
name ==
"declinebutton") {
1592 return make_element_by_type<cancel_pick_wg_button>(
state,
id);
1593 }
else if(
name ==
"wargoal_setup") {
1594 auto ptr = make_element_by_type<wargoal_target_country_select_window>(
state,
id);
1595 wargoal_target_win = ptr.
get();
1596 ptr->set_visible(
state,
true);
1598 }
else if(
name ==
"wargoal_state_select") {
1599 return make_element_by_type<invisible_element>(
state,
id);
1600 }
else if(
name ==
"wargoal_country_select") {
1602 auto ptr = make_element_by_type<wargoal_offer_setup_window>(
state,
id);
1603 wargoal_setup_win = ptr.
get();
1604 ptr->set_visible(
state,
false);
1608 auto ptr = make_element_by_type<wargoal_offer_country_select_window>(
state,
id);
1609 wargoal_country_win = ptr.
get();
1610 ptr->set_visible(
state,
false);
1619 if(payload.holds_type<dcon::nation_id>()) {
1620 payload.emplace<dcon::nation_id>(offer_made_to);
1621 }
else if(payload.holds_type<
get_target>()) {
1629 cb_to_use = any_cast<element_selection_wrapper<dcon::cb_type_id>>(payload).data;
1631 wargoal_against = dcon::nation_id{};
1632 cb_to_use = dcon::cb_type_id{};
1633 target_state = dcon::state_definition_id{};
1634 target_country = dcon::national_identity_id{};
1635 wargoal_decided_upon =
false;
1653 wargoal_decided_upon =
true;
1662 target_country = any_cast<element_selection_wrapper<dcon::national_identity_id>>(payload).data;
1664 if(target_country) {
1676 wargoal_decided_upon =
true;
1679 wargoal_decided_upon =
false;
1680 cb_to_use = dcon::cb_type_id{};
1689 }
else if(payload.holds_type<
set_target>()) {
1690 wargoal_against = any_cast<set_target>(payload).n;
1691 if(wargoal_against) {
1692 wargoal_decided_upon =
false;
1693 cb_to_use = dcon::cb_type_id{};
1700 }
else if(payload.holds_type<dcon::cb_type_id>()) {
1701 payload.emplace<dcon::cb_type_id>(cb_to_use);
1703 }
else if(payload.holds_type<dcon::state_definition_id>()) {
1704 payload.emplace<dcon::state_definition_id>(target_state);
1706 }
else if(payload.holds_type<dcon::national_identity_id>()) {
1707 payload.emplace<dcon::national_identity_id>(target_country);
1709 }
else if(payload.holds_type<
bool>()) {
1710 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)
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 truce_break_cb_infamy(sys::state &state, dcon::cb_type_id t)
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)
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 cb_infamy(sys::state const &state, dcon::cb_type_id t)
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)
float crisis_cb_addition_infamy_cost(sys::state &state, dcon::cb_type_id type, dcon::nation_id from, dcon::nation_id target)
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)
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)
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)
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)
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