36 if(!
state.selected_regiments[0] && !
state.selected_ships[0]) {
41 if constexpr(std::is_same_v<T, dcon::army_id>) {
42 std::array<dcon::regiment_id, command::num_packed_units> tosplit{};
43 for(
size_t i = 0; i <
state.selected_regiments.size(); i++) {
44 if(
state.selected_regiments[i]) {
58 }
else if constexpr(std::is_same_v<T, dcon::navy_id>) {
59 std::array<dcon::ship_id, command::num_packed_units> tosplit{};
60 for(
size_t i = 0; i <
state.selected_ships.size(); i++) {
61 if(
state.selected_ships[i]) {
86 if constexpr(std::is_same_v<T, dcon::army_id>) {
88 }
else if constexpr(std::is_same_v<T, dcon::navy_id>) {
103 if constexpr(std::is_same_v<T, dcon::army_id>) {
108 state.select(content);
113 if constexpr(std::is_same_v<T, dcon::army_id>) {
134 if constexpr(std::is_same_v<T, dcon::army_id>) {
144 if constexpr(std::is_same_v<T, dcon::army_id>) {
209 if constexpr(std::is_same_v<T, dcon::army_id>) {
211 set_text(
state, std::string(
state.to_string_view(fat.get_general_from_army_leadership().get_name())));
214 set_text(
state, std::string(
state.to_string_view(fat.get_admiral_from_navy_leadership().get_name())));
230 if constexpr(std::is_same_v<T, dcon::army_id>) {
231 lid =
state.world.army_get_general_from_army_leadership(unit);
233 lid =
state.world.navy_get_admiral_from_navy_leadership(unit);
243 if constexpr(std::is_same_v<T, dcon::army_id>) {
268 if constexpr(std::is_same_v<T, dcon::army_id>) {
269 lid =
state.world.army_get_general_from_army_leadership(unit);
272 lid =
state.world.navy_get_admiral_from_navy_leadership(unit);
276 auto pculture =
state.world.nation_get_primary_culture(
state.local_player_nation);
277 auto ltype = pculture.get_group_from_culture_group_membership().get_leader();
280 auto admiral =
state.world.leader_get_is_admiral(lid);
282 auto arange = ltype.get_admirals();
283 if(arange.size() > 0) {
292 auto grange = ltype.get_generals();
293 if(grange.size() > 0) {
317 if constexpr(std::is_same_v<T, dcon::army_id>) {
318 lid =
state.world.army_get_general_from_army_leadership(unit);
320 lid =
state.world.navy_get_admiral_from_navy_leadership(unit);
330 if constexpr(std::is_same_v<T, dcon::army_id>) {
343 if constexpr(std::is_same_v<T, dcon::army_id>) {
361 if constexpr(std::is_same_v<T, dcon::army_id>) {
363 state.map_state.center_map_on_province(
state, p);
366 state.map_state.center_map_on_province(
state, p);
377 float total_strength = 0.0f;
378 int32_t unit_count = 0;
379 if constexpr(std::is_same_v<T, dcon::army_id>) {
380 state.world.army_for_each_army_membership_as_army(content, [&](dcon::army_membership_id nmid) {
382 total_strength += regiment.get_strength();
386 state.world.navy_for_each_navy_membership_as_navy(content, [&](dcon::navy_membership_id nmid) {
388 total_strength += ship.get_strength();
392 total_strength /=
static_cast<float>(unit_count);
402 float total_strength = 0.0f;
403 int32_t unit_count = 0;
404 if constexpr(std::is_same_v<T, dcon::army_id>) {
405 state.world.army_for_each_army_membership_as_army(content, [&](dcon::army_membership_id nmid) {
407 total_strength += regiment.get_strength();
411 state.world.navy_for_each_navy_membership_as_navy(content, [&](dcon::navy_membership_id nmid) {
413 total_strength += ship.get_strength();
417 total_strength /=
static_cast<float>(unit_count);
432 float total_org = 0.0f;
433 int32_t unit_count = 0;
434 if constexpr(std::is_same_v<T, dcon::army_id>) {
435 state.world.army_for_each_army_membership_as_army(content, [&](dcon::army_membership_id nmid) {
437 total_org += regiment.get_org();
441 state.world.navy_for_each_navy_membership_as_navy(content, [&](dcon::navy_membership_id nmid) {
443 total_org += ship.get_org();
447 total_org /=
static_cast<float>(unit_count);
457 float total_org = 0.0f;
458 int32_t unit_count = 0;
459 if constexpr(std::is_same_v<T, dcon::army_id>) {
460 state.world.army_for_each_army_membership_as_army(content, [&](dcon::army_membership_id nmid) {
462 total_org += regiment.get_org();
466 state.world.navy_for_each_navy_membership_as_navy(content, [&](dcon::navy_membership_id nmid) {
468 total_org += ship.get_org();
472 total_org /=
static_cast<float>(unit_count);
479 if constexpr(std::is_same_v<T, dcon::army_id>) {
491 if constexpr(std::is_same_v<T, dcon::regiment_id>) {
492 auto regiment = retrieve<dcon::regiment_id>(
state,
parent);
493 frame = int(
state.world.regiment_get_experience(regiment) * 10);
495 auto ship = retrieve<dcon::ship_id>(
state,
parent);
496 frame = int(
state.world.ship_get_experience(ship) * 10);
501 if constexpr(std::is_same_v<T, dcon::regiment_id>) {
502 auto regiment = retrieve<dcon::regiment_id>(
state,
parent);
503 frame = int(
state.world.regiment_get_experience(regiment) * 10);
505 auto ship = retrieve<dcon::ship_id>(
state,
parent);
506 frame = int(
state.world.ship_get_experience(ship) * 10);
515 if constexpr(std::is_same_v<T, dcon::regiment_id>) {
516 auto regiment = retrieve<dcon::regiment_id>(
state,
parent);
517 auto exp =
state.world.regiment_get_experience(regiment);
524 auto ship = retrieve<dcon::ship_id>(
state,
parent);
525 auto exp =
state.world.ship_get_experience(ship);
540 int32_t total_strength = 0;
541 if constexpr(std::is_same_v<T, dcon::army_id>) {
542 state.world.army_for_each_army_membership_as_army(content, [&](dcon::army_membership_id nmid) {
544 total_strength += int32_t(regiment.get_strength() *
state.defines.pop_size_per_regiment);
547 state.world.navy_for_each_navy_membership_as_navy(content, [&](dcon::navy_membership_id nmid) {
591 if constexpr(std::is_same_v<T, dcon::army_id>) {
592 if(
state.world.army_get_controller_from_army_control(content) ==
state.local_player_nation) {
598 if(
state.world.navy_get_controller_from_navy_control(content) ==
state.local_player_nation) {
607 dcon::gfx_object_id gid;
614 auto const& gfx_def =
state.ui_defs.gfx[gid];
615 if(gfx_def.primary_texture_handle) {
616 if(gfx_def.number_of_frames > 1) {
622 state.world.locale_get_native_rtl(
state.font_collection.get_current_locale()));
628 state.world.locale_get_native_rtl(
state.font_collection.get_current_locale()));
637 dcon::gfx_object_id disband_gfx{};
645 if constexpr(std::is_same_v<T, dcon::army_id>) {
646 auto win2 = make_element_by_type<unit_reorg_window<T, dcon::regiment_id>>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"reorg_window"))->second.definition);
648 win2->set_visible(
state,
false);
652 auto win2 = make_element_by_type<unit_reorg_window<T, dcon::ship_id>>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"reorg_window"))->second.definition);
654 win2->set_visible(
state,
false);
660 if(disband_too_small_btn && disband_gfx) {
666 if(
name ==
"unitpanel_bg") {
667 return make_element_by_type<unit_panel_dynamic_tinted_bg<T>>(
state, id);
668 }
else if(
name ==
"leader_prestige_icon") {
669 return make_element_by_type<invisible_element>(
state,
id);
670 }
else if(
name ==
"leader_prestige_bar") {
671 return make_element_by_type<leader_prestige_progress_bar<T>>(
state, id);
672 }
else if(
name ==
"prestige_bar_frame") {
673 return make_element_by_type<image_element_base>(
state,
id);
674 }
else if(
name ==
"unitname") {
675 auto ptr = make_element_by_type<unit_selection_unit_name_text<T>>(
state, id);
676 ptr->base_data.position.x += 9;
677 ptr->base_data.position.y += 4;
679 }
else if(
name ==
"only_unit_from_selection_button") {
680 return make_element_by_type<invisible_element>(
state,
id);
681 }
else if(
name ==
"remove_unit_from_selection_button") {
682 return make_element_by_type<unit_selection_close_button>(
state,
id);
683 }
else if(
name ==
"newunitbutton") {
684 return make_element_by_type<unit_selection_new_unit_button<T>>(
state, id);
685 }
else if(
name ==
"splitinhalf") {
686 return make_element_by_type<unit_selection_split_in_half_button<T>>(
state, id);
687 }
else if(
name ==
"disbandbutton") {
688 auto ptr = make_element_by_type<unit_selection_disband_button<T>>(
state, id);
689 disband_gfx = ptr->base_data.data.button.button_image;
691 }
else if(
name ==
"disbandtoosmallbutton") {
692 if constexpr(std::is_same_v<T, dcon::army_id>) {
693 auto ptr = make_element_by_type<unit_selection_disband_too_small_button>(
state,
id);
694 disband_too_small_btn = ptr.
get();
697 return make_element_by_type<invisible_element>(
state,
id);
699 }
else if(
name ==
"str_bar") {
700 return make_element_by_type<unit_selection_str_bar<T>>(
state, id);
701 }
else if(
name ==
"org_bar") {
702 return make_element_by_type<unit_selection_org_bar<T>>(
state, id);
703 }
else if(
name ==
"unitattrition_icon") {
704 return make_element_by_type<unit_selection_attrition_icon<T>>(
state, id);
705 }
else if(
name ==
"unitattrition") {
706 return make_element_by_type<unit_selection_attrition_amount<T>>(
state, id);
707 }
else if(
name ==
"unitstrength") {
708 return make_element_by_type<unit_selection_total_str_text<T>>(
state, id);
709 }
else if(
name ==
"unitlocation") {
710 return make_element_by_type<unit_selection_unit_location_text<T>>(
state, id);
711 }
else if(
name ==
"unit_location_button") {
712 return make_element_by_type<unit_selection_unit_location_button<T>>(
state, id);
713 }
else if(
name ==
"unitleader") {
714 return make_element_by_type<unit_selection_leader_name<T>>(
state, id);
715 }
else if(
name ==
"leader_button") {
716 return make_element_by_type<unit_selection_change_leader_button<T>>(
state, id);
717 }
else if(
name ==
"unit_activity") {
718 return make_element_by_type<image_element_base>(
state,
id);
719 }
else if(
name ==
"leader_photo") {
720 return make_element_by_type<unit_selection_leader_image<T>>(
state, id);
721 }
else if(
name ==
"unit_upgrade_button") {
722 auto ptr = make_element_by_type<unit_selection_unit_upgrade_button>(
state,
id);
732 auto action = any_cast<element_selection_wrapper<unitpanel_action>>(payload).data;
761template<std::
size_t N>
768 if(
name ==
"unit_amount") {
769 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
770 unitamount_text = ptr.
get();
772 }
else if(
name ==
"unit_strength") {
773 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
774 unitstrength_text = ptr.
get();
776 }
else if(
name ==
"unit_icon") {
777 auto ptr = make_element_by_type<image_element_base>(
state,
id);
787 uint16_t totalunits = 0;
790 if(
state.selected_army_group) {
791 auto group = fatten(
state.world,
state.selected_army_group);
792 for(
auto regiment_membership : group.get_automated_army_group_membership_regiment()) {
793 auto fat = regiment_membership.get_regiment().get_regiment_from_automation();
794 auto strenght = fat.get_strength() *
state.defines.pop_size_per_regiment;
797 dcon::unit_type_id utid = fat.get_type();
799 if constexpr(N == 0) {
804 }
else if constexpr(N == 1) {
809 }
else if constexpr(N == 2) {
823template<std::
size_t N>
830 if(
name ==
"unit_amount") {
831 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
832 unitamount_text = ptr.
get();
834 }
else if(
name ==
"unit_strength") {
835 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
836 unitstrength_text = ptr.
get();
838 }
else if(
name ==
"unit_icon") {
839 auto ptr = make_element_by_type<image_element_base>(
state,
id);
852 if(
state.selected_army_group) {
853 auto army_group = fatten(
state.world,
state.selected_army_group);
855 for(
auto navy_membership : army_group.get_automated_army_group_membership_navy()) {
856 auto fat = navy_membership.get_navy();
858 for(
auto n : fat.get_navy_membership()) {
859 dcon::unit_type_id utid = n.get_ship().get_type();
861 if constexpr(N == 0) {
865 }
else if constexpr(N == 1) {
869 }
else if constexpr(N == 2) {
883template<
class T, std::
size_t N>
890 if(
name ==
"unit_amount") {
891 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
892 unitamount_text = ptr.
get();
894 }
else if(
name ==
"unit_strength") {
895 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
896 unitstrength_text = ptr.
get();
898 }
else if(
name ==
"unit_icon") {
899 auto ptr = make_element_by_type<image_element_base>(
state,
id);
900 if constexpr(std::is_same_v<T, dcon::army_id>) {
915 auto content = any_cast<T>(payload);
918 if constexpr(std::is_same_v<T, dcon::army_id>) {
921 uint16_t totalunits = 0;
923 for(
auto n : fat.get_army_membership()) {
924 dcon::unit_type_id utid = n.get_regiment().get_type();
926 if constexpr(N == 0) {
929 totalpops +=
uint32_t(
state.world.regiment_get_strength(n.get_regiment().id) *
state.defines.pop_size_per_regiment);
931 }
else if constexpr(N == 1) {
934 totalpops +=
uint32_t(
state.world.regiment_get_strength(n.get_regiment().id) *
state.defines.pop_size_per_regiment);
936 }
else if constexpr(N == 2) {
939 totalpops +=
uint32_t(
state.world.regiment_get_strength(n.get_regiment().id) *
state.defines.pop_size_per_regiment);
948 for(
auto n : fat.get_navy_membership()) {
949 dcon::unit_type_id utid = n.get_ship().get_type();
951 if constexpr(N == 0) {
955 }
else if constexpr(N == 1) {
959 }
else if constexpr(N == 2) {
978 T content = any_cast<T>(payload);
981 frame =
state.military_definitions.unit_base_definitions[utid].icon - 1;
983 if constexpr(std::is_same_v<T, dcon::regiment_id>) {
984 dcon::regiment_id reg = any_cast<dcon::regiment_id>(payload);
986 if(std::find(
state.selected_regiments.begin(),
state.selected_regiments.end(), reg) !=
state.selected_regiments.end()) {
992 else if constexpr(std::is_same_v<T, dcon::ship_id>) {
993 dcon::ship_id sh = any_cast<dcon::ship_id>(payload);
995 if(std::find(
state.selected_ships.begin(),
state.selected_ships.end(), sh) !=
state.selected_ships.end()) {
1005 if constexpr(std::is_same_v<T, dcon::regiment_id>) {
1007 Cyto::Any payload = dcon::regiment_id{};
1009 dcon::regiment_id reg = any_cast<dcon::regiment_id>(payload);
1023 else if constexpr(std::is_same_v<T, dcon::ship_id>) {
1027 dcon::ship_id reg = any_cast<dcon::ship_id>(payload);
1046 dcon::gfx_object_id gid;
1053 auto const& gfx_def =
state.ui_defs.gfx[gid];
1054 if(gfx_def.primary_texture_handle) {
1055 if(gfx_def.number_of_frames > 1) {
1061 state.world.locale_get_native_rtl(
state.font_collection.get_current_locale()));
1067 state.world.locale_get_native_rtl(
state.font_collection.get_current_locale()));
1077 if(
name ==
"select") {
1078 return make_element_by_type<subunit_entry_bg<dcon::regiment_id>>(
state, id);
1079 }
else if(
name ==
"select_naval") {
1080 return make_element_by_type<invisible_element>(
state,
id);
1081 }
else if(
name ==
"sunit_icon") {
1082 return make_element_by_type<subunit_details_type_icon<dcon::regiment_id>>(
state, id);
1083 }
else if(
name ==
"subunit_name") {
1084 return make_element_by_type<subunit_details_name<dcon::regiment_id>>(
state, id);
1085 }
else if(
name ==
"subunit_type") {
1086 return make_element_by_type<subunit_details_type_text<dcon::regiment_id>>(
state, id);
1087 }
else if(
name ==
"subunit_amount") {
1088 return make_element_by_type<subunit_details_regiment_amount>(
state,
id);
1089 }
else if(
name ==
"subunit_amount_naval") {
1090 return make_element_by_type<invisible_element>(
state,
id);
1091 }
else if(
name ==
"connected_pop") {
1092 return make_element_by_type<regiment_pop_icon>(
state,
id);
1093 }
else if(
name ==
"rebel_faction") {
1094 return make_element_by_type<invisible_element>(
state,
id);
1095 }
else if(
name ==
"unit_experience") {
1096 return make_element_by_type<unit_experience_bar<dcon::regiment_id>>(
state, id);
1097 }
else if(
name ==
"org_bar") {
1098 return make_element_by_type<subunit_organisation_progress_bar<dcon::regiment_id>>(
state, id);
1099 }
else if(
name ==
"str_bar") {
1100 return make_element_by_type<subunit_strength_progress_bar<dcon::regiment_id>>(
state, id);
1110 if(
name ==
"select") {
1111 return make_element_by_type<invisible_element>(
state,
id);
1112 }
else if(
name ==
"select_naval") {
1113 return make_element_by_type<subunit_entry_bg<dcon::ship_id>>(
state, id);
1114 }
else if(
name ==
"sunit_icon") {
1115 return make_element_by_type<subunit_details_type_icon<dcon::ship_id>>(
state, id);
1116 }
else if(
name ==
"subunit_name") {
1117 return make_element_by_type<subunit_details_name<dcon::ship_id>>(
state, id);
1118 }
else if(
name ==
"subunit_type") {
1119 return make_element_by_type<subunit_details_type_text<dcon::ship_id>>(
state, id);
1120 }
else if(
name ==
"subunit_amount") {
1121 return make_element_by_type<invisible_element>(
state,
id);
1122 }
else if(
name ==
"subunit_amount_naval") {
1123 return make_element_by_type<subunit_details_ship_amount>(
state,
id);
1124 }
else if(
name ==
"connected_pop") {
1125 return make_element_by_type<invisible_element>(
state,
id);
1126 }
else if(
name ==
"rebel_faction") {
1127 return make_element_by_type<invisible_element>(
state,
id);
1128 }
else if(
name ==
"unit_experience") {
1129 return make_element_by_type<unit_experience_bar<dcon::ship_id>>(
state, id);
1130 }
else if(
name ==
"org_bar") {
1131 return make_element_by_type<subunit_organisation_progress_bar<dcon::ship_id>>(
state, id);
1132 }
else if(
name ==
"str_bar") {
1133 return make_element_by_type<subunit_strength_progress_bar<dcon::ship_id>>(
state, id);
1143 return "subunit_entry";
1155 auto content = retrieve<dcon::army_id>(
state,
parent);
1163 state.world.army_for_each_army_membership_as_army(content, [&](dcon::army_membership_id amid) {
1164 auto rid =
state.world.army_membership_get_regiment(amid);
1168 auto av = state.world.regiment_get_type(a).index();
1169 auto bv = state.world.regiment_get_type(b).index();
1173 return a.index() < b.index();
1181 return "subunit_entry";
1191 auto content = retrieve<dcon::navy_id>(
state,
parent);
1193 state.world.navy_for_each_navy_membership_as_navy(content, [&](dcon::navy_membership_id nmid) {
1194 auto sid =
state.world.navy_membership_get_ship(nmid);
1198 auto av = state.world.ship_get_type(a).index();
1199 auto bv = state.world.ship_get_type(b).index();
1203 return a.index() < b.index();
1215 auto p =
state.world.army_get_location_from_army_location(a);
1216 int32_t max_cap = 0;
1217 for(
auto n :
state.world.province_get_navy_location(p)) {
1218 if(n.get_navy().get_controller_from_navy_control() ==
state.local_player_nation &&
1219 !
bool(n.get_navy().get_battle_from_navy_battle_participation())) {
1225 auto regs =
state.world.army_get_army_membership(a);
1226 int32_t army_cap = int32_t(regs.end() - regs.begin());
1227 int32_t to_split = army_cap - max_cap;
1229 std::array<dcon::regiment_id, command::num_packed_units> data;
1231 data.fill(dcon::regiment_id{});
1232 for(
auto reg :
state.world.army_get_army_membership(a)) {
1236 data[i] = reg.get_regiment();
1240 data.fill(dcon::regiment_id{});
1257 auto p =
state.world.army_get_location_from_army_location(a);
1258 visible = !bool(
state.world.army_get_navy_from_army_transport(a));
1262 int32_t max_cap = 0;
1263 for(
auto n :
state.world.province_get_navy_location(p)) {
1264 if(n.get_navy().get_controller_from_navy_control() ==
state.local_player_nation &&
1265 !
bool(n.get_navy().get_battle_from_navy_battle_participation())) {
1283 auto loc =
state.world.army_get_location_from_army_location(n);
1308 auto tprted =
state.world.army_get_navy_from_army_transport(n);
1309 auto loc =
state.world.army_get_location_from_army_location(n);
1313 if(loc.index() >=
state.province_definitions.first_sea_province.index()) {
1325 auto tprted =
state.world.army_get_navy_from_army_transport(n);
1326 auto loc =
state.world.army_get_location_from_army_location(n);
1346 auto tprted =
state.world.navy_get_army_transport(n);
1347 std::vector<dcon::army_id> tmp;
1348 for(
auto t : tprted)
1349 tmp.push_back(t.get_army());
1356 auto tprted =
state.world.navy_get_army_transport(n);
1357 auto loc =
state.world.navy_get_location_from_navy_location(n);
1359 if(tprted.begin() == tprted.end() || loc.index() >=
state.province_definitions.first_sea_province.index()) {
1372 auto tprted =
state.world.navy_get_army_transport(n);
1373 auto loc =
state.world.navy_get_location_from_navy_location(n);
1394 auto txt = std::to_string(tfree) +
" (" + std::to_string(tcap) +
")";
1410 visible = !
state.world.army_get_is_rebel_hunter(a) &&
state.world.army_get_controller_from_army_control(a) ==
state.local_player_nation;
1436 visible =
state.world.army_get_is_rebel_hunter(a) &&
state.world.army_get_controller_from_army_control(a) ==
state.local_player_nation;
1460 return state.world.army_get_is_ai_controlled(retrieve<dcon::army_id>(
state,
parent));
1474 disabled =
state.world.army_get_controller_from_army_control(a) !=
state.local_player_nation;
1481 auto army = retrieve<dcon::army_id>(
state,
parent);
1482 auto navy = retrieve<dcon::navy_id>(
state,
parent);
1486 auto owner =
state.local_player_nation;
1487 auto capital =
state.world.nation_get_capital(owner);
1488 auto s =
state.world.province_get_state_membership(capital);
1489 auto m =
state.world.state_instance_get_market_from_local_market(s);
1491 float spending_level = .0f;
1495 spending_level = float(
state.world.nation_get_land_spending(owner)) / 100.0f;
1498 spending_level = float(
state.world.nation_get_naval_spending(owner)) / 100.0f;
1504 float max_supply = 0.0f;
1505 float actual_supply = 0.0f;
1508 auto nations_commodity_spending =
state.world.nation_get_spending_level(owner);
1510 for(
uint32_t i = 0; i < total_commodities; ++i) {
1511 if(!commodities.commodity_type[i]) {
1515 dcon::commodity_id c{ dcon::commodity_id::value_base_t(i) };
1517 auto satisfaction =
state.world.market_get_demand_satisfaction(m, c);
1518 auto val = commodities.commodity_type[i];
1520 max_supply += commodities.commodity_amounts[i];
1521 actual_supply += commodities.commodity_amounts[i] * satisfaction * nations_commodity_spending * spending_level;
1524 float median_supply = max_supply > 0.0f ? actual_supply / max_supply : 0.0f;
1534 auto army = retrieve<dcon::army_id>(
state,
parent);
1535 auto navy = retrieve<dcon::navy_id>(
state,
parent);
1538 float spending_level = .0f;
1539 auto owner =
state.local_player_nation;
1540 auto capital =
state.world.nation_get_capital(owner);
1541 auto s =
state.world.province_get_state_membership(capital);
1542 auto m =
state.world.state_instance_get_market_from_local_market(s);
1546 spending_level = float(
state.world.nation_get_land_spending(owner)) / 100.0f;
1549 spending_level = float(
state.world.nation_get_naval_spending(owner)) / 100.0f;
1555 float max_supply = 0.0f;
1556 float actual_supply = 0.0f;
1558 auto nations_commodity_spending =
state.world.nation_get_spending_level(owner);
1559 for(
uint32_t i = 0; i < total_commodities; ++i) {
1560 if(!commodities.commodity_type[i]) {
1563 dcon::commodity_id c{ dcon::commodity_id::value_base_t(i) };
1565 auto satisfaction =
state.world.market_get_demand_satisfaction(m, c);
1566 auto val = commodities.commodity_type[i];
1568 max_supply += commodities.commodity_amounts[i];
1569 actual_supply += commodities.commodity_amounts[i] * satisfaction * nations_commodity_spending * spending_level;
1572 float median_supply = max_supply > 0.0f ? actual_supply / max_supply : 0.0f;
1576 if(commodities.commodity_type[i] && commodities.commodity_amounts[i] > 0) {
1577 dcon::commodity_id c{ dcon::commodity_id::value_base_t(i) };
1578 float satisfaction =
state.world.market_get_demand_satisfaction(m, c);
1579 float wanted_commodity = commodities.commodity_amounts[i];
1580 float actual_commodity = commodities.commodity_amounts[i] * satisfaction * nations_commodity_spending * spending_level;
1582 int32_t display_satisfaction = int32_t(satisfaction * 100);
1584 if(satisfaction == 1 || satisfaction >= 0.95) {
1585 text::add_line(
state, contents,
"unit_current_supply_high",
text::variable_type::what,
state.world.commodity_get_name(commodities.commodity_type[i]),
text::variable_type::val,
text::fp_three_places{ actual_commodity },
text::variable_type::value,
text::fp_three_places{ wanted_commodity },
text::variable_type::total, display_satisfaction);
1586 }
else if (satisfaction < 0.95 && satisfaction >= 0.5) {
1587 text::add_line(
state, contents,
"unit_current_supply_mid",
text::variable_type::what,
state.world.commodity_get_name(commodities.commodity_type[i]),
text::variable_type::val,
text::fp_three_places{ actual_commodity },
text::variable_type::value,
text::fp_three_places{ wanted_commodity },
text::variable_type::total, display_satisfaction);
1589 text::add_line(
state, contents,
"unit_current_supply_low",
text::variable_type::what,
state.world.commodity_get_name(commodities.commodity_type[i]),
text::variable_type::val,
text::fp_three_places{ actual_commodity },
text::variable_type::value,
text::fp_three_places{ wanted_commodity },
text::variable_type::total, display_satisfaction);
1616 for(dcon::unit_type_id::value_base_t i = 0; i <
state.military_definitions.unit_base_definitions.size(); i++) {
1623 auto const utid = dcon::unit_type_id(i);
1625 std::string padding = i < 10 ?
"0" :
"";
1629 std::string description =
"@*" + padding + std::to_string(i);
1647 std::vector<dcon::province_id> provinces;
1659 auto army = retrieve<dcon::army_id>(
state,
parent);
1660 auto army_location =
state.world.army_get_location_from_army_location(army);
1662 state.fill_vector_of_connected_provinces(army_location,
true,
provinces);
1666 std::array<uint8_t, sys::macro_builder_template::max_types> current_distribution;
1667 current_distribution.fill(0);
1669 for(
auto reg :
state.world.army_get_army_membership(army)) {
1670 current_distribution[reg.get_regiment().get_type().index()] += 1;
1673 state.build_up_to_template_land(
1677 current_distribution
1683 std::unique_ptr<element_base> make_child(
sys::state&
state, std::string_view
name, dcon::gui_def_id
id)
noexcept override {
1684 if(
name ==
"composition") {
1685 return make_element_by_type<main_template_composition_label>(
state,
id);
1686 }
else if(
name ==
"background") {
1687 return make_element_by_type< apply_template_to_army_location_button>(
state,
id);
1701 if constexpr(std::is_same_v<T, dcon::army_id>) {
1702 auto ptr = make_element_by_type<unit_details_ai_controlled>(
state,
"alice_enable_ai_controlled");
1708 if(
name ==
"load_button" && std::is_same_v<T, dcon::army_id>) {
1709 if constexpr(std::is_same_v<T, dcon::army_id>) {
1710 return make_element_by_type<unit_details_load_army_button>(
state,
id);
1712 return make_element_by_type<invisible_element>(
state,
id);
1714 }
else if(
name ==
"unload_button") {
1715 if constexpr(std::is_same_v<T, dcon::army_id>) {
1716 return make_element_by_type<unit_details_unload_army_button>(
state,
id);
1718 return make_element_by_type<unit_details_unload_navy_button>(
state,
id);
1720 }
else if(
name ==
"enable_rebel_button") {
1721 if constexpr(std::is_same_v<T, dcon::army_id>) {
1722 return make_element_by_type<unit_details_hunt_rebels>(
state,
id);
1724 return make_element_by_type<invisible_element>(
state,
id);
1726 }
else if(
name ==
"disable_rebel_button") {
1727 if constexpr(std::is_same_v<T, dcon::army_id>) {
1728 return make_element_by_type<unit_details_dont_hunt_rebels>(
state,
id);
1730 return make_element_by_type<invisible_element>(
state,
id);
1732 }
else if(
name ==
"attach_unit_button"
1733 ||
name ==
"detach_unit_button"
1734 ||
name ==
"select_land") {
1736 return make_element_by_type<invisible_element>(
state,
id);
1737 }
else if(
name ==
"header") {
1738 if constexpr(std::is_same_v<T, dcon::army_id>) {
1739 return make_element_by_type<invisible_element>(
state,
id);
1741 return make_element_by_type< navy_transport_text>(
state,
id);
1743 }
else if(
name ==
"alice_build_up_to_template_window") {
1744 if constexpr(std::is_same_v<T, dcon::army_id>) {
1745 return make_element_by_type<apply_template_container>(
state,
id);
1747 return make_element_by_type<invisible_element>(
state,
id);
1757 auto regiment_type = retrieve<dcon::unit_type_id>(
state,
parent);
1760 frame =
state.military_definitions.unit_base_definitions[regiment_type].icon - 1;
1767 auto regiment_type = retrieve<dcon::unit_type_id>(
state,
parent);
1770 auto name_string_def =
state.military_definitions.unit_base_definitions[regiment_type].name;
1774 auto const& ut =
state.military_definitions.unit_base_definitions[regiment_type];
1775 if(!ut.active && !
state.world.nation_get_active_unit(
state.local_player_nation, regiment_type)) {
1782 auto allowed_transition =
true;
1784 for(
unsigned i = 0; i <
state.selected_regiments.size(); i++) {
1785 if(
state.selected_regiments[i]) {
1788 if(
state.selected_ships[i]) {
1794 if(!allowed_transition) {
1799 if(!
state.selected_regiments[i] && !
state.selected_ships[i]) {
1805 if(!allowed_transition) {
1814 auto regiment_type = retrieve<dcon::unit_type_id>(
state,
parent);
1818 for(
unsigned i = 0; i <
state.selected_regiments.size(); i++) {
1819 if(
state.selected_regiments[i]) {
1822 if(
state.selected_ships[i]) {
1830 if(!
state.selected_regiments[i] && !
state.selected_ships[i]) {
1848 auto new_type = retrieve<dcon::unit_type_id>(
state,
parent);
1849 auto const& ut =
state.military_definitions.unit_base_definitions[new_type];
1855 auto any_non_big_ship =
false;
1856 for(
unsigned i = 0; i <
state.selected_ships.size(); i++) {
1857 if(!
state.selected_ships[i]) {
1860 auto shiptype =
state.world.ship_get_type(
state.selected_ships[i]);
1861 auto st =
state.military_definitions.unit_base_definitions[shiptype];
1863 any_non_big_ship =
true;
1871 auto any_breaking_army_check =
false;
1872 for(
unsigned i = 0; i <
state.selected_regiments.size(); i++) {
1873 if(!
state.selected_regiments[i]) {
1876 auto a =
state.world.regiment_get_army_from_army_membership(
state.selected_regiments[i]);
1878 if(
state.world.army_get_controller_from_army_control(a) !=
state.local_player_nation ||
state.world.army_get_is_retreating(a) ||
state.world.army_get_navy_from_army_transport(a) ||
1879 bool(
state.world.army_get_battle_from_army_battle_participation(a))) {
1880 any_breaking_army_check =
true;
1888 auto any_breaking_navy_check =
false;
1889 auto any_breaking_navy_base_check =
false;
1891 for(
unsigned i = 0; i <
state.selected_ships.size(); i++) {
1892 if(!
state.selected_ships[i]) {
1895 auto n =
state.world.ship_get_navy_from_navy_membership(
state.selected_ships[i]);
1896 auto embarked =
state.world.navy_get_army_transport(n);
1897 if(
state.world.navy_get_controller_from_navy_control(n) !=
state.local_player_nation ||
state.world.navy_get_is_retreating(n) ||
1898 bool(
state.world.navy_get_battle_from_navy_battle_participation(n)) || embarked.begin() != embarked.end()) {
1899 any_breaking_navy_check =
true;
1902 if(ut.min_port_level) {
1905 auto loc = fnid.get_location_from_navy_location();
1909 any_breaking_navy_base_check =
true;
1921 std::unique_ptr<element_base> make_child(
sys::state&
state, std::string_view
name, dcon::gui_def_id
id)
noexcept override {
1922 if(
name ==
"unit_type_icon") {
1923 return make_element_by_type<unit_type_listbox_entry_image>(
state,
id);
1924 }
else if(
name ==
"unit_type_select") {
1925 return make_element_by_type<unit_type_listbox_entry_label>(
state,
id);
1936 return "unit_type_item";
1943 auto is_land =
true;
1945 if constexpr(std::is_same_v<T, dcon::army_id>) {
1949 }
else if constexpr(std::is_same_v<T, dcon::navy_id>) {
1955 for(dcon::unit_type_id::value_base_t i = 2; i <
state.military_definitions.unit_base_definitions.size(); i++) {
1956 auto const utid = dcon::unit_type_id(i);
1957 auto const& ut =
state.military_definitions.unit_base_definitions[utid];
1958 if(ut.is_land == is_land) {
1971 if(
name ==
"unit_type_list") {
1972 return make_element_by_type<unit_type_listbox<T>>(
state, id);
1979 if(!
state.selected_regiments.at(0) && !
state.selected_ships.at(0)) {
2011 auto win = make_element_by_type<unit_details_type_item<T, 0>>(
state,
2013 win->base_data.position.x = base_position.
x + (0 * base_offset.
x);
2014 win->base_data.position.y = base_position.
y + (0 * base_offset.
y);
2018 auto win = make_element_by_type<unit_details_type_item<T, 1>>(
state,
2020 win->base_data.position.x = base_position.
x + (1 * base_offset.
x);
2021 win->base_data.position.y = base_position.
y + (1 * base_offset.
y);
2025 auto win = make_element_by_type<unit_details_type_item<T, 2>>(
state,
2027 win->base_data.position.x = base_position.
x + (2 * base_offset.
x);
2028 win->base_data.position.y = base_position.
y + (2 * base_offset.
y);
2033 if constexpr(std::is_same_v<T, dcon::army_id>) {
2034 auto ptr = make_element_by_type<unit_details_army_listbox>(
state,
2036 ptr->base_data.position.y = base_position.
y + item_offset.
y + (3 * base_offset.
y) + 72 - 32;
2037 ptr->base_data.size.y += 32;
2040 auto ptr = make_element_by_type<unit_details_navy_listbox>(
state,
2042 ptr->base_data.position.y = base_position.
y + item_offset.
y + (3 * base_offset.
y) + 72 - 32;
2043 ptr->base_data.size.y += 32;
2048 auto ptr = make_element_by_type<unit_details_buttons<T>>(
state,
2056 make_element_by_type<unit_selection_panel<T>>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"unitpanel"))->second.definition);
2057 unit_selection_win = ptr.
get();
2058 ptr->base_data.position.y = -80;
2064 make_element_by_type<unit_upgrade_window<T>>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"unit_upgrade_window"))->second.definition);
2065 unit_upgrade_win = ptr.
get();
2067 unit_upgrade_win->set_visible(
state,
false);
2072 if(
name ==
"unit_bottom_bg") {
2073 return make_element_by_type<unit_panel_dynamic_tinted_bg<T>>(
state, id);
2074 }
else if(
name ==
"icon_speed") {
2075 return make_element_by_type<image_element_base>(
state,
id);
2076 }
else if(
name ==
"speed") {
2077 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
2078 unitspeed_text = ptr.
get();
2080 }
else if(
name ==
"icon_recon") {
2081 auto ptr = make_element_by_type<image_element_base>(
state,
id);
2082 unitrecon_icon = ptr.
get();
2084 }
else if(
name ==
"recon") {
2085 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
2086 unitrecon_text = ptr.
get();
2088 }
else if(
name ==
"icon_engineer") {
2089 auto ptr = make_element_by_type<image_element_base>(
state,
id);
2090 unitengineer_icon = ptr.
get();
2092 }
else if(
name ==
"engineer") {
2093 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
2094 unitengineer_text = ptr.
get();
2096 }
else if(
name ==
"icon_supplies_small") {
2097 return make_element_by_type<image_element_base>(
state,
id);
2098 }
else if(
name ==
"supply_status") {
2099 auto ptr = make_element_by_type<unit_supply_bar>(
state,
id);
2100 unitsupply_bar = ptr.
get();
2102 }
else if(
name ==
"unitstatus_dugin") {
2103 auto ptr = make_element_by_type<image_element_base>(
state,
id);
2104 unitdugin_icon = ptr.
get();
2112 if constexpr(std::is_same_v<T, dcon::navy_id>) {
2121 }
else if constexpr(std::is_same_v<T, dcon::army_id>) {
2134 if(payload.holds_type<T>()) {
2138 unit_id = any_cast<element_selection_wrapper<T>>(payload).data;
2142 auto content = any_cast<element_selection_wrapper<dcon::leader_id>>(payload).data;
2143 if constexpr(std::is_same_v<T, dcon::army_id>) {
2150 auto content = any_cast<element_selection_wrapper<unitpanel_action>>(payload).data;
2156 state.selected_armies.clear();
2157 state.selected_navies.clear();
2159 state.game_state_updated.store(
true, std::memory_order_release);
2188 if(
state.selected_armies.size() > 0) {
2189 auto first =
state.selected_armies[0];
2190 for(
uint32_t i = 1; i <
state.selected_armies.size(); ++i) {
2194 if(
state.selected_navies.size() > 0) {
2195 auto first =
state.selected_navies[0];
2196 for(
uint32_t i = 1; i <
state.selected_navies.size(); ++i) {
2205 if(
state.selected_armies.size() > 0) {
2207 auto first =
state.selected_armies[0];
2209 for(
uint32_t i = 1; i <
state.selected_armies.size(); ++i) {
2216 if(
state.selected_navies.size() > 0) {
2217 auto first =
state.selected_navies[0];
2219 for(
uint32_t i = 1; i <
state.selected_navies.size(); ++i) {
2232 state.selected_armies.clear();
2233 state.selected_navies.clear();
2234 state.game_state_updated.store(
true, std::memory_order_release);
2241 for(
auto a :
state.selected_armies) {
2244 for(
auto a :
state.selected_navies) {
2261 if(std::holds_alternative<dcon::army_id>(foru)) {
2262 state.selected_armies.clear();
2263 state.selected_navies.clear();
2264 state.select(std::get<dcon::army_id>(foru));
2265 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2266 state.selected_armies.clear();
2267 state.selected_navies.clear();
2268 state.select(std::get<dcon::navy_id>(foru));
2273 if(std::holds_alternative<dcon::army_id>(foru)) {
2274 state.deselect(std::get<dcon::army_id>(foru));
2275 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2276 state.deselect(std::get<dcon::navy_id>(foru));
2286 if(std::holds_alternative<dcon::army_id>(foru)) {
2287 auto a = std::get<dcon::army_id>(foru);
2288 for(
auto r :
state.world.army_get_army_membership(a)) {
2289 total += r.get_regiment().get_strength() *
state.defines.pop_size_per_regiment;
2292 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2293 auto a = std::get<dcon::navy_id>(foru);
2294 for(
auto r :
state.world.navy_get_navy_membership(a)) {
2295 total += r.get_ship().get_strength();
2303 bool visible =
false;
2306 if(std::holds_alternative<dcon::army_id>(foru)) {
2307 auto a = std::get<dcon::army_id>(foru);
2309 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2310 auto a = std::get<dcon::navy_id>(foru);
2316 void render(
sys::state&
state, int32_t x, int32_t y)
noexcept override {
2324 float current = 0.0f;
2327 if(std::holds_alternative<dcon::army_id>(foru)) {
2328 auto a = std::get<dcon::army_id>(foru);
2329 for(
auto r :
state.world.army_get_army_membership(a)) {
2330 current += r.get_regiment().get_org();
2333 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2334 auto a = std::get<dcon::navy_id>(foru);
2335 for(
auto r :
state.world.navy_get_navy_membership(a)) {
2336 current += r.get_ship().get_org();
2340 progress = total > 0.0f ? current / total : 0.0f;
2350 if(std::holds_alternative<dcon::army_id>(foru)) {
2352 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2360 float current = 0.0f;
2363 if(std::holds_alternative<dcon::army_id>(foru)) {
2364 auto a = std::get<dcon::army_id>(foru);
2365 for(
auto r :
state.world.army_get_army_membership(a)) {
2366 current += r.get_regiment().get_strength();
2369 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2370 auto a = std::get<dcon::navy_id>(foru);
2371 for(
auto r :
state.world.navy_get_navy_membership(a)) {
2372 current += r.get_ship().get_strength();
2376 progress = total > 0.0f ? current / total : 0.0f;
2388 if(std::holds_alternative<dcon::army_id>(foru)) {
2390 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2396 if(std::holds_alternative<dcon::army_id>(foru)) {
2398 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2414 if(std::holds_alternative<dcon::army_id>(foru)) {
2415 state.deselect(std::get<dcon::army_id>(foru));
2416 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2417 state.deselect(std::get<dcon::navy_id>(foru));
2432 if(std::holds_alternative<dcon::army_id>(foru)) {
2434 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2441 if(std::holds_alternative<dcon::army_id>(foru)) {
2443 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2468 if(std::holds_alternative<dcon::army_id>(foru)) {
2470 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2480 if(std::holds_alternative<dcon::army_id>(foru)) {
2482 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2492 if(std::holds_alternative<dcon::army_id>(foru)) {
2494 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2505 if(std::holds_alternative<dcon::army_id>(foru)) {
2506 auto a = std::get<dcon::army_id>(foru);
2507 for(
auto r :
state.world.army_get_army_membership(a)) {
2512 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2513 auto a = std::get<dcon::navy_id>(foru);
2514 for(
auto r :
state.world.navy_get_navy_membership(a)) {
2530 if(std::holds_alternative<dcon::army_id>(foru)) {
2531 auto a = std::get<dcon::army_id>(foru);
2532 for(
auto r :
state.world.army_get_army_membership(a)) {
2537 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2538 auto a = std::get<dcon::navy_id>(foru);
2539 for(
auto r :
state.world.navy_get_navy_membership(a)) {
2555 if(std::holds_alternative<dcon::army_id>(foru)) {
2556 auto a = std::get<dcon::army_id>(foru);
2557 for(
auto r :
state.world.army_get_army_membership(a)) {
2562 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2563 auto a = std::get<dcon::navy_id>(foru);
2564 for(
auto r :
state.world.navy_get_navy_membership(a)) {
2578 dcon::province_id loc;
2580 if(std::holds_alternative<dcon::army_id>(foru)) {
2581 auto a = std::get<dcon::army_id>(foru);
2582 loc =
state.world.army_get_location_from_army_location(a);
2583 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2584 auto a = std::get<dcon::navy_id>(foru);
2585 loc =
state.world.navy_get_location_from_navy_location(a);
2606 dcon::leader_id lid;
2607 if(std::holds_alternative<dcon::army_id>(foru)) {
2608 lid =
state.world.army_get_general_from_army_leadership(std::get<dcon::army_id>(foru));
2610 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2611 lid =
state.world.navy_get_admiral_from_navy_leadership(std::get<dcon::navy_id>(foru));
2615 auto pculture =
state.world.nation_get_primary_culture(
state.local_player_nation);
2616 auto ltype = pculture.get_group_from_culture_group_membership().get_leader();
2619 auto admiral =
state.world.leader_get_is_admiral(lid);
2621 auto arange = ltype.get_admirals();
2622 if(arange.size() > 0) {
2632 auto grange = ltype.get_generals();
2633 if(grange.size() > 0) {
2657 dcon::leader_id lid;
2658 if(std::holds_alternative<dcon::army_id>(foru)) {
2659 lid =
state.world.army_get_general_from_army_leadership(std::get<dcon::army_id>(foru));
2660 }
else if(std::holds_alternative<dcon::navy_id>(foru)) {
2661 lid =
state.world.navy_get_admiral_from_navy_leadership(std::get<dcon::navy_id>(foru));
2671 if(std::holds_alternative<dcon::army_id>(foru)) {
2682 if(
name ==
"unitpanel_bg") {
2683 return make_element_by_type<whole_panel_button>(
state,
id);
2684 }
else if(
name ==
"leader_photo") {
2685 return make_element_by_type<multi_selection_leader_image>(
state,
id);
2686 }
else if(
name ==
"unitstrength") {
2687 return make_element_by_type <u_row_strength> (
state,
id);
2688 }
else if(
name ==
"unitattrition_icon") {
2689 return make_element_by_type<u_row_attrit_icon>(
state,
id);
2690 }
else if(
name ==
"org_bar") {
2691 return make_element_by_type<u_row_org_bar>(
state,
id);
2692 }
else if(
name ==
"str_bar") {
2693 return make_element_by_type<u_row_str_bar>(
state,
id);
2694 }
else if(
name ==
"disbandbutton") {
2695 return make_element_by_type<u_row_disband>(
state,
id);
2696 }
else if(
name ==
"splitinhalf") {
2697 return make_element_by_type<u_row_split>(
state,
id);
2698 }
else if(
name ==
"newunitbutton") {
2699 return make_element_by_type<u_row_new>(
state,
id);
2700 }
else if(
name ==
"remove_unit_from_selection_button") {
2701 return make_element_by_type<u_row_remove>(
state,
id);
2702 }
else if(
name ==
"unit_inf") {
2703 return make_element_by_type<u_row_inf>(
state,
id);
2704 }
else if(
name ==
"unit_inf_count") {
2705 return make_element_by_type<u_row_inf_count>(
state,
id);
2706 }
else if(
name ==
"unit_cav") {
2707 return make_element_by_type<u_row_cav>(
state,
id);
2708 }
else if(
name ==
"unit_cav_count") {
2709 return make_element_by_type<u_row_cav_count>(
state,
id);
2710 }
else if(
name ==
"unit_art") {
2711 return make_element_by_type<u_row_art>(
state,
id);
2712 }
else if(
name ==
"unit_art_count") {
2713 return make_element_by_type<u_row_art_count>(
state,
id);
2714 }
else if(
name ==
"location") {
2715 return make_element_by_type<u_row_location>(
state,
id);
2725 return "alice_unit_row";
2729 for(
auto i :
state.selected_armies)
2731 for(
auto i :
state.selected_navies)
2738 bool visible =
true;
2741 for(
auto i :
state.selected_armies) {
2742 if(
state.world.army_get_is_ai_controlled(i) ==
false)
2749 visible =
state.selected_navies.empty();
2759 for(
auto i :
state.selected_armies) {
2760 if(
state.world.army_get_is_ai_controlled(i) ==
false) {
2765 for(
auto a :
state.selected_armies) {
2769 if(!
state.world.army_get_is_ai_controlled(a)) {
2785 auto ptr = make_element_by_type<multi_unit_details_ai_controlled>(
state,
"alice_enable_ai_controlled_multi");
2790 if(
name ==
"desc") {
2791 return make_element_by_type<units_selected_text>(
state,
id);
2792 }
else if(
name ==
"mergebutton") {
2793 return make_element_by_type<merge_all_button>(
state,
id);
2794 }
else if(
name ==
"close_multiunit") {
2795 return make_element_by_type<deselect_all_button> (
state,
id);
2796 }
else if(
name ==
"disband_multiunit") {
2797 return make_element_by_type<disband_all_button>(
state,
id);
2798 }
else if(
name ==
"unit_listbox") {
2799 return make_element_by_type<selected_unit_list>(
state,
id);
2814 return !(*
this == o);
2824 auto regiment_type_data = retrieve<army_group_unit_type_info_optional>(
state,
parent);
2825 if(!std::holds_alternative<std::monostate>(regiment_type_data)) {
2826 frame =
state.military_definitions.unit_base_definitions[std::get<army_group_unit_type_info>(regiment_type_data).id].icon - 1;
2833 auto regiment_type_data = retrieve<army_group_unit_type_info_optional>(
state,
parent);
2834 if(!std::holds_alternative<std::monostate>(regiment_type_data)) {
2835 auto name_string_def =
state.military_definitions.unit_base_definitions[std::get<army_group_unit_type_info>(regiment_type_data).id].name;
2843 auto regiment_type_data = retrieve<army_group_unit_type_info_optional>(
state,
parent);
2844 if(!std::holds_alternative<std::monostate>(regiment_type_data)) {
2845 set_text(
state, std::to_string(std::get<army_group_unit_type_info>(regiment_type_data).amount));
2855 if(
name ==
"alice_army_group_unit_type_entry_icon") {
2856 return make_element_by_type<unit_type_row_image>(
state,
id);
2857 }
else if(
name ==
"alice_army_group_unit_type_entry_name") {
2858 return make_element_by_type<unit_type_row_label>(
state,
id);
2859 }
else if(
name ==
"alice_army_group_unit_type_entry_amount") {
2860 return make_element_by_type<unit_type_row_amount>(
state,
id);
2866 if(!std::holds_alternative<std::monostate>(
display_unit)) {
2872 if(!std::holds_alternative<std::monostate>(
display_unit)) {
2894 auto def =
state.ui_state.
defs_by_name.find(
state.lookup_key(
"alice_army_group_unit_type_grid_item"))->second.definition;
2896 uint8_t additional_padding = 5;
2899 auto win = make_element_by_type<unit_type_grid_item>(
state, def);
2900 win->base_data.position.x = int16_t(additional_padding);
2901 win->base_data.position.y = int16_t(3);
2906 auto win = make_element_by_type<unit_type_grid_item>(
state, def);
2907 win->base_data.position.x = int16_t(additional_padding * 2 + win->base_data.size.x);
2908 win->base_data.position.y = int16_t(3);
2913 auto win = make_element_by_type<unit_type_grid_item>(
state, def);
2914 win->base_data.position.x = int16_t(additional_padding * 3 + win->base_data.size.x * 2);
2915 win->base_data.position.y = int16_t(3);
2935 return "alice_army_group_unit_type_row";
2941 std::vector<uint32_t> regiments_by_type{ };
2942 regiments_by_type.resize(
state.military_definitions.unit_base_definitions.size() + 2);
2944 if(
state.selected_army_group) {
2945 auto group = fatten(
state.world,
state.selected_army_group);
2947 for(
auto regiment_membership : group.get_automated_army_group_membership_regiment()) {
2948 auto regiment = regiment_membership.get_regiment().get_regiment_from_automation();
2949 auto type = regiment.get_type();
2951 regiments_by_type[
type.index()] += 1;
2954 for(
auto navy_membership : group.get_automated_army_group_membership_navy()) {
2955 for(
auto ship_membership :
state.world.navy_get_navy_membership(navy_membership.get_navy())) {
2956 auto type = ship_membership.get_ship().get_type();
2958 regiments_by_type[
type.index()] += 1;
2964 size_t unit_types =
state.military_definitions.unit_base_definitions.size();
2965 for(
size_t i = 2; i < unit_types; i += 3) {
2968 for(
size_t j = 0; (j + i < unit_types) && (j < 3); j += 1) {
2969 dcon::unit_type_id type_id{ dcon::unit_type_id::value_base_t(j + i) };
2973 .amount = regiments_by_type[type_id.index()]
2976 content_of_grid_row[j] = new_item;
2990 return "alice_unit_row";
2994 if(
state.selected_army_group) {
2996 for(
auto navy_membership : group.get_automated_army_group_membership_navy()) {
3009 xy_pair base_position = { 15, 0 };
3010 uint16_t base_offset = 95;
3013 auto win = make_element_by_type<selected_army_group_land_details_item<0>>(
state,
3015 win->base_data.position.
x = base_position.
x + (0 * base_offset);
3019 auto win = make_element_by_type<selected_army_group_land_details_item<1>>(
state,
3021 win->base_data.position.x = base_position.
x + (1 * base_offset);
3025 auto win = make_element_by_type<selected_army_group_land_details_item<2>>(
state,
3027 win->base_data.position.x = base_position.
x + (2 * base_offset);
3032 auto win = make_element_by_type<selected_army_group_sea_details_item<0>>(
state,
3034 win->base_data.position.x = base_position.
x + (0 * base_offset);
3035 win->base_data.position.y = 40;
3039 auto win = make_element_by_type<selected_army_group_sea_details_item<1>>(
state,
3041 win->base_data.position.x = base_position.
x + (1 * base_offset);
3042 win->base_data.position.y = 40;
3046 auto win = make_element_by_type<selected_army_group_sea_details_item<2>>(
state,
3048 win->base_data.position.x = base_position.
x + (2 * base_offset);
3049 win->base_data.position.y = 40;
3058 if(
name ==
"alice_army_group_unit_listbox") {
3059 return make_element_by_type<selected_army_group_land_units_list>(
state,
id);
3073 state.game_state_updated.store(
true, std::memory_order_release);
3102 state.game_state_updated.store(
true, std::memory_order_release);
3130 state.game_state_updated.store(
true, std::memory_order_release);
3152 for(
auto item :
state.selected_armies) {
3153 state.world.for_each_automated_army_group([&](dcon::automated_army_group_id group) {
3154 state.remove_army_army_group_clean(group, item);
3156 state.add_army_to_army_group(
state.selected_army_group, item);
3158 for(
auto item :
state.selected_navies) {
3159 state.world.for_each_automated_army_group([&](dcon::automated_army_group_id group) {
3160 state.remove_navy_from_army_group(group, item);
3162 state.add_navy_to_army_group(
state.selected_army_group, item);
3167 if(
state.selected_army_group) {
3185 if(
state.selected_army_group) {
3186 for(
auto item :
state.selected_armies) {
3187 state.remove_army_army_group_clean(
state.selected_army_group, item);
3189 for(
auto item :
state.selected_navies) {
3190 state.remove_navy_from_army_group(
state.selected_army_group, item);
3196 if(
state.selected_army_group) {
3214 auto selected =
state.map_state.selected_province;
3216 state.new_army_group(selected);
3221 if(
state.map_state.selected_province) {
3231 auto selected =
state.selected_army_group;
3233 state.delete_army_group(selected);
3238 if(
state.selected_army_group) {
3249 auto content = retrieve<dcon::automated_army_group_id>(
state,
parent);
3250 auto hq =
state.world.automated_army_group_get_hq(content);
3257 auto info = retrieve<dcon::automated_army_group_id>(
state,
parent);
3258 state.select_army_group(info);
3262 auto info = retrieve<dcon::automated_army_group_id>(
state,
parent);
3265 if(
state.selected_army_group) {
3267 auto local_hq =
state.world.automated_army_group_get_hq(info);
3268 auto selected_hq =
state.world.automated_army_group_get_hq(
state.selected_army_group);
3269 if(local_hq == selected_hq) {
3280 std::unique_ptr<element_base> make_child(
sys::state&
state, std::string_view
name, dcon::gui_def_id
id)
noexcept override {
3281 if(
name ==
"alice_select_army_group_button") {
3282 return make_element_by_type<select_army_group_button>(
state,
id);
3283 }
else if(
name ==
"alice_army_group_location") {
3284 return make_element_by_type<army_group_location>(
state,
id);
3294 return "alice_army_group_entry";
3298 state.world.for_each_automated_army_group([&](dcon::automated_army_group_id item) {
3306 std::unique_ptr<element_base> make_child(
sys::state&
state, std::string_view
name, dcon::gui_def_id
id)
noexcept override {
3307 if(
name ==
"alice_army_group_listbox") {
3308 return make_element_by_type<army_groups_list>(
state,
id);
3316 std::unique_ptr<element_base> make_child(
sys::state&
state, std::string_view
name, dcon::gui_def_id
id)
noexcept override {
3317 if(
name ==
"alice_armygroup_new_button") {
3318 return make_element_by_type<new_army_group_button>(
state,
id);
3319 }
else if(
name ==
"alice_armygroup_delete_button") {
3320 return make_element_by_type<delete_army_group_button>(
state,
id);
3321 }
else if(
name ==
"alice_battleplanner_remove_selected") {
3322 return make_element_by_type<remove_selected_units_from_army_group_button>(
state,
id);
3323 }
else if(
name ==
"alice_army_group_listbox_wrapper") {
3324 return make_element_by_type<army_groups_list_wrapper>(
state,
id);
3332 std::unique_ptr<element_base> make_child(
sys::state&
state, std::string_view
name, dcon::gui_def_id
id)
noexcept override {
3333 if(
name ==
"alice_battleplanner_add_selected") {
3334 return make_element_by_type<add_selected_units_to_army_group_button>(
state,
id);
3335 }
if(
name ==
"alice_battleplanner_remove_selected") {
3336 return make_element_by_type<remove_selected_units_from_army_group_button>(
state,
id);
3346 if(
name ==
"alice_armygroup_defend_button") {
3347 return make_element_by_type<toggle_defend_order_button>(
state,
id);
3348 }
else if(
name ==
"alice_armygroup_enforce_control_button") {
3349 return make_element_by_type<toggle_enforce_control_order_button>(
state,
id);
3350 }
else if(
name ==
"alice_armygroup_naval_travel_origin_button") {
3351 return make_element_by_type<toggle_ferry_origin_order_button>(
state,
id);
3352 }
else if(
name ==
"alice_armygroup_go_to_selection") {
3353 return make_element_by_type<go_to_battleplanner_selection_button>(
state,
id);
3363 if(
name ==
"alice_army_group_regiments_list_header") {
3364 return make_element_by_type<army_group_details_window_header>(
state,
id);
3366 if(
name ==
"alice_army_group_control") {
3367 return make_element_by_type<army_group_control_window>(
state,
id);
3369 if(
name ==
"alice_army_group_unit_listbox_wrapper") {
3370 return make_element_by_type<army_group_details_window_body>(
state,
id);
dcon::text_key get_name() noexcept
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
void on_update(sys::state &state) noexcept override
std::string_view get_row_element_name() override
void on_update(sys::state &state) noexcept override
void add_child_to_front(std::unique_ptr< element_base > child) noexcept final
void move_child_to_front(element_base *child) noexcept final
void impl_on_update(sys::state &state) noexcept override
virtual message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept
virtual message_result get(sys::state &state, Cyto::Any &payload) noexcept
virtual void on_update(sys::state &state) noexcept
virtual void impl_on_update(sys::state &state) noexcept
virtual void impl_render(sys::state &state, int32_t x, int32_t y) noexcept
message_result impl_get(sys::state &state, Cyto::Any &payload) noexcept
virtual void on_create(sys::state &state) noexcept
void set_visible(sys::state &state, bool vis)
virtual mouse_probe impl_probe_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept
void render(sys::state &state, int32_t x, int32_t y) noexcept override
std::vector< dcon::regiment_id > row_contents
void update(sys::state &state)
void on_create(sys::state &state) noexcept override
army_group_unit_type_info_grid_row content
void on_update(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
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
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
dcon::gfx_object_id default_img
void button_action(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
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
tooltip_behavior has_tooltip(sys::state &state) noexcept override
bool is_active(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept 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
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
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_create(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
text::layout internal_layout
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
void on_update(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) 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 on_update(sys::state &state) 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 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
void button_action(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) 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 button_action(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
bool is_active(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
std::string_view get_row_element_name() override
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) 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
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) 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 button_action(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
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
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
void on_update(sys::state &state) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) 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
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_create(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 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
dcon::gfx_object_id default_img
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void button_action(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
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
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
window_element_base * reorg_window
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
window_element_base * combat_window
void on_update(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 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
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
army_group_unit_type_info_optional display_unit
void impl_render(sys::state &state, int32_t x, int32_t y) noexcept override
mouse_probe impl_probe_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) 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 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
std::array< unit_type_grid_item *, 3 > grid_items
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_create(sys::state &state) noexcept override
void mark_ships_to_split(sys::state &state, dcon::nation_id source, std::array< dcon::ship_id, num_packed_units > const &list)
constexpr size_t num_packed_units
bool can_change_unit_type(sys::state &state, dcon::nation_id source, dcon::regiment_id regiments[num_packed_units], dcon::ship_id ships[num_packed_units], dcon::unit_type_id new_type)
bool can_change_admiral(sys::state &state, dcon::nation_id source, dcon::navy_id a, dcon::leader_id l)
void toggle_rebel_hunting(sys::state &state, dcon::nation_id source, dcon::army_id a)
bool can_change_general(sys::state &state, dcon::nation_id source, dcon::army_id a, dcon::leader_id l)
bool can_delete_army(sys::state &state, dcon::nation_id source, dcon::army_id a)
void mark_regiments_to_split(sys::state &state, dcon::nation_id source, std::array< dcon::regiment_id, num_packed_units > const &list)
void evenly_split_army(sys::state &state, dcon::nation_id source, dcon::army_id a)
bool can_evenly_split_army(sys::state &state, dcon::nation_id source, dcon::army_id a)
bool can_evenly_split_navy(sys::state &state, dcon::nation_id source, dcon::navy_id a)
bool can_disband_undermanned_regiments(sys::state &state, dcon::nation_id source, dcon::army_id a)
void disband_undermanned_regiments(sys::state &state, dcon::nation_id source, dcon::army_id a)
bool can_merge_navies(sys::state &state, dcon::nation_id source, dcon::navy_id a, dcon::navy_id b)
bool can_split_navy(sys::state &state, dcon::nation_id source, dcon::navy_id a)
bool can_delete_navy(sys::state &state, dcon::nation_id source, dcon::navy_id a)
bool can_split_army(sys::state &state, dcon::nation_id source, dcon::army_id a)
void evenly_split_navy(sys::state &state, dcon::nation_id source, dcon::navy_id a)
bool can_merge_armies(sys::state &state, dcon::nation_id source, dcon::army_id a, dcon::army_id b)
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
int32_t free_transport_capacity(sys::state &state, dcon::navy_id n)
float effective_army_speed(sys::state &state, dcon::army_id a)
float attrition_amount(sys::state &state, dcon::navy_id a)
economy::commodity_set get_required_supply(sys::state &state, dcon::nation_id owner, dcon::army_id army)
bool can_embark_onto_sea_tile(sys::state &state, dcon::nation_id from, dcon::province_id p, dcon::army_id a)
bool will_recieve_attrition(sys::state &state, dcon::navy_id a)
float effective_navy_speed(sys::state &state, dcon::navy_id n)
int32_t transport_capacity(sys::state &state, dcon::navy_id n)
void render_tinted_subsprite(sys::state const &state, int frame, int total_frames, float x, float y, float width, float height, float r, float g, float b, GLuint texture_handle, ui::rotation rot, bool flipped, bool rtl)
GLuint get_texture_handle(sys::state &state, dcon::texture_id id, bool keep_data)
void render_tinted_textured_rect(sys::state const &state, float x, float y, float width, float height, float r, float g, float b, GLuint texture_handle, ui::rotation rot, bool flipped, bool rtl)
uint32_t reduce(uint32_t value_in, uint32_t upper_bound)
uint64_t get_random(sys::state const &state, uint32_t value_in)
void selected_ships_add(sys::state &state, dcon::ship_id sh)
void selected_ships_clear(sys::state &state)
float blue_from_int(uint32_t v)
float green_from_int(uint32_t v)
void selected_regiments_clear(sys::state &state)
uint32_t pack_color(float r, float g, float b)
float red_from_int(uint32_t v)
void selected_regiments_add(sys::state &state, dcon::regiment_id reg)
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)
std::string get_name_as_string(sys::state &state, T t)
layout_box open_layout_box(layout_base &dest, int32_t indent)
void add_unparsed_text_to_layout_box(sys::state &state, layout_base &dest, layout_box &box, std::string_view sv, substitution_map const &mp)
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)
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_line_break_to_layout(sys::state &state, columnar_layout &dest)
void add_to_substitution_map(substitution_map &mp, variable_type key, substitution value)
std::string format_wholenum(int32_t num)
ankerl::unordered_dense::map< uint32_t, substitution > substitution_map
std::string produce_simple_string(sys::state const &state, dcon::text_key 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)
void open_leader_selection(sys::state &state, dcon::army_id a, dcon::navy_id v, int32_t x, int32_t y)
std::array< army_group_unit_type_info_optional, 3 > army_group_unit_type_info_grid_row
void send(sys::state &state, element_base *parent, T value)
std::variant< std::monostate, army_group_unit_type_info > army_group_unit_type_info_optional
void display_leader_full(sys::state &state, dcon::leader_id lid, text::layout_base &contents, int32_t indent)
xy_pair get_absolute_non_mirror_location(sys::state &state, element_base const &node)
void active_modifiers_description(sys::state &state, text::layout_base &layout, dcon::nation_id n, int32_t identation, dcon::national_modifier_value nmid, bool header)
static constexpr uint32_t set_size
Holds important data about the game world, state, and other data regarding windowing,...
bool operator!=(army_group_unit_type_info const &o) const
bool operator==(army_group_unit_type_info const &o) const
element_type get_element_type() const
rotation get_rotation() const
union ui::element_data::internal_data data
dcon::gfx_object_id gfx_object
std::vector< sys::macro_builder_template > templates
ankerl::unordered_dense::map< dcon::text_key, element_target, hash_text_key > defs_by_name