3#include "dcon_generated.hpp"
30 void render(
sys::state&
state, int32_t x, int32_t y)
noexcept override {
59 void render(
sys::state&
state, int32_t x, int32_t y)
noexcept override {
71 auto prov = retrieve<dcon::province_id>(
state,
parent);
111 if(
name ==
"level1") {
112 auto ptr = make_element_by_type<port_level_bar>(
state,
id);
115 }
else if(
name ==
"level2") {
116 auto ptr = make_element_by_type<port_level_bar>(
state,
id);
119 }
else if(
name ==
"level3") {
120 auto ptr = make_element_by_type<port_level_bar>(
state,
id);
123 }
else if(
name ==
"level4") {
124 auto ptr = make_element_by_type<port_level_bar>(
state,
id);
127 }
else if(
name ==
"level5") {
128 auto ptr = make_element_by_type<port_level_bar>(
state,
id);
131 }
else if(
name ==
"level6") {
132 auto ptr = make_element_by_type<port_level_bar>(
state,
id);
135 }
else if(
name ==
"ship_count") {
136 return make_element_by_type<port_ship_count<true>>(
state, id);
137 }
else if(
name ==
"port_minimized") {
138 return make_element_by_type<port_sm_bg<true>>(
state, id);
139 }
else if(
name ==
"port_expanded") {
140 return make_element_by_type<port_ex_bg<true>>(
state, id);
141 }
else if(
name ==
"port_collapsed_small") {
142 return make_element_by_type<port_ex_bg<false>>(
state, id);
143 }
else if(
name ==
"port_collapsed_small_icon") {
144 return make_element_by_type<port_sm_bg<false>>(
state, id);
145 }
else if(
name ==
"collapsed_ship_count") {
146 return make_element_by_type<port_ship_count<false>>(
state, id);
155 auto adj =
state.world.get_province_adjacency_by_province_pair(p,
state.world.province_get_port_to(p));
157 auto id = adj.index();
158 auto& border =
state.map_state.map_data.borders[id];
159 auto& vertex =
state.map_state.map_data.border_vertices[border.start_index + border.count / 2];
161 map_x = vertex.position.x;
162 map_y = vertex.position.y;
177 auto controller =
state.world.province_get_nation_from_province_control(
port_for);
178 if(controller ==
state.local_player_nation) {
188 bool player_navy =
false;
189 bool allied_navy =
false;
190 bool enemy_navy =
false;
191 bool selected_navy =
false;
193 auto controller = n.get_navy().get_controller_from_navy_control();
194 if(
state.is_selected(n.get_navy())) {
195 selected_navy =
true;
196 }
else if(controller ==
state.local_player_nation) {
204 auto srange = n.get_navy().get_navy_membership();
205 int32_t num_ships = int32_t(srange.end() - srange.begin());
211 }
else if(player_navy) {
213 }
else if(enemy_navy) {
215 }
else if(allied_navy) {
228 glm::vec2{ float(
state.x_size /
state.user_settings.ui_scale), float(
state.y_size /
state.user_settings.ui_scale) };
229 glm::vec2 screen_pos;
230 if(!
state.map_state.map_to_screen(
state, map_pos, screen_size, screen_pos)) {
240 auto new_position =
xy_pair{ int16_t(screen_pos.x), int16_t(screen_pos.y) };
247 if(payload.holds_type<dcon::province_id>()) {
248 payload.emplace<dcon::province_id>(
port_for);
253 }
else if(payload.holds_type<int32_t>()) {
257 auto with_shift = any_cast<toggle_unit_grid>(payload).with_shift;
262 state.selected_armies.clear();
263 state.selected_navies.clear();
265 for(
auto n :
state.world.province_get_navy_location(
port_for)) {
266 state.deselect(n.get_navy().id);
271 state.selected_armies.clear();
272 state.selected_navies.clear();
275 for(
auto n :
state.world.province_get_navy_location(
port_for)) {
277 state.select(n.get_navy().id);
281 state.map_state.set_selected_province(dcon::province_id{});
333 auto prov = retrieve<dcon::province_id>(
state,
parent);
341 if(
name ==
"progress") {
342 return make_element_by_type<prov_map_siege_bar>(
state,
id);
374 auto prov = retrieve<dcon::province_id>(
state,
parent);
375 for(
auto b :
state.world.province_get_land_battle_location(prov)) {
376 auto w = b.get_battle().get_war_from_land_battle_in_war();
379 win->
battle = b.get_battle();
386 state.map_state.set_selected_province(dcon::province_id{});
395 win->
battle = b.get_battle();
402 state.map_state.set_selected_province(dcon::province_id{});
411 for(
auto b :
state.world.province_get_naval_battle_location(prov)) {
412 auto w = b.get_battle().get_war_from_naval_battle_in_war();
416 win->
battle = b.get_battle();
423 state.map_state.set_selected_province(dcon::province_id{});
467 if(player_involved_battle && player_is_attacker) {
469 }
else if (player_involved_battle && !player_is_attacker) {
473 if(player_involved_battle && player_is_attacker) {
475 }
else if(player_involved_battle && !player_is_attacker) {
505 if (player_involved_battle && player_is_attacker)
507 else if (player_involved_battle && !player_is_attacker)
510 if (player_involved_battle && player_is_attacker)
512 else if (player_involved_battle && !player_is_attacker)
521 if(
name ==
"progress") {
522 return make_element_by_type<prov_map_battle_bar>(
state,
id);
523 }
else if(
name ==
"overlay_right") {
524 return make_element_by_type<prov_map_br_overlay>(
state,
id);
525 }
else if(
name ==
"defender_casualties") {
526 return make_element_by_type <tl_defender_casualties>(
state,
id);
527 }
else if(
name ==
"attacker_casualties") {
528 return make_element_by_type <tl_attacker_casualties>(
state,
id);
614 strength *=
state.defines.pop_size_per_regiment;
615 strength = floor(strength);
624 if(payload.holds_type<dcon::nation_id>()) {
629 payload.emplace<dcon::nation_id>(dcon::nation_id{});
631 }
else if(payload.holds_type<dcon::rebel_faction_id>()) {
636 payload.emplace<dcon::rebel_faction_id>(dcon::rebel_faction_id{});
646 if(
name ==
"controller_flag") {
647 return make_element_by_type<tr_controller_flag>(
state,
id);
648 }
else if(
name ==
"strength") {
649 return make_element_by_type<tr_strength>(
state,
id);
650 }
else if(
name ==
"dig_in") {
651 return make_element_by_type<tr_dig_in>(
state,
id);
652 }
else if(
name ==
"status") {
653 return make_element_by_type<tr_status>(
state,
id);
654 }
else if(
name ==
"org_bar") {
655 return make_element_by_type<tr_org_bar>(
state,
id);
656 }
else if(
name ==
"edge1") {
657 auto ptr = make_element_by_type<tr_edge>(
state,
id);
660 }
else if(
name ==
"edge2") {
661 auto ptr = make_element_by_type<tr_edge>(
state,
id);
664 }
else if(
name ==
"edge3") {
665 auto ptr = make_element_by_type<tr_edge>(
state,
id);
668 }
else if(
name ==
"edge4") {
669 auto ptr = make_element_by_type<tr_edge>(
state,
id);
672 }
else if(
name ==
"frame_bg") {
673 return make_element_by_type<tr_frame_bg>(
state,
id);
694 if(
name ==
"controller_flag") {
695 return make_element_by_type<tr_controller_flag>(
state,
id);
696 }
else if(
name ==
"strength") {
697 return make_element_by_type<tr_strength>(
state,
id);
698 }
else if(
name ==
"frame_bg") {
699 return make_element_by_type<tr_frame_bg>(
state,
id);
785 strength *=
state.defines.pop_size_per_regiment;
786 strength = floor(strength);
858 if(payload.holds_type<dcon::nation_id>()) {
863 payload.emplace<dcon::nation_id>(dcon::nation_id{});
865 }
else if(payload.holds_type<dcon::rebel_faction_id>()) {
870 payload.emplace<dcon::rebel_faction_id>(dcon::rebel_faction_id{});
902 return dcon::national_identity_id{};
907 std::unique_ptr<element_base> make_child(
sys::state&
state, std::string_view
name, dcon::gui_def_id
id)
noexcept override {
908 if(
name ==
"controller_flag") {
909 return make_element_by_type<tl_controller_flag>(
state,
id);
910 }
else if(
name ==
"strength") {
911 return make_element_by_type<tl_strength>(
state,
id);
912 }
else if(
name ==
"unit_1") {
913 return make_element_by_type<tl_unit_1>(
state,
id);
914 }
else if(
name ==
"unit_2") {
915 return make_element_by_type<tl_unit_2>(
state,
id);
916 }
else if(
name ==
"dig_in") {
917 return make_element_by_type<tl_dig_in>(
state,
id);
918 }
else if(
name ==
"status") {
919 return make_element_by_type<tl_status>(
state,
id);
920 }
else if(
name ==
"org_bar") {
921 return make_element_by_type<tl_org_bar>(
state,
id);
922 }
else if(
name ==
"edge1") {
923 auto ptr = make_element_by_type<tl_edge>(
state,
id);
926 }
else if(
name ==
"edge2") {
927 auto ptr = make_element_by_type<tl_edge>(
state,
id);
930 }
else if(
name ==
"edge3") {
931 auto ptr = make_element_by_type<tl_edge>(
state,
id);
934 }
else if(
name ==
"edge4") {
935 auto ptr = make_element_by_type<tl_edge>(
state,
id);
938 }
else if(
name ==
"frame_bg") {
939 return make_element_by_type<tl_frame_bg>(
state,
id);
951 void impl_render(
sys::state&
state, int32_t x, int32_t y)
noexcept override {
958 std::unique_ptr<element_base> make_child(
sys::state&
state, std::string_view
name, dcon::gui_def_id
id)
noexcept override {
959 if(
name ==
"controller_flag") {
960 return make_element_by_type<tl_sm_controller_flag>(
state,
id);
961 }
else if(
name ==
"strength") {
962 return make_element_by_type<tl_strength>(
state,
id);
963 }
else if(
name ==
"frame_bg") {
964 return make_element_by_type<tl_frame_bg>(
state,
id);
976 void impl_render(
sys::state&
state, int32_t x, int32_t y)
noexcept override {
1006 std::unique_ptr<element_base> make_child(
sys::state&
state, std::string_view
name, dcon::gui_def_id
id)
noexcept override {
1007 if(
name ==
"frame_bg") {
1008 return make_element_by_type<select_army_group_button>(
state,
id);
1022 if(payload.
holds_type<dcon::automated_army_group_id>()) {
1023 payload.
emplace<dcon::automated_army_group_id>(retrieve<dcon::automated_army_group_id>(
state,
parent));
1035 dcon::automated_army_group_id
info {};
1049 if(
name ==
"main_army_group_icon") {
1050 auto ptr = make_element_by_type<army_group_icon>(
state,
id);
1062 if(c->is_visible()) {
1063 c->impl_on_update(
state);
1071 state.world.for_each_automated_army_group([&](dcon::automated_army_group_id item) {
1072 auto hq =
state.world.automated_army_group_get_hq(item);
1082 auto mid_point =
state.world.province_get_mid_point(
prov);
1083 auto map_pos =
state.map_state.normalize_map_coord(mid_point);
1084 auto screen_size = glm::vec2{ float(
state.x_size /
state.user_settings.ui_scale), float(
state.y_size /
state.user_settings.ui_scale) };
1085 glm::vec2 screen_pos;
1086 if(!
state.map_state.map_to_screen(
state, map_pos, screen_size, screen_pos)) {
1096 auto new_position =
xy_pair{ int16_t(screen_pos.x), int16_t(screen_pos.y) };
1103 if(payload.holds_type<dcon::automated_army_group_id>()) {
1104 if(
populated) payload.emplace<dcon::automated_army_group_id>(
info);
1127 if(
name ==
"top_unit_icon") {
1128 auto ptr = make_element_by_type<top_unit_icon>(
state,
id);
1131 }
else if(
name ==
"top_right_unit_icon") {
1132 auto ptr = make_element_by_type<top_right_unit_icon>(
state,
id);
1135 }
else if(
name ==
"small_top_unit_icon") {
1136 auto ptr = make_element_by_type<small_top_unit_icon>(
state,
id);
1139 }
else if(
name ==
"small_top_right_unit_icon") {
1140 auto ptr = make_element_by_type<small_top_right_unit_icon>(
state,
id);
1143 }
else if(
name ==
"siege") {
1144 auto ptr = make_element_by_type<map_siege>(
state,
id);
1147 }
else if(
name ==
"battle") {
1148 auto ptr = make_element_by_type<map_battle>(
state,
id);
1162 if(c->is_visible()) {
1163 c->impl_on_update(
state);
1170 bool found_selected =
false;
1171 bool all_selected =
true;
1172 bool found_ally =
false;
1173 bool found_enemy =
false;
1174 bool found_other =
false;
1176 if(
prov.index() <
state.province_definitions.first_sea_province.index()) {
1178 for(
auto a :
state.world.province_get_army_location(
prov)) {
1179 if(!(a.get_army().get_navy_from_army_transport())) {
1181 auto controller = a.get_army().get_controller_from_army_control().id;
1183 if(
state.is_selected(a.get_army()) && controller ==
state.local_player_nation)
1184 found_selected =
true;
1185 else if(controller ==
state.local_player_nation)
1186 all_selected =
false;
1208 auto controller = n.get_navy().get_controller_from_navy_control().id;
1209 if(
state.is_selected(n.get_navy()) && controller ==
state.local_player_nation)
1210 found_selected =
true;
1211 else if(controller ==
state.local_player_nation)
1212 all_selected =
false;
1227 bool player_involved_battle =
false;
1228 dcon::land_battle_id lbattle;
1229 dcon::naval_battle_id nbattle;
1230 for(
auto b :
state.world.province_get_land_battle_location(
prov)) {
1231 auto w = b.get_battle().get_war_from_land_battle_in_war();
1233 player_involved_battle =
true;
1234 lbattle = b.get_battle();
1238 player_involved_battle =
true;
1240 lbattle = b.get_battle();
1244 if(!player_involved_battle) {
1245 for(
auto b :
state.world.province_get_naval_battle_location(
prov)) {
1246 auto w = b.get_battle().get_war_from_naval_battle_in_war();
1248 player_involved_battle =
true;
1249 nbattle = b.get_battle();
1257 if(found_selected) {
1265 if(!player_involved_battle) {
1280 static std::vector<int32_t> by_icon_count;
1281 for(
auto& i : by_icon_count)
1305 float max_str = 0.0f;
1306 float max_opp_str = 0.0f;
1307 int32_t total_count = 0;
1308 int32_t total_opp_count = 0;
1310 auto w =
state.world.land_battle_get_war_from_land_battle_in_war(lbattle);
1313 bool land_battle_attacker_is_player =
false;
1314 if (player_is_attacker &&
state.world.land_battle_get_war_attacker_is_attacker(lbattle))
1315 land_battle_attacker_is_player =
true;
1316 else if (!player_is_attacker && !
state.world.land_battle_get_war_attacker_is_attacker(lbattle))
1317 land_battle_attacker_is_player =
true;
1326 for(
auto ar :
state.world.land_battle_get_army_battle_participation(lbattle)) {
1327 auto controller = ar.get_army().get_controller_from_army_control();
1332 for(
auto m :
state.world.army_get_army_membership(ar.get_army())) {
1335 str += m.get_regiment().get_strength();
1340 auto dig_in = ar.get_army().get_dig_in();
1347 if(str > max_opp_str) {
1354 for(
auto m :
state.world.army_get_army_membership(ar.get_army())) {
1355 auto icon =
state.military_definitions.unit_base_definitions[m.get_regiment().get_type()].icon - 1;
1356 if(
uint32_t(icon) >= by_icon_count.size()) {
1357 by_icon_count.resize(icon + 1, 0);
1359 ++(by_icon_count[icon]);
1362 str += m.get_regiment().get_strength();
1367 auto dig_in = ar.get_army().get_dig_in();
1388 for(
auto reg :
state.world.land_battle_get_reserves(lbattle)) {
1395 auto& att_back =
state.world.land_battle_get_attacker_back_line(lbattle);
1396 auto& def_back =
state.world.land_battle_get_defender_back_line(lbattle);
1397 auto& att_front =
state.world.land_battle_get_attacker_front_line(lbattle);
1398 auto& def_front =
state.world.land_battle_get_defender_front_line(lbattle);
1399 for(
auto r : att_back) {
1403 for(
auto r : att_front) {
1407 for(
auto r : def_back) {
1411 for(
auto r : def_front) {
1415 if(
state.world.land_battle_get_war_attacker_is_attacker(lbattle) == player_is_attacker) {
1429 float max_str = 0.0f;
1430 float max_opp_str = 0.0f;
1431 int32_t total_count = 0;
1432 int32_t total_opp_count = 0;
1434 auto w =
state.world.naval_battle_get_war_from_naval_battle_in_war(nbattle);
1439 for(
auto ar :
state.world.naval_battle_get_navy_battle_participation(nbattle)) {
1440 auto controller = ar.get_navy().get_controller_from_navy_control();
1445 for(
auto m :
state.world.navy_get_navy_membership(ar.get_navy())) {
1448 str += m.get_ship().get_strength();
1453 if(str > max_opp_str) {
1460 for(
auto m :
state.world.navy_get_navy_membership(ar.get_navy())) {
1461 auto icon =
state.military_definitions.unit_base_definitions[m.get_ship().get_type()].icon - 1;
1462 if(
uint32_t(icon) >= by_icon_count.size()) {
1463 by_icon_count.resize(icon + 1, 0);
1465 ++(by_icon_count[icon]);
1468 str += m.get_ship().get_strength();
1484 int32_t attacker_ships = 0;
1485 int32_t defender_ships = 0;
1487 auto slots =
state.world.naval_battle_get_slots(nbattle);
1489 for(
uint32_t j = slots.size(); j-- > 0;) {
1505 if(
state.world.naval_battle_get_war_attacker_is_attacker(nbattle) == player_is_attacker) {
1518 else if(
prov.index() <
state.province_definitions.first_sea_province.index()) {
1519 std::function<bool(dcon::army_id)> filter;
1524 filter = [&](dcon::army_id a) {
return state.world.army_get_controller_from_army_control(a) ==
state.local_player_nation &&
state.is_selected(a); };
1528 filter = [&](dcon::army_id a) {
return state.world.army_get_controller_from_army_control(a) ==
state.local_player_nation && !
state.is_selected(a); };
1530 filter = [&](dcon::army_id a) {
1531 auto n =
state.world.army_get_controller_from_army_control(a);
1535 filter = [&](dcon::army_id a) {
1536 auto n =
state.world.army_get_controller_from_army_control(a);
1540 filter = [&](dcon::army_id a) {
1541 auto n =
state.world.army_get_controller_from_army_control(a);
1546 float max_str = 0.0f;
1548 int32_t total_count = 0;
1551 for(
auto a :
state.world.province_get_army_location(
prov)) {
1552 if(!(a.get_army().get_navy_from_army_transport()) && filter(a.get_army())) {
1555 for(
auto m :
state.world.army_get_army_membership(a.get_army())) {
1556 auto icon =
state.military_definitions.unit_base_definitions[m.get_regiment().get_type()].icon - 1;
1557 icon = std::max(icon, 0);
1558 if(
uint32_t(icon) >= by_icon_count.size()) {
1559 by_icon_count.resize(icon + 1, 0);
1561 ++(by_icon_count[icon]);
1564 str += m.get_regiment().get_strength();
1579 auto dig_in = a.get_army().get_dig_in();
1608 std::function<bool(dcon::navy_id)> filter;
1613 filter = [&](dcon::navy_id a) {
return state.world.navy_get_controller_from_navy_control(a) ==
state.local_player_nation &&
state.is_selected(a); };
1616 filter = [&](dcon::navy_id a) {
return state.world.navy_get_controller_from_navy_control(a) ==
state.local_player_nation && !
state.is_selected(a); };
1618 filter = [&](dcon::navy_id a) {
1619 auto n =
state.world.navy_get_controller_from_navy_control(a);
1623 filter = [&](dcon::navy_id a) {
1624 auto n =
state.world.navy_get_controller_from_navy_control(a);
1628 filter = [&](dcon::navy_id a) {
1629 auto n =
state.world.navy_get_controller_from_navy_control(a);
1634 float max_str = 0.0f;
1635 int32_t total_count = 0;
1638 for(
auto a :
state.world.province_get_navy_location(
prov)) {
1639 if(filter(a.get_navy())) {
1642 for(
auto m :
state.world.navy_get_navy_membership(a.get_navy())) {
1643 auto icon =
state.military_definitions.unit_base_definitions[m.get_ship().get_type()].icon - 1;
1644 if(
uint32_t(icon) >= by_icon_count.size()) {
1645 by_icon_count.resize(icon + 1, 0);
1647 ++(by_icon_count[icon]);
1650 str += m.get_ship().get_strength();
1687 int32_t max_index = 0;
1688 for(
uint32_t i = 1; i < by_icon_count.size(); ++i) {
1689 if(by_icon_count[i] > by_icon_count[max_index])
1690 max_index = int32_t(i);
1694 if(by_icon_count.size() > 0) {
1695 by_icon_count[max_index] = 0;
1697 for(
uint32_t i = 1; i < by_icon_count.size(); ++i) {
1698 if(by_icon_count[i] > by_icon_count[max_index])
1699 max_index = int32_t(i);
1701 if(by_icon_count[max_index] > 0)
1710 auto mid_point =
state.world.province_get_mid_point(
prov);
1711 auto map_pos =
state.map_state.normalize_map_coord(mid_point);
1712 auto screen_size = glm::vec2{ float(
state.x_size /
state.user_settings.ui_scale), float(
state.y_size /
state.user_settings.ui_scale) };
1713 glm::vec2 screen_pos;
1714 if(!
state.map_state.map_to_screen(
state, map_pos, screen_size, screen_pos)) {
1724 auto new_position =
xy_pair{ int16_t(screen_pos.x), int16_t(screen_pos.y) };
1731 if(payload.holds_type<dcon::province_id>()) {
1732 payload.emplace<dcon::province_id>(
prov);
1738 auto with_shift = any_cast<toggle_unit_grid>(payload).with_shift;
1743 state.selected_armies.clear();
1744 state.selected_navies.clear();
1746 if(
prov.index() >=
state.province_definitions.first_sea_province.index()) {
1747 for(
auto n :
state.world.province_get_navy_location(
prov)) {
1748 state.deselect(n.get_navy().id);
1751 for(
auto n :
state.world.province_get_army_location(
prov)) {
1752 state.deselect(n.get_army().id);
1758 state.selected_armies.clear();
1759 state.selected_navies.clear();
1762 if(
prov.index() >=
state.province_definitions.first_sea_province.index()) {
1763 for(
auto n :
state.world.province_get_navy_location(
prov)) {
1765 state.select(n.get_navy().id);
1769 state.map_state.set_selected_province(dcon::province_id{});
1774 for(
auto n :
state.world.province_get_army_location(
prov)) {
1775 if(!(n.get_army().get_navy_from_army_transport()) ) {
1776 state.select(n.get_army().id);
1780 state.map_state.set_selected_province(dcon::province_id{});
1788 int32_t height = 60;
1836 auto p = retrieve<dcon::province_id>(
state,
parent);
1843 auto p = retrieve<dcon::province_id>(
state,
parent);
1896 if(
name ==
"capital_icon") {
1897 auto ptr = make_element_by_type<image_element_base>(
state,
id);
1900 }
else if(
name ==
"rail_icon") {
1901 auto ptr = make_element_by_type<image_element_base>(
state,
id);
1904 }
else if(
name ==
"rail_dots") {
1905 auto ptr = make_element_by_type<map_pv_rail_dots>(
state,
id);
1908 }
else if(
name ==
"fort_icon") {
1909 auto ptr = make_element_by_type<image_element_base>(
state,
id);
1912 }
else if(
name ==
"fort_dots") {
1913 auto ptr = make_element_by_type<map_pv_fort_dots>(
state,
id);
1916 }
else if(
name ==
"bank_icon") {
1917 auto ptr = make_element_by_type<map_pv_bank>(
state,
id);
1920 }
else if(
name ==
"university_icon") {
1921 auto ptr = make_element_by_type<map_pv_university>(
state,
id);
1939 if(c->is_visible()) {
1940 c->impl_on_update(
state);
1947 if(
state.world.nation_get_capital(
state.world.province_get_nation_from_province_ownership(
prov)) ==
prov) {
1977 auto top = (-16 * rows) / 2;
1978 if(
state.world.nation_get_capital(
state.world.province_get_nation_from_province_ownership(
prov)) ==
prov) {
2029 auto mid_point =
state.world.province_get_mid_point(
prov);
2030 auto map_pos =
state.map_state.normalize_map_coord(mid_point);
2031 auto screen_size = glm::vec2{ float(
state.x_size /
state.user_settings.ui_scale), float(
state.y_size /
state.user_settings.ui_scale) };
2032 glm::vec2 screen_pos;
2034 if(!
state.map_state.map_to_screen(
state, map_pos, screen_size, screen_pos)) {
2039 if(screen_pos.x < -32 || screen_pos.y < -32 || screen_pos.x >
state.ui_state.
root->base_data.size.x + 32 || screen_pos.y >
state.ui_state.
root->base_data.size.y + 32) {
2049 auto new_position =
xy_pair{ int16_t(screen_pos.x), int16_t(screen_pos.y) };
2056 if(payload.holds_type<dcon::province_id>()) {
2057 payload.emplace<dcon::province_id>(
prov);
2072 auto mid_point =
state.world.province_get_mid_point(
content);
2073 auto map_pos =
state.map_state.normalize_map_coord(mid_point);
2075 glm::vec2{float(
state.x_size /
state.user_settings.ui_scale), float(
state.y_size /
state.user_settings.ui_scale)};
2076 glm::vec2 screen_pos;
2077 if(!
state.map_state.map_to_screen(
state, map_pos, screen_size, screen_pos))
2085 frame = int32_t(
state.world.commodity_get_icon(cid));
ANY_ALWAYS_INLINE bool holds_type() const noexcept
T & emplace(Args &&... args)
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void impl_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 impl_render(sys::state &state, int32_t x, int32_t y) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
dcon::automated_army_group_id info
void render(sys::state &state, int32_t x, int32_t y) noexcept override
std::vector< std::unique_ptr< element_base > > children
virtual message_result get(sys::state &state, Cyto::Any &payload) noexcept
virtual void impl_on_update(sys::state &state) noexcept
virtual void impl_render(sys::state &state, int32_t x, int32_t y) 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
void on_create(sys::state &state) noexcept override
dcon::land_battle_id battle
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
mouse_probe impl_probe_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
void impl_render(sys::state &state, int32_t x, int32_t y) 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 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
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
void impl_render(sys::state &state, int32_t x, int32_t y) noexcept override
dcon::naval_battle_id battle
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
mouse_probe impl_probe_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 impl_render(sys::state &state, int32_t x, int32_t y) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
void set_province(sys::state &state, dcon::province_id p)
dcon::province_id port_for
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) 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_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void impl_render(sys::state &state, int32_t x, int32_t y) 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
element_base * rails_icon
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
void impl_on_update(sys::state &state) noexcept override
mouse_probe impl_probe_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
element_base * capital_icon
element_base * rails_dots
void on_update(sys::state &state) noexcept override
dcon::province_id content
void impl_render(sys::state &state, int32_t x, int32_t y) noexcept override
void set_text(sys::state &state, std::string const &new_text)
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
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
void on_update(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
mouse_probe impl_probe_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 render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
void 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_shift_action(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
dcon::national_identity_id get_current_nation(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 render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
mouse_probe impl_probe_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
void impl_render(sys::state &state, int32_t x, int32_t y) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
void on_update(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(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
element_base * small_top_icon
element_base * top_right_icon
mouse_probe impl_probe_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
element_base * small_top_right_icon
void impl_render(sys::state &state, int32_t x, int32_t y) noexcept override
void impl_on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
top_display_parameters display
void on_create(sys::state &state) noexcept override
#define assert(condition)
bool are_allied_in_war(sys::state const &state, dcon::nation_id a, dcon::nation_id b)
war_role get_role(sys::state const &state, dcon::war_id w, dcon::nation_id n)
bool is_attacker(sys::state &state, dcon::war_id w, dcon::nation_id n)
bool are_at_war(sys::state const &state, dcon::nation_id a, dcon::nation_id b)
constexpr uint16_t to_map_id(dcon::province_id id)
void play_interface_sound(sys::state &state, audio_instance &s, float volume)
audio_instance & get_click_sound(sys::state &state)
std::string prettify(int64_t num)
constexpr float prov_details_cutoff
int32_t status_frame(sys::state &state, dcon::army_id a)
void send(sys::state &state, element_base *parent, T value)
void populate_unit_tooltip(sys::state &state, text::columnar_layout &contents, dcon::province_id prov)
constexpr float big_counter_cutoff
xy_pair get_absolute_non_mirror_location(sys::state &state, element_base const &node)
static constexpr uint16_t is_attacking
static constexpr uint16_t mode_engaged
static constexpr uint16_t mode_approaching
static constexpr uint16_t mode_seeking
static constexpr uint16_t mode_retreating
static constexpr uint16_t mode_mask
static constexpr uint16_t is_attacking
std::unique_ptr< grid_box > unit_details_box
std::unique_ptr< element_base > root
element_base * naval_combat_window
element_base * province_window
element_base * army_combat_window
float defender_casualties
dcon::rebel_faction_id top_left_rebel
float top_right_org_value
dcon::nation_id top_left_nation
dcon::nation_id top_right_nation
std::array< outline_color, 5 > colors
dcon::rebel_faction_id top_right_rebel
bool player_involved_battle
float attacker_casualties