10static std::vector<base_event_window*> pending_closure;
13 dcon::nation_id target_nation{};
14 dcon::nation_id from_nation{};
15 dcon::province_id target_province{};
16 dcon::province_id from_province{};
17 dcon::state_instance_id target_state{};
18 dcon::state_instance_id from_state{};
19 dcon::province_id target_capital{};
20 dcon::province_id from_capital{};
21 int32_t target_pop = 0;
24 int32_t from_slot = -1;
27 int32_t primary_slot = -1;
30 if(std::holds_alternative<event::pending_human_n_event>(phe)) {
31 auto const& e = std::get<event::pending_human_n_event>(phe);
34 target_capital =
state.world.nation_get_capital(target_nation);
35 target_province = target_capital;
37 target_state =
state.world.province_get_state_membership(target_province);
41 from_slot = e.from_slot;
43 primary_slot = e.primary_slot;
46 }
else if(std::holds_alternative<event::pending_human_f_n_event>(phe)) {
47 auto const& e = std::get<event::pending_human_f_n_event>(phe);
50 target_capital =
state.world.nation_get_capital(target_nation);
51 target_province = target_capital;
52 target_state =
state.world.province_get_state_membership(target_province);
55 }
else if(std::holds_alternative<event::pending_human_p_event>(phe)) {
56 auto const& e = std::get<event::pending_human_p_event>(phe);
57 target_nation =
state.world.province_get_nation_from_province_ownership(e.p);
58 target_state =
state.world.province_get_state_membership(e.p);
59 target_capital =
state.world.state_instance_get_capital(target_state);
60 target_province = e.p;
63 from_slot = e.from_slot;
66 }
else if(std::holds_alternative<event::pending_human_f_p_event>(phe)) {
67 auto const& e = std::get<event::pending_human_f_p_event>(phe);
68 target_nation =
state.world.province_get_nation_from_province_ownership(e.p);
69 target_state =
state.world.province_get_state_membership(e.p);
70 target_capital =
state.world.state_instance_get_capital(target_state);
71 target_province = e.p;
79 from_capital =
state.world.nation_get_capital(from_nation);
83 from_province =
state.world.state_instance_get_capital(from_state);
87 from_state =
state.world.province_get_state_membership(from_province);
90 from_province =
state.world.nation_get_capital(from_nation);
91 from_state =
state.world.province_get_state_membership(from_province);
97 from_nation =
state.world.state_instance_get_nation_from_state_ownership(from_state);
98 from_capital =
state.world.state_instance_get_capital(from_state);
104 from_province =
state.world.state_instance_get_capital(from_state);
110 from_capital = from_province;
111 from_state =
state.world.province_get_state_membership(from_province);
112 from_nation =
state.world.province_get_nation_from_province_ownership(from_province);
135 auto pc =
state.world.nation_get_primary_culture(target_nation);
140 auto sm =
state.world.nation_get_in_sphere_of(target_nation);
143 auto smpc =
state.world.nation_get_primary_culture(sm);
153 auto first_wg =
state.crisis_attacker_wargoals.at(0);
194 auto first_names =
state.world.culture_get_first_names(
state.world.nation_get_primary_culture(target_nation));
195 if(first_names.size() > 0) {
196 auto first_name = first_names.at(
rng::reduce(
uint32_t(names_pair.high), first_names.size()));
197 auto last_names =
state.world.culture_get_last_names(
state.world.nation_get_primary_culture(target_nation));
198 if(last_names.size() > 0) {
205 if(
auto fl =
state.world.province_get_factory_location_as_province(target_province); fl.begin() != fl.end()) {
218 if(
auto plist =
state.world.nation_get_province_ownership(target_nation); plist.begin() != plist.end()) {
219 auto plist_size =
uint32_t(plist.end() - plist.begin());
227 auto index = retrieve<int32_t>(
state, parent);
231 if(std::holds_alternative<event::pending_human_n_event>(content)) {
232 auto const& phe = std::get<event::pending_human_n_event>(content);
233 opt =
state.world.national_event_get_options(std::get<event::pending_human_n_event>(content).e)[index];
235 }
else if(std::holds_alternative<event::pending_human_f_n_event>(content)) {
236 auto const& phe = std::get<event::pending_human_f_n_event>(content);
237 opt =
state.world.free_national_event_get_options(std::get<event::pending_human_f_n_event>(content).e)[index];
239 }
else if(std::holds_alternative<event::pending_human_p_event>(content)) {
240 auto const& phe = std::get<event::pending_human_p_event>(content);
241 opt =
state.world.provincial_event_get_options(std::get<event::pending_human_p_event>(content).e)[index];
243 }
else if(std::holds_alternative<event::pending_human_f_p_event>(content)) {
244 auto const& phe = std::get<event::pending_human_f_p_event>(content);
245 opt =
state.world.free_provincial_event_get_options(std::get<event::pending_human_f_p_event>(content).e)[index];
254 auto index = retrieve<int32_t>(
state, parent);
256 if(std::holds_alternative<event::pending_human_n_event>(content)) {
257 auto const& phe = std::get<event::pending_human_n_event>(content);
258 state.world.national_event_set_auto_choice(phe.e,
uint8_t(index + 1));
260 }
else if(std::holds_alternative<event::pending_human_f_n_event>(content)) {
261 auto const& phe = std::get<event::pending_human_f_n_event>(content);
262 state.world.free_national_event_set_auto_choice(phe.e,
uint8_t(index + 1));
264 }
else if(std::holds_alternative<event::pending_human_p_event>(content)) {
265 auto const& phe = std::get<event::pending_human_p_event>(content);
266 state.world.provincial_event_set_auto_choice(phe.e,
uint8_t(index + 1));
268 }
else if(std::holds_alternative<event::pending_human_f_p_event>(content)) {
269 auto const& phe = std::get<event::pending_human_f_p_event>(content);
270 state.world.free_provincial_event_set_auto_choice(phe.e,
uint8_t(index + 1));
278 auto index = retrieve<int32_t>(
state, parent);
280 if(std::holds_alternative<event::pending_human_n_event>(content)) {
281 auto const& phe = std::get<event::pending_human_n_event>(content);
287 }
else if(std::holds_alternative<event::pending_human_f_n_event>(content)) {
288 auto const& phe = std::get<event::pending_human_f_n_event>(content);
294 }
else if(std::holds_alternative<event::pending_human_p_event>(content)) {
295 auto const& phe = std::get<event::pending_human_p_event>(content);
301 }
else if(std::holds_alternative<event::pending_human_f_p_event>(content)) {
302 auto const& phe = std::get<event::pending_human_f_p_event>(content);
313 auto index = retrieve<int32_t>(
state, parent);
314 if(std::holds_alternative<event::pending_human_n_event>(content)) {
315 auto phe = std::get<event::pending_human_n_event>(content);
317 }
else if(std::holds_alternative<event::pending_human_f_n_event>(content)) {
318 auto phe = std::get<event::pending_human_f_n_event>(content);
320 }
else if(std::holds_alternative<event::pending_human_p_event>(content)) {
321 auto phe = std::get<event::pending_human_p_event>(content);
323 }
else if(std::holds_alternative<event::pending_human_f_p_event>(content)) {
324 auto phe = std::get<event::pending_human_f_p_event>(content);
332 if(std::holds_alternative<event::pending_human_n_event>(content))
333 base_data.data.image.gfx_object =
state.world.national_event_get_image(std::get<event::pending_human_n_event>(content).e);
334 else if(std::holds_alternative<event::pending_human_f_n_event>(content))
335 base_data.data.image.gfx_object =
state.world.free_national_event_get_image(std::get<event::pending_human_f_n_event>(content).e);
339 base_data.size.y = 200;
340 base_data.size.x -= 11;
350 delegate->base_data.data.text.font_handle, 0, text::alignment::left, delegate->black_text ? text::text_color::black : text::text_color::white, false});
353 dcon::text_key description{};
354 if(std::holds_alternative<event::pending_human_n_event>(content)) {
355 auto phe = std::get<event::pending_human_n_event>(content);
356 description =
state.world.national_event_get_description(phe.e);
358 }
else if(std::holds_alternative<event::pending_human_f_n_event>(content)) {
359 auto phe = std::get<event::pending_human_f_n_event>(content);
360 description =
state.world.free_national_event_get_description(phe.e);
362 }
else if(std::holds_alternative<event::pending_human_p_event>(content)) {
363 auto phe = std::get<event::pending_human_p_event>(content);
364 description =
state.world.provincial_event_get_description(phe.e);
366 }
else if(std::holds_alternative<event::pending_human_f_p_event>(content)) {
367 auto phe = std::get<event::pending_human_f_p_event>(content);
368 description =
state.world.free_provincial_event_get_description(phe.e);
376 if(std::holds_alternative<event::pending_human_n_event>(content)) {
377 auto phe = std::get<event::pending_human_n_event>(content);
378 auto imm =
state.world.national_event_get_immediate_effect(phe.e);
381 for(
auto& l : delegate->internal_layout.contents) {
386 }
else if(std::holds_alternative<event::pending_human_f_n_event>(content)) {
387 auto phe = std::get<event::pending_human_f_n_event>(content);
388 auto imm =
state.world.free_national_event_get_immediate_effect(phe.e);
391 for(
auto& l : delegate->internal_layout.contents) {
396 }
else if(std::holds_alternative<event::pending_human_p_event>(content)) {
397 auto phe = std::get<event::pending_human_p_event>(content);
398 auto imm =
state.world.provincial_event_get_immediate_effect(phe.e);
401 for(
auto& l : delegate->internal_layout.contents) {
406 }
else if(std::holds_alternative<event::pending_human_f_p_event>(content)) {
407 auto phe = std::get<event::pending_human_f_p_event>(content);
408 auto imm =
state.world.free_provincial_event_get_immediate_effect(phe.e);
411 for(
auto& l : delegate->internal_layout.contents) {
418 calibrate_scrollbar(
state);
430 dcon::text_key
name{};
431 if(std::holds_alternative<event::pending_human_n_event>(content)) {
432 auto phe = std::get<event::pending_human_n_event>(content);
433 name =
state.world.national_event_get_name(phe.e);
435 }
else if(std::holds_alternative<event::pending_human_f_n_event>(content)) {
436 auto phe = std::get<event::pending_human_f_n_event>(content);
437 name =
state.world.free_national_event_get_name(phe.e);
439 }
else if(std::holds_alternative<event::pending_human_p_event>(content)) {
440 auto phe = std::get<event::pending_human_p_event>(content);
441 name =
state.world.provincial_event_get_name(phe.e);
443 }
else if(std::holds_alternative<event::pending_human_f_p_event>(content)) {
444 auto phe = std::get<event::pending_human_f_p_event>(content);
445 name =
state.world.free_provincial_event_get_name(phe.e);
460 if(
state.cheat_data.show_province_id_tooltip) {
462 if(std::holds_alternative<event::pending_human_p_event>(content)) {
463 auto phe = std::get<event::pending_human_p_event>(content);
467 }
else if(std::holds_alternative<event::pending_human_n_event>(content)) {
468 auto phe = std::get<event::pending_human_n_event>(content);
472 }
else if(std::holds_alternative<event::pending_human_f_p_event>(content)) {
473 auto phe = std::get<event::pending_human_f_p_event>(content);
477 }
else if(std::holds_alternative<event::pending_human_f_n_event>(content)) {
478 auto phe = std::get<event::pending_human_f_n_event>(content);
490 if(std::holds_alternative<event::pending_human_p_event>(content) || std::holds_alternative<event::pending_human_n_event>(content)) {
494 }
else if(std::holds_alternative<event::pending_human_f_p_event>(content)) {
495 auto phe = std::get<event::pending_human_f_p_event>(content);
498 }
else if(std::holds_alternative<event::pending_human_f_n_event>(content)) {
499 auto phe = std::get<event::pending_human_f_n_event>(content);
512 if(std::holds_alternative<event::pending_human_p_event>(content) || std::holds_alternative<event::pending_human_n_event>(content)) {
516 }
else if(std::holds_alternative<event::pending_human_f_p_event>(content)) {
517 auto phe = std::get<event::pending_human_f_p_event>(content);
518 auto mod =
state.world.free_provincial_event_get_mtth(phe.e);
523 }
else if(std::holds_alternative<event::pending_human_f_n_event>(content)) {
524 auto phe = std::get<event::pending_human_f_n_event>(content);
525 auto mod =
state.world.free_national_event_get_mtth(phe.e);
534 auto iid = retrieve<dcon::issue_id>(
state, parent);
540 if(std::holds_alternative<event::pending_human_n_event>(content)) {
541 auto n =
dcon::fatten(
state.world, std::get<event::pending_human_n_event>(content).n);
543 }
else if(std::holds_alternative<event::pending_human_f_n_event>(content)) {
544 auto n =
dcon::fatten(
state.world, std::get<event::pending_human_f_n_event>(content).n);
546 }
else if(std::holds_alternative<event::pending_human_p_event>(content)) {
547 auto p =
dcon::fatten(
state.world, std::get<event::pending_human_p_event>(content).p);
548 auto n = p.get_nation_from_province_ownership();
550 }
else if(std::holds_alternative<event::pending_human_f_p_event>(content)) {
551 auto p =
dcon::fatten(
state.world, std::get<event::pending_human_f_p_event>(content).p);
552 auto n = p.get_nation_from_province_ownership();
559 if(std::holds_alternative<event::pending_human_n_event>(content)) {
560 auto n =
dcon::fatten(
state.world, std::get<event::pending_human_n_event>(content).n);
562 }
else if(std::holds_alternative<event::pending_human_f_n_event>(content)) {
563 auto n =
dcon::fatten(
state.world, std::get<event::pending_human_f_n_event>(content).n);
565 }
else if(std::holds_alternative<event::pending_human_p_event>(content)) {
566 auto p =
dcon::fatten(
state.world, std::get<event::pending_human_p_event>(content).p);
567 auto n = p.get_nation_from_province_ownership();
569 }
else if(std::holds_alternative<event::pending_human_f_p_event>(content)) {
570 auto p =
dcon::fatten(
state.world, std::get<event::pending_human_f_p_event>(content).p);
571 auto n = p.get_nation_from_province_ownership();
577 row_contents.clear();
579 if(std::holds_alternative<event::pending_human_n_event>(content)) {
580 auto e = std::get<event::pending_human_n_event>(content).e;
584 row_contents.push_back(i);
586 }
else if(std::holds_alternative<event::pending_human_f_n_event>(content)) {
587 auto e = std::get<event::pending_human_f_n_event>(content).e;
591 row_contents.push_back(i);
593 }
else if(std::holds_alternative<event::pending_human_p_event>(content)) {
594 auto e = std::get<event::pending_human_p_event>(content).e;
598 row_contents.push_back(i);
600 }
else if(std::holds_alternative<event::pending_human_f_p_event>(content)) {
601 auto e = std::get<event::pending_human_f_p_event>(content).e;
605 row_contents.push_back(i);
614 move_child_to_front(
image);
619 auto ptr = make_element_by_type<event_requirements_icon>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"alice_event_requirements"))->second.definition);
620 ptr->base_data.position.y = int16_t(355);
621 ptr->base_data.position.x += int16_t(ptr->base_data.size.x + 140);
622 add_child_to_front(std::move(ptr));
625 auto ptr = make_element_by_type<event_odds_icon>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"alice_event_odds"))->second.definition);
626 ptr->base_data.position.y = int16_t(355);
627 ptr->base_data.position.x += int16_t(ptr->base_data.size.x * 2 + 140);
628 add_child_to_front(std::move(ptr));
633 auto ptr = make_element_by_type<provincial_event_listbox>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"alice_povince_event_opts_list"))->second.definition);
634 ptr->base_data.position = cur_offset;
635 ptr->base_data.position.
y -= 150;
636 add_child_to_front(std::move(ptr));
640 auto ptr = make_element_by_type<event_requirements_icon>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"alice_event_requirements"))->second.definition);
641 ptr->base_data.position.y = 20;
642 ptr->base_data.position.x += ptr->base_data.size.x;
643 add_child_to_front(std::move(ptr));
646 auto ptr = make_element_by_type<event_odds_icon>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"alice_event_odds"))->second.definition);
647 ptr->base_data.position.y = 20;
648 ptr->base_data.position.x += ptr->base_data.size.x * 2;
649 add_child_to_front(std::move(ptr));
653 auto ptr = make_element_by_type<national_election_event_listbox>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"alice_election_event_opts_list"))->second.definition);
654 ptr->base_data.position = cur_offset;
655 ptr->base_data.position.
y += 5;
656 add_child_to_front(std::move(ptr));
658 auto ptr = make_element_by_type<national_event_listbox>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"alice_nation_event_opts_list"))->second.definition);
659 ptr->base_data.position = cur_offset;
660 ptr->base_data.position.
y += 5;
661 add_child_to_front(std::move(ptr));
670 if(std::holds_alternative<event::pending_human_n_event>(content)) {
672 }
else if(std::holds_alternative<event::pending_human_f_n_event>(content)) {
674 }
else if(std::holds_alternative<event::pending_human_p_event>(content)) {
676 }
else if(std::holds_alternative<event::pending_human_f_p_event>(content)) {
685 dcon::gfx_object_id gid;
692 auto& gfx_def =
state.ui_defs.gfx[gid];
694 auto& mask_tex =
state.open_gl.asset_textures[dcon::texture_id(gfx_def.type_dependent - 1)];
697 gfx_def.is_vertically_flipped(),
698 state.world.locale_get_native_rtl(
state.font_collection.get_current_locale()));
710 return state.world.nation_get_identity_from_identity_holder(n);
720 dcon::gfx_object_id gid;
727 auto& gfx_def =
state.ui_defs.gfx[gid];
729 auto& mask_tex =
state.open_gl.asset_textures[dcon::texture_id(gfx_def.type_dependent - 1)];
748 return state.world.nation_get_identity_from_identity_holder(n);
760 if(std::holds_alternative<event::pending_human_p_event>(content)) {
762 }
else if(std::holds_alternative<event::pending_human_f_p_event>(content)) {
769 dcon::province_id prov{};
770 if(std::holds_alternative<event::pending_human_p_event>(content)) {
771 prov = std::get<event::pending_human_p_event>(content).p;
772 }
else if(std::holds_alternative<event::pending_human_f_p_event>(content)) {
773 prov = std::get<event::pending_human_f_p_event>(content).p;
775 if(!prov || prov.value >=
state.province_definitions.first_sea_province.value)
779 state.map_state.set_selected_province(prov);
783 state.map_state.center_map_on_province(
state, prov);
797 if(
name ==
"issue_name") {
798 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
801 }
else if(
name ==
"voters_perc") {
802 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
803 issvalue = ptr.
get();
823 return "ew_issue_option_window";
828 auto content = retrieve<dcon::issue_id>(
state,
parent);
829 state.world.for_each_issue_option([&](dcon::issue_option_id
id) {
831 row_contents.push_back(id);
842 if(
name ==
"legend_color") {
843 return make_element_by_type<ideology_plupp>(
state,
id);
844 }
else if(
name ==
"legend_title") {
845 return make_element_by_type<generic_name_text<dcon::political_party_id>>(
state, id);
846 }
else if(
name ==
"legend_desc") {
847 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
848 ptr->base_data.position.x += 4;
849 partyvalue = ptr.
get();
851 }
else if(
name ==
"legend_value") {
852 return make_element_by_type<invisible_element>(
state,
id);
859 auto issid = retrieve<dcon::issue_id>(
state,
parent);
864 if(payload.holds_type<dcon::ideology_id>()) {
865 payload.emplace<dcon::ideology_id>(
state.world.political_party_get_ideology(
content));
891 if(
name ==
"legend_color") {
892 return make_element_by_type<ideology_plupp>(
state,
id);
893 }
else if(
name ==
"legend_title") {
894 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
897 }
else if(
name ==
"legend_desc") {
898 return make_element_by_type<simple_text_element_base>(
state,
id);
899 }
else if(
name ==
"legend_value") {
900 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
901 ptr->base_data.position.x += 3;
918 if(payload.holds_type<dcon::ideology_id>()) {
919 payload.emplace<dcon::ideology_id>(
state.world.political_party_get_ideology(
content));
957 std::vector<dcon::political_party_id> parties;
959 for(
auto ppid :
state.world.in_political_party) {
962 for(
auto ppid : parties) {
964 distribution[ppid.index()].value +=
state.world.nation_get_demographics(n, dkey) / total;
979 if(
name ==
"issue_name") {
980 return make_element_by_type<generic_name_text<dcon::issue_option_id>>(
state, id);
981 }
else if(
name ==
"people_perc") {
982 return make_element_by_type<issue_option_popular_support>(
state,
id);
983 }
else if(
name ==
"voters_perc") {
984 return make_element_by_type<issue_option_voter_support>(
state,
id);
991 row_contents.clear();
992 auto iid = retrieve<dcon::issue_id>(
state, parent);
993 for(
const auto ioid :
state.world.in_issue_option) {
994 if(ioid.get_parent_issue() == iid)
995 row_contents.push_back(ioid);
1001 if(
name ==
"background") {
1002 return make_element_by_type<draggable_target>(
state,
id);
1003 }
else if(
name ==
"title") {
1004 return make_element_by_type<event_name_text>(
state,
id);
1005 }
else if(
name ==
"description") {
1006 return make_element_by_type<event_desc_text>(
state,
id);
1007 }
else if(
name ==
"event_images") {
1008 auto ptr = make_element_by_type<event_image>(
state,
id);
1011 }
else if(
name ==
"event_separator_image") {
1012 auto ptr = make_element_by_type<image_element_base>(
state,
id);
1014 ptr->base_data.position.y = cur_offset.
y;
1015 ptr->base_data.position.y -= 150;
1017 }
else if(
name ==
"date") {
1018 return make_element_by_type<event_date_text>(
state,
id);
1019 }
else if(
name ==
"state_name") {
1020 return make_element_by_type<event_state_name_text>(
state,
id);
1021 }
else if(
name ==
"subtitle") {
1022 return make_element_by_type<event_subtitle_text>(
state,
id);
1023 }
else if(
name ==
"population_amount") {
1024 return make_element_by_type<event_population_amount_text>(
state,
id);
1025 }
else if(
name ==
"country_flag1") {
1026 return make_element_by_type<major_event_left_flag>(
state,
id);
1027 }
else if(
name ==
"country_flag2") {
1028 return make_element_by_type<major_event_right_flag>(
state,
id);
1029 }
else if(
name ==
"province") {
1030 return make_element_by_type<event_province_text>(
state,
id);
1031 }
else if(
name ==
"perc_of_parlament") {
1032 return make_element_by_type<nation_ruling_party_ideology_text>(
state,
id);
1033 }
else if(
name ==
"parties_listbox") {
1034 return make_element_by_type<election_parties_listbox>(
state,
id);
1035 }
else if(
name ==
"chart_ideology") {
1036 return make_element_by_type<election_voter_ideology_piechart>(
state,
id);
1037 }
else if(
name ==
"chart_popularity") {
1038 return make_element_by_type<election_party_popularity_piechart>(
state,
id);
1039 }
else if(
name ==
"popularity_listbox") {
1040 return make_element_by_type<election_popularity_listbox>(
state,
id);
1041 }
else if(
name ==
"sort_by_issue_name") {
1042 auto ptr = make_element_by_type<politics_issue_sort_button>(
state,
id);
1045 }
else if(
name ==
"sort_by_people") {
1046 auto ptr = make_element_by_type<politics_issue_sort_button>(
state,
id);
1049 }
else if(
name ==
"sort_by_voters") {
1050 auto ptr = make_element_by_type<politics_issue_sort_button>(
state,
id);
1053 }
else if(
name ==
"issues_listbox") {
1054 auto ptr = make_element_by_type<elections_issue_option_listbox>(
state,
id);
1055 issues_listbox = ptr.get();
1062 if(payload.holds_type<dcon::nation_id>()) {
1063 payload.emplace<dcon::nation_id>(
state.local_player_nation);
1065 }
else if(payload.holds_type<dcon::issue_id>()) {
1066 if(std::holds_alternative<event::pending_human_n_event>(event_data)) {
1067 auto e = std::get<event::pending_human_n_event>(event_data).e;
1069 payload.emplace<dcon::issue_id>(iid);
1073 if(std::holds_alternative<event::pending_human_n_event>(event_data))
1074 payload.emplace<
event_data_wrapper>(std::get<event::pending_human_n_event>(event_data));
1075 else if(std::holds_alternative<event::pending_human_f_n_event>(event_data))
1076 payload.emplace<
event_data_wrapper>(std::get<event::pending_human_f_n_event>(event_data));
1077 else if(std::holds_alternative<event::pending_human_p_event>(event_data))
1078 payload.emplace<
event_data_wrapper>(std::get<event::pending_human_p_event>(event_data));
1079 else if(std::holds_alternative<event::pending_human_f_p_event>(event_data))
1080 payload.emplace<
event_data_wrapper>(std::get<event::pending_human_f_p_event>(event_data));
1083 set_visible(
state,
false);
1084 auto uptr =
state.ui_state.
root->remove_child(
this);
1086 auto slot =
uint8_t(get_pool_slot());
1087 std::unique_ptr<base_event_window> ptr(
static_cast<base_event_window*
>(uptr.release()));
1088 event_pool[slot].push_back(std::move(ptr));
1089 --pending_events[slot];
1093 auto enum_val = any_cast<politics_issue_sort_order>(payload);
1096 std::sort(issues_listbox->row_contents.begin(), issues_listbox->row_contents.end(),
1097 [&](dcon::issue_option_id a, dcon::issue_option_id b) {
1098 auto a_name = text::get_name_as_string(state, dcon::fatten(state.world, a));
1099 auto b_name = text::get_name_as_string(state, dcon::fatten(state.world, b));
1100 return a_name < b_name;
1102 issues_listbox->update(
state);
1105 std::sort(issues_listbox->row_contents.begin(), issues_listbox->row_contents.end(),
1106 [&](dcon::issue_option_id a, dcon::issue_option_id b) {
1107 auto a_support = politics::get_popular_support(state, state.local_player_nation, a);
1108 auto b_support = politics::get_popular_support(state, state.local_player_nation, b);
1109 return a_support > b_support;
1111 issues_listbox->update(
state);
1114 std::sort(issues_listbox->row_contents.begin(), issues_listbox->row_contents.end(),
1115 [&](dcon::issue_option_id a, dcon::issue_option_id b) {
1116 auto a_support = politics::get_voter_support(state, state.local_player_nation, a);
1117 auto b_support = politics::get_voter_support(state, state.local_player_nation, b);
1118 return a_support > b_support;
1120 issues_listbox->update(
state);
1129 if(std::holds_alternative<event::pending_human_n_event>(event_data)) {
1131 pending_closure.push_back(
this);
1133 }
else if(std::holds_alternative<event::pending_human_f_n_event>(event_data)) {
1135 pending_closure.push_back(
this);
1137 }
else if(std::holds_alternative<event::pending_human_p_event>(event_data)) {
1139 pending_closure.push_back(
this);
1141 }
else if(std::holds_alternative<event::pending_human_f_p_event>(event_data)) {
1143 pending_closure.push_back(
this);
1149 for(
auto e : pending_closure)
1151 pending_closure.clear();
1155 for(
auto const& slot_pool : ui::event_pool) {
1156 for(
auto const& win : slot_pool) {
1157 pending_closure.push_back(win.get());
1172 auto const slot =
uint8_t(e_slot);
1173 if(event_pool[slot].empty()) {
1174 auto new_elm = ui::make_element_by_type<T>(
state, T::window_element_name);
1175 auto ptr = new_elm.get();
1176 T* actual =
static_cast<T*
>(ptr);
1177 actual->event_data = dat;
1178 actual->impl_on_update(
state);
1179 state.ui_state.
root->add_child_to_front(std::move(new_elm));
1181 std::unique_ptr<base_event_window> ptr = std::move(event_pool[slot].back());
1182 event_pool[slot].pop_back();
1183 ptr->event_data = dat;
1184 if(!ptr->is_visible())
1185 ptr->base_data.position =
state.ui_defs.gui[
state.ui_state.
defs_by_name.find(
state.lookup_key(T::window_element_name))->second.definition].position;
1186 ptr->set_visible(
state,
true);
1187 state.ui_state.
root->add_child_to_front(std::move(ptr));
1193 if(std::holds_alternative<event::pending_human_n_event>(dat)) {
1195 auto e = std::get<event::pending_human_n_event>(dat).e;
1196 if(
state.world.national_event_get_is_major(e)) {
1201 }
else if(std::holds_alternative<event::pending_human_f_n_event>(dat)) {
1203 auto e = std::get<event::pending_human_f_n_event>(dat).e;
1204 if(
state.world.free_national_event_get_is_major(e)) {
1207 }
else if(std::holds_alternative<event::pending_human_p_event>(dat)) {
1209 }
else if(std::holds_alternative<event::pending_human_f_p_event>(dat)) {
1214 new_event_window_1<national_event_window>(
state, dat, slot);
1217 new_event_window_1<national_major_event_window>(
state, dat, slot);
1220 new_event_window_1<national_election_event_window>(
state, dat, slot);
1223 new_event_window_1<provincial_event_window>(
state, dat, slot);
1228 ++pending_events[
uint8_t(slot)];
dcon::text_key get_name() noexcept
year_month_day to_ymd(absolute_time_point base) const noexcept
constexpr date() noexcept=default
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
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
void on_create(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
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
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
simple_text_element_base * partyname
void on_update(sys::state &state) noexcept override
simple_text_element_base * partyvalue
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::string_view get_row_element_name() override
void on_create(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
void on_update(sys::state &state) noexcept override
std::string_view get_row_element_name() override
void on_update(sys::state &state) noexcept override
virtual message_result get(sys::state &state, Cyto::Any &payload) noexcept
virtual void on_create(sys::state &state) noexcept
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) 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
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
message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) 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 on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
std::vector< dcon::issue_option_id > row_contents
void update(sys::state &state)
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
dcon::issue_option_id content
dcon::national_identity_id get_current_nation(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void button_action(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
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
dcon::national_identity_id get_current_nation(sys::state &state) noexcept override
void update_chart(sys::state &state)
std::vector< entry > distribution
void on_create(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_create(sys::state &state) noexcept override
void make_event_choice(sys::state &state, event::pending_human_n_event const &e, uint8_t option_id)
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)
int32_t state_factory_count(sys::state &state, dcon::state_instance_id sid, dcon::nation_id n)
constexpr int32_t expiration_in_days
dcon::issue_id get_election_event_issue(sys::state &state, dcon::national_event_id e)
bool is_valid_option(sys::event_option const &opt)
constexpr float zoom_very_close
void get_active_political_parties(sys::state &state, dcon::nation_id n, std::vector< dcon::political_party_id > &parties)
void render_masked_rect(sys::state const &state, color_modification enabled, float x, float y, float width, float height, GLuint texture_handle, GLuint mask_texture_handle, ui::rotation r, bool flipped, bool rtl)
void render_textured_rect(sys::state const &state, color_modification enabled, float x, float y, float width, float height, GLuint texture_handle, ui::rotation r, bool flipped, bool rtl)
GLuint get_texture_handle(sys::state &state, dcon::texture_id id, bool keep_data)
random_pair get_random_pair(sys::state const &state, uint32_t value_in)
uint32_t reduce(uint32_t value_in, uint32_t upper_bound)
void play_interface_sound(sys::state &state, audio_instance &s, float volume)
audio_instance & get_click_sound(sys::state &state)
NLOHMANN_BASIC_JSON_TPL_DECLARATION void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL &j1, nlohmann::NLOHMANN_BASIC_JSON_TPL &j2) noexcept(//NOLINT(readability-inconsistent-declaration-parameter-name, cert-dcl58-cpp) is_nothrow_move_constructible< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value &&//NOLINT(misc-redundant-expression, cppcoreguidelines-noexcept-swap, performance-noexcept-swap) is_nothrow_move_assignable< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value)
exchanges the values of two JSON objects
constexpr int32_t max_event_options
@ crisisdefender_continent
@ crisisattacker_continent
void add_to_layout_box(sys::state &state, layout_base &dest, layout_box &box, embedded_flag ico)
std::string resolve_string_substitution(sys::state &state, dcon::text_key source_text, substitution_map const &mp)
layout_box open_layout_box(layout_base &dest, int32_t indent)
std::string date_to_string(sys::state &state, sys::date date)
void localised_format_box(sys::state &state, layout_base &dest, layout_box &box, std::string_view key, text::substitution_map const &sub)
std::string prettify(int64_t num)
endless_layout create_endless_layout(sys::state &state, layout &dest, layout_parameters const ¶ms)
dcon::text_key get_ruler_title(sys::state &state, dcon::nation_id n)
void add_line(sys::state &state, layout_base &dest, dcon::text_key txt, int32_t indent)
void add_to_substitution_map(substitution_map &mp, variable_type key, substitution value)
dcon::text_key get_adjective(sys::state &state, dcon::nation_id id)
uint16_t name_into_font_id(sys::state &state, std::string_view txt)
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)
std::string format_percentage(float num, size_t digits)
void add_space_to_layout_box(sys::state &state, layout_base &dest, layout_box &box)
void close_layout_box(columnar_layout &dest, layout_box &box)
int32_t to_generic(dcon::province_id v)
dcon::state_instance_id to_state(int32_t v)
dcon::province_id to_prov(int32_t v)
dcon::nation_id to_nation(int32_t v)
void multiplicative_value_modifier_description(sys::state &state, text::layout_base &layout, dcon::value_modifier_key modifier, int32_t primary, int32_t this_slot, int32_t from_slot)
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)
politics_issue_sort_order
void new_event_window_1(sys::state &state, event_data_wrapper &dat, event_pool_slot e_slot)
void send(sys::state &state, element_base *parent, T value)
void close_expired_event_windows(sys::state &state)
void populate_event_submap(sys::state &state, text::substitution_map &sub, std::variant< event::pending_human_n_event, event::pending_human_f_n_event, event::pending_human_p_event, event::pending_human_f_p_event > const &phe) noexcept
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)
void clear_event_windows(sys::state &state)
ogl::color_modification get_color_modification(bool is_under_mouse, bool is_disabled, bool is_interactable)
bool events_pause_test(sys::state &state)
std::variant< event::pending_human_n_event, event::pending_human_f_n_event, event::pending_human_p_event, event::pending_human_f_p_event > event_data_wrapper
void new_event_window(sys::state &state, event_data_wrapper dat)
Holds important data about the game world, state, and other data regarding windowing,...
element_type get_element_type() const
rotation get_rotation() const
union ui::element_data::internal_data data
dcon::gfx_object_id gfx_object
ankerl::unordered_dense::map< dcon::text_key, element_target, hash_text_key > defs_by_name
std::unique_ptr< element_base > root
element_base * province_window
element_base * under_mouse