11 dcon::gfx_object_id def;
17 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
18 auto lid =
state.world.land_battle_get_general_from_attacking_general(b);
25 auto owner =
state.world.leader_get_nation_from_leader_loyalty(lid);
26 auto pculture =
state.world.nation_get_primary_culture(owner);
27 auto ltype = pculture.get_group_from_culture_group_membership().get_leader();
30 auto grange = ltype.get_generals();
31 if(grange.size() > 0) {
44 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
45 auto lid =
state.world.land_battle_get_general_from_attacking_general(b);
54 dcon::gfx_object_id def;
60 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
61 auto lid =
state.world.land_battle_get_general_from_defending_general(b);
68 auto owner =
state.world.leader_get_nation_from_leader_loyalty(lid);
69 auto pculture =
state.world.nation_get_primary_culture(owner);
70 auto ltype = pculture.get_group_from_culture_group_membership().get_leader();
73 auto grange = ltype.get_generals();
74 if(grange.size() > 0) {
87 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
88 auto lid =
state.world.land_battle_get_general_from_defending_general(b);
100 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
101 auto lid =
state.world.land_battle_get_general_from_attacking_general(b);
104 auto name =
state.to_string_view(
state.world.leader_get_name(lid));
114 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
115 auto lid =
state.world.land_battle_get_general_from_defending_general(b);
118 auto name =
state.to_string_view(
state.world.leader_get_name(lid));
130 dcon::gfx_object_id gid;
137 auto& gfx_def =
state.ui_defs.gfx[gid];
139 auto& mask_tex =
state.open_gl.asset_textures[dcon::texture_id(gfx_def.type_dependent - 1)];
142 gfx_def.is_vertically_flipped(),
154 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
156 return state.world.nation_get_identity_from_identity_holder(n);
162 dcon::gfx_object_id gid;
169 auto& gfx_def =
state.ui_defs.gfx[gid];
171 auto& mask_tex =
state.open_gl.asset_textures[dcon::texture_id(gfx_def.type_dependent - 1)];
174 gfx_def.is_vertically_flipped(),
186 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
188 return state.world.nation_get_identity_from_identity_holder(n);
195 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
196 auto w =
state.world.land_battle_get_war_from_land_battle_in_war(b);
199 for(
auto a :
state.world.land_battle_get_army_battle_participation(b)) {
200 auto owner = a.get_army().get_controller_from_army_control();
201 bool battle_attacker =
false;
205 battle_attacker = !bool(owner) ==
state.world.land_battle_get_war_attacker_is_attacker(b);
207 if(battle_attacker ==
false) {
208 for(
auto r : a.get_army().get_army_membership()) {
210 total += r.get_regiment().get_org();
220 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
221 auto w =
state.world.land_battle_get_war_from_land_battle_in_war(b);
224 for(
auto a :
state.world.land_battle_get_army_battle_participation(b)) {
225 auto owner = a.get_army().get_controller_from_army_control();
226 bool battle_attacker =
false;
230 battle_attacker = !bool(owner) ==
state.world.land_battle_get_war_attacker_is_attacker(b);
232 if(battle_attacker ==
false) {
233 for(
auto r : a.get_army().get_army_membership()) {
235 total += r.get_regiment().get_strength();
245 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
246 auto w =
state.world.land_battle_get_war_from_land_battle_in_war(b);
249 for(
auto a :
state.world.land_battle_get_army_battle_participation(b)) {
250 auto owner = a.get_army().get_controller_from_army_control();
251 bool battle_attacker =
false;
255 battle_attacker = !bool(owner) ==
state.world.land_battle_get_war_attacker_is_attacker(b);
257 if(battle_attacker ==
true) {
258 for(
auto r : a.get_army().get_army_membership()) {
260 total += r.get_regiment().get_org();
270 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
271 auto w =
state.world.land_battle_get_war_from_land_battle_in_war(b);
274 for(
auto a :
state.world.land_battle_get_army_battle_participation(b)) {
275 auto owner = a.get_army().get_controller_from_army_control();
276 bool battle_attacker =
false;
280 battle_attacker = !bool(owner) ==
state.world.land_battle_get_war_attacker_is_attacker(b);
282 if(battle_attacker ==
true) {
283 for(
auto r : a.get_army().get_army_membership()) {
285 total += r.get_regiment().get_strength();
296 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
297 auto w =
state.world.land_battle_get_war_from_land_battle_in_war(b);
300 for(
auto a :
state.world.land_battle_get_army_battle_participation(b)) {
301 auto owner = a.get_army().get_controller_from_army_control();
302 bool battle_attacker =
false;
306 battle_attacker = !bool(owner) ==
state.world.land_battle_get_war_attacker_is_attacker(b);
308 if(battle_attacker ==
false) {
309 for(
auto r : a.get_army().get_army_membership()) {
311 total += r.get_regiment().get_org();
321 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
322 auto w =
state.world.land_battle_get_war_from_land_battle_in_war(b);
325 for(
auto a :
state.world.land_battle_get_army_battle_participation(b)) {
326 auto owner = a.get_army().get_controller_from_army_control();
327 bool battle_attacker =
false;
331 battle_attacker = !bool(owner) ==
state.world.land_battle_get_war_attacker_is_attacker(b);
333 if(battle_attacker ==
false) {
334 for(
auto r : a.get_army().get_army_membership()) {
336 total += r.get_regiment().get_strength();
346 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
347 auto w =
state.world.land_battle_get_war_from_land_battle_in_war(b);
350 for(
auto a :
state.world.land_battle_get_army_battle_participation(b)) {
351 auto owner = a.get_army().get_controller_from_army_control();
352 bool battle_attacker =
false;
356 battle_attacker = !bool(owner) ==
state.world.land_battle_get_war_attacker_is_attacker(b);
358 if(battle_attacker ==
true) {
359 for(
auto r : a.get_army().get_army_membership()) {
361 total += r.get_regiment().get_org();
371 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
372 auto w =
state.world.land_battle_get_war_from_land_battle_in_war(b);
375 for(
auto a :
state.world.land_battle_get_army_battle_participation(b)) {
376 auto owner = a.get_army().get_controller_from_army_control();
377 bool battle_attacker =
false;
381 battle_attacker = !bool(owner) ==
state.world.land_battle_get_war_attacker_is_attacker(b);
383 if(battle_attacker ==
true) {
384 for(
auto r : a.get_army().get_army_membership()) {
386 total += r.get_regiment().get_strength();
394template<
int32_t index>
403template<
bool IsAttacker, military::unit_type Type>
407 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
408 auto w =
state.world.land_battle_get_war_from_land_battle_in_war(b);
410 float full_total = 0.0f;
411 for(
auto a :
state.world.land_battle_get_army_battle_participation(b)) {
412 auto owner = a.get_army().get_controller_from_army_control();
413 bool battle_attacker =
false;
417 battle_attacker = !bool(owner) ==
state.world.land_battle_get_war_attacker_is_attacker(b);
419 if(battle_attacker == IsAttacker) {
420 for(
auto r : a.get_army().get_army_membership()) {
421 auto t = r.get_regiment().get_type();
424 total += r.get_regiment().get_strength();
433 if(full_total != 0.f && total != 0.f) {
434 if(total / full_total >= 0.75f) {
436 }
else if(total / full_total <= 0.25f) {
442 auto contents =
text::create_endless_layout(
state,
internal_layout,
text::layout_parameters{ 0, 0,
static_cast<int16_t
>(
base_data.
size.
x),
static_cast<int16_t
>(
base_data.
size.
y),
base_data.
data.
text.
font_handle, 0,
text::alignment::right,
text::text_color::white,
true });
527 if(
name ==
"modifier_icon") {
528 return make_element_by_type<lc_modifier_icon>(
state,
id);
529 }
else if(
name ==
"modifier_value") {
530 return make_element_by_type<lc_modifier_value>(
state,
id);
546 std::string_view get_row_element_name()
override {
547 return "alice_combat_modifier";
550 subwindow.
data = content;
555 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
556 auto both_dice =
state.world.land_battle_get_dice_rolls(b);
557 auto defender_mods =
state.world.land_battle_get_defender_bonus(b);
564 state.world.nation_get_has_gas_attack(defending_nation) && !
state.world.nation_get_has_gas_defense(attacking_nation);
566 auto defender_dice = (both_dice >> 4) & 0x0F;
568 auto location =
state.world.land_battle_get_location_from_land_battle_location(b);
569 auto terrain_bonus =
state.world.province_get_modifier_values(
location, sys::provincial_mod_offsets::defense);
571 auto defender_per =
state.world.leader_get_personality(
state.world.land_battle_get_general_from_defending_general(b));
572 auto defender_bg =
state.world.leader_get_background(
state.world.land_battle_get_general_from_defending_general(b));
575 int32_t(
state.world.leader_trait_get_defense(defender_per) +
state.world.leader_trait_get_defense(defender_bg));
578 if(dig_in_value != 0)
580 if(terrain_bonus != 0)
582 if(defence_bonus != 0)
591 std::string_view get_row_element_name()
override {
592 return "alice_combat_modifier";
595 subwindow.
data = content;
600 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
601 auto both_dice =
state.world.land_battle_get_dice_rolls(b);
602 auto defender_mods =
state.world.land_battle_get_defender_bonus(b);
609 state.world.nation_get_has_gas_attack(attacking_nation) && !
state.world.nation_get_has_gas_defense(defending_nation);
611 state.world.nation_get_has_gas_attack(defending_nation) && !
state.world.nation_get_has_gas_defense(attacking_nation);
613 int32_t crossing_adjustment =
616 auto attacker_dice = both_dice & 0x0F;
618 auto attacker_per =
state.world.leader_get_personality(
state.world.land_battle_get_general_from_attacking_general(b));
619 auto attacker_bg =
state.world.leader_get_background(
state.world.land_battle_get_general_from_attacking_general(b));
622 int32_t(
state.world.leader_trait_get_attack(attacker_per) +
state.world.leader_trait_get_attack(attacker_bg));
625 if(crossing_adjustment != 0)
627 if(attack_bonus != 0)
639 if(
name ==
"shield") {
640 return make_element_by_type<lc_defender_flag>(
state,
id);
641 }
else if(
name ==
"leader_icon") {
642 return make_element_by_type<lc_defending_leader_img>(
state,
id);
643 }
else if(
name ==
"leader_name") {
644 return make_element_by_type<lc_defending_leader_name>(
state,
id);
645 }
else if(
name ==
"morale") {
646 auto ptr = make_element_by_type<lc_defender_org>(
state,
id);
647 ptr->base_data.position.y -= 1;
649 }
else if(
name ==
"strength") {
650 auto ptr = make_element_by_type<lc_defender_str>(
state,
id);
651 ptr->base_data.position.y -= 1;
653 }
else if(
name ==
"morale_text") {
654 return make_element_by_type<lc_defender_org_txt>(
state,
id);
655 }
else if(
name ==
"strength_text") {
656 return make_element_by_type<lc_defender_str_txt>(
state,
id);
657 }
else if(
name ==
"unit_type_1") {
658 return make_element_by_type<lc_static_icon<0>>(
state, id);
659 }
else if(
name ==
"unit_type_2") {
660 return make_element_by_type<lc_static_icon<1>>(
state, id);
661 }
else if(
name ==
"unit_type_3") {
662 return make_element_by_type<lc_static_icon<2>>(
state, id);
663 }
else if(
name ==
"unit_type_1_value") {
664 return make_element_by_type<lc_unit_strength_txt<false, military::unit_type::infantry>>(
state, id);
665 }
else if(
name ==
"unit_type_2_value") {
666 return make_element_by_type<lc_unit_strength_txt<false, military::unit_type::cavalry>>(
state, id);
667 }
else if(
name ==
"unit_type_3_value") {
668 return make_element_by_type<lc_unit_strength_txt<false, military::unit_type::support>>(
state, id);
669 }
else if(
name ==
"modifiers") {
670 return make_element_by_type<defender_combat_modifiers>(
state,
id);
680 if(
name ==
"shield") {
681 return make_element_by_type<lc_attacker_flag>(
state,
id);
682 }
else if(
name ==
"leader_icon") {
683 return make_element_by_type<lc_attacker_leader_img>(
state,
id);
684 }
else if(
name ==
"leader_name") {
685 return make_element_by_type<lc_attacking_leader_name>(
state,
id);
686 }
else if(
name ==
"morale") {
687 auto ptr = make_element_by_type<lc_attacker_org>(
state,
id);
688 ptr->base_data.position.y -= 1;
690 }
else if(
name ==
"strength") {
691 auto ptr = make_element_by_type<lc_attacker_str>(
state,
id);
692 ptr->base_data.position.y -= 1;
694 }
else if(
name ==
"morale_text") {
695 return make_element_by_type<lc_attacker_org_txt>(
state,
id);
696 }
else if(
name ==
"strength_text") {
697 return make_element_by_type<lc_attacker_str_txt>(
state,
id);
698 }
else if(
name ==
"unit_type_1") {
699 return make_element_by_type<lc_static_icon<0>>(
state, id);
700 }
else if(
name ==
"unit_type_2") {
701 return make_element_by_type<lc_static_icon<1>>(
state, id);
702 }
else if(
name ==
"unit_type_3") {
703 return make_element_by_type<lc_static_icon<2>>(
state, id);
704 }
else if(
name ==
"unit_type_1_value") {
705 return make_element_by_type<lc_unit_strength_txt<true, military::unit_type::infantry>>(
state, id);
706 }
else if(
name ==
"unit_type_2_value") {
707 return make_element_by_type<lc_unit_strength_txt<true, military::unit_type::cavalry>>(
state, id);
708 }
else if(
name ==
"unit_type_3_value") {
709 return make_element_by_type<lc_unit_strength_txt<true, military::unit_type::support>>(
state, id);
710 }
else if(
name ==
"modifiers") {
711 return make_element_by_type<attacker_combat_modifiers>(
state,
id);
730 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
744 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
745 auto loc =
state.world.land_battle_get_location_from_land_battle_location(b);
746 auto name =
state.world.province_get_name(loc);
763 auto color_from_nation = [&](dcon::nation_id n) {
765 return state.world.nation_get_color(n);
770 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
774 auto& row =
state.world.land_battle_get_attacker_front_line(b);
775 auto reg = row.at(
slot);
780 auto type =
state.world.regiment_get_type(reg);
792 color = color_from_nation(
state.world.army_get_controller_from_army_control(
state.world.regiment_get_army_from_army_membership(reg)));
798 auto& row =
state.world.land_battle_get_attacker_back_line(b);
799 auto reg = row.at(
slot);
804 auto type =
state.world.regiment_get_type(reg);
816 color = color_from_nation(
state.world.army_get_controller_from_army_control(
state.world.regiment_get_army_from_army_membership(reg)));
822 auto& row =
state.world.land_battle_get_defender_front_line(b);
823 auto reg = row.at(
slot);
828 auto type =
state.world.regiment_get_type(reg);
840 color = color_from_nation(
state.world.army_get_controller_from_army_control(
state.world.regiment_get_army_from_army_membership(reg)));
846 auto& row =
state.world.land_battle_get_defender_back_line(b);
847 auto reg = row.at(
slot);
852 auto type =
state.world.regiment_get_type(reg);
864 color = color_from_nation(
state.world.army_get_controller_from_army_control(
state.world.regiment_get_army_from_army_membership(reg)));
882 auto b = retrieve<dcon::land_battle_id>(
state,
parent);
883 dcon::regiment_id reg{};
886 reg =
state.world.land_battle_get_attacker_front_line(b).at(
slot);
889 reg =
state.world.land_battle_get_attacker_back_line(b).at(
slot);
892 reg =
state.world.land_battle_get_defender_front_line(b).at(
slot);
895 reg =
state.world.land_battle_get_defender_back_line(b).at(
slot);
900 auto utid =
state.world.regiment_get_type(reg);
902 auto p =
state.world.land_battle_get_location_from_land_battle_location(b);
906 auto n =
state.world.army_get_controller_from_army_control(
state.world.regiment_get_army_from_army_membership(reg));
907 std::string tag_str =
"";
913 auto rf =
state.world.army_get_controller_from_army_rebel_control(
state.world.regiment_get_army_from_army_membership(reg));
915 n =
state.world.rebellion_within_get_ruler(
state.world.rebel_faction_get_rebellion_within(rf));
917 n =
state.world.national_identity_get_nation_from_identity_holder(
state.national_definitions.rebel_id);
930 if(
state.world.nation_get_unit_stats(n, utid).reconnaissance_or_fire_range > 0) {
933 if(
state.world.nation_get_unit_stats(n, utid).siege_or_torpedo_attack > 0) {
939 if(
state.military_definitions.unit_base_definitions[utid].support > 0) {
959 for(int32_t i = 0; i < 30; ++i) {
960 int32_t s = (i < 15) ? 28 - i * 2 : (i - 15) * 2 + 1;
962 auto win = make_element_by_type<counter_ico>(
state, def);
965 win->base_data.position.x = int16_t(21 + i * 12);
966 win->base_data.position.y = int16_t(231);
970 auto win = make_element_by_type<counter_ico>(
state, def);
973 win->base_data.position.x = int16_t(21 + i * 12);
974 win->base_data.position.y = int16_t(231 + 12);
978 auto win = make_element_by_type<counter_ico>(
state, def);
981 win->base_data.position.x = int16_t(21 + i * 12);
982 win->base_data.position.y = int16_t(321);
986 auto win = make_element_by_type<counter_ico>(
state, def);
989 win->base_data.position.x = int16_t(21 + i * 12);
990 win->base_data.position.y = int16_t(321 + 12);
1002 if(
name ==
"combat_bg") {
1003 return make_element_by_type<opaque_element_base>(
state,
id);
1004 }
else if(
name ==
"combat_terrain1") {
1005 return make_element_by_type<province_terrain_image>(
state,
id);
1006 }
else if(
name ==
"label_battlename") {
1007 return make_element_by_type<lbattle_name>(
state,
id);
1008 }
else if(
name ==
"combat_retreat") {
1009 return make_element_by_type<lc_retreat_button>(
state,
id);
1010 }
else if(
name ==
"closebutton") {
1011 return make_element_by_type<generic_close_button>(
state,
id);
1012 }
else if(
name ==
"attacker") {
1013 return make_element_by_type<land_combat_attacker_window>(
state,
id);
1014 }
else if(
name ==
"defender") {
1015 return make_element_by_type<land_combat_defender_window>(
state,
id);
1023 if(payload.holds_type<dcon::land_battle_id>()) {
1024 payload.emplace<dcon::land_battle_id>(
battle);
1026 }
else if(payload.holds_type<dcon::province_id>()) {
1027 payload.emplace<dcon::province_id>(
state.world.land_battle_get_location_from_land_battle_location(
battle));
1037 bool visible =
true;
1039 visible = !(retrieve< military::land_battle_report*>(
state,
parent)->player_on_winning_side);
1041 void render(
sys::state&
state, int32_t x, int32_t y)
noexcept override {
1047 bool visible =
true;
1049 visible = (retrieve< military::land_battle_report*>(
state,
parent)->player_on_winning_side);
1051 void render(
sys::state&
state, int32_t x, int32_t y)
noexcept override {
1058 auto loc = retrieve< military::land_battle_report*>(
state,
parent)->location;
1059 auto name =
state.world.province_get_name(loc);
1066 dcon::gfx_object_id def;
1081 auto owner =
state.world.leader_get_nation_from_leader_loyalty(lid);
1082 auto pculture =
state.world.nation_get_primary_culture(owner);
1083 auto ltype = pculture.get_group_from_culture_group_membership().get_leader();
1086 auto grange = ltype.get_generals();
1087 if(grange.size() > 0) {
1118 auto name =
state.to_string_view(
state.world.leader_get_name(lid));
1126 dcon::gfx_object_id def;
1141 auto owner =
state.world.leader_get_nation_from_leader_loyalty(lid);
1142 auto pculture =
state.world.nation_get_primary_culture(owner);
1143 auto ltype = pculture.get_group_from_culture_group_membership().get_leader();
1146 auto grange = ltype.get_generals();
1147 if(grange.size() > 0) {
1178 auto name =
state.to_string_view(
state.world.leader_get_name(lid));
1191 if(prestige_value > 0) {
1193 }
else if(prestige_value < 0) {
1206 if(prestige_value > 0) {
1208 }
else if(prestige_value < 0) {
1417 if(prov && prov.value <
state.province_definitions.first_sea_province.value) {
1418 state.map_state.set_selected_province(prov);
1422 state.map_state.center_map_on_province(
state, prov);
1478 auto new_elm = ui::make_element_by_type<ui::land_combat_end_popup>(
state,
"endoflandcombatpopup");
1479 auto ptr = new_elm.get();
1483 state.ui_state.
root->add_child_to_front(std::move(new_elm));
1485 std::unique_ptr<land_combat_end_popup> ptr = std::move(
land_reports_pool.back());
1488 ptr->set_visible(
state,
true);
1489 state.ui_state.
root->add_child_to_front(std::move(ptr));
1494 if(
name ==
"background") {
1495 return make_element_by_type<draggable_target>(
state,
id);
1496 }
else if(
name ==
"combat_end_land_lost") {
1497 return make_element_by_type<lc_loss_image>(
state,
id);
1498 }
else if(
name ==
"combat_end_land_won") {
1499 return make_element_by_type<lc_win_image>(
state,
id);
1500 }
else if(
name ==
"line1") {
1501 return make_element_by_type<lc_result_battle_name>(
state,
id);
1502 }
else if(
name ==
"ourleader_photo") {
1503 return make_element_by_type<lc_our_leader_img>(
state,
id);
1504 }
else if(
name ==
"ourleader") {
1505 return make_element_by_type<lc_our_leader_name>(
state,
id);
1506 }
else if(
name ==
"prestige_number") {
1507 return make_element_by_type<lc_our_prestige>(
state,
id);
1508 }
else if(
name ==
"we_number") {
1509 return make_element_by_type<lc_empty_text>(
state,
id);
1510 }
else if(
name ==
"enemyleader_photo") {
1511 return make_element_by_type<lc_their_leader_img>(
state,
id);
1512 }
else if(
name ==
"enemyleader") {
1513 return make_element_by_type<lc_their_leader_name>(
state,
id);
1514 }
else if(
name ==
"prestige_number2") {
1515 return make_element_by_type<lc_their_prestige>(
state,
id);
1516 }
else if(
name ==
"we_number2") {
1517 return make_element_by_type<lc_empty_text>(
state,
id);
1518 }
else if(
name ==
"our_unit_type_1") {
1519 return make_element_by_type<lc_static_icon<0>>(
state, id);
1520 }
else if(
name ==
"our_unit_type_1_1_text") {
1521 return make_element_by_type<lc_o_initial_inf>(
state,
id);
1522 }
else if(
name ==
"our_unit_type_1_2_text") {
1523 return make_element_by_type<lc_o_loss_inf>(
state,
id);
1524 }
else if(
name ==
"our_unit_type_1_3_text") {
1525 return make_element_by_type<lc_o_rem_inf>(
state,
id);
1526 }
else if(
name ==
"our_unit_type_2") {
1527 return make_element_by_type<lc_static_icon<1>>(
state, id);
1528 }
else if(
name ==
"our_unit_type_2_1_text") {
1529 return make_element_by_type<lc_o_initial_cav>(
state,
id);
1530 }
else if(
name ==
"our_unit_type_2_2_text") {
1531 return make_element_by_type<lc_o_loss_cav>(
state,
id);
1532 }
else if(
name ==
"our_unit_type_2_3_text") {
1533 return make_element_by_type<lc_o_rem_cav>(
state,
id);
1534 }
else if(
name ==
"our_unit_type_3") {
1535 return make_element_by_type<lc_static_icon<2>>(
state, id);
1536 }
else if(
name ==
"our_unit_type_3_1_text") {
1537 return make_element_by_type<lc_o_initial_art>(
state,
id);
1538 }
else if(
name ==
"our_unit_type_3_2_text") {
1539 return make_element_by_type<lc_o_loss_art>(
state,
id);
1540 }
else if(
name ==
"our_unit_type_3_3_text") {
1541 return make_element_by_type<lc_o_rem_art>(
state,
id);
1542 }
else if(
name ==
"enemy_unit_type_1") {
1543 return make_element_by_type<lc_static_icon<0>>(
state, id);
1544 }
else if(
name ==
"enemy_unit_type_1_1_text") {
1545 return make_element_by_type<lc_t_initial_inf>(
state,
id);
1546 }
else if(
name ==
"enemy_unit_type_1_2_text") {
1547 return make_element_by_type<lc_t_loss_inf>(
state,
id);
1548 }
else if(
name ==
"enemy_unit_type_1_3_text") {
1549 return make_element_by_type<lc_t_rem_inf>(
state,
id);
1550 }
else if(
name ==
"enemy_unit_type_2") {
1551 return make_element_by_type<lc_static_icon<1>>(
state, id);
1552 }
else if(
name ==
"enemy_unit_type_2_1_text") {
1553 return make_element_by_type<lc_t_initial_cav>(
state,
id);
1554 }
else if(
name ==
"enemy_unit_type_2_2_text") {
1555 return make_element_by_type<lc_t_loss_cav>(
state,
id);
1556 }
else if(
name ==
"enemy_unit_type_2_3_text") {
1557 return make_element_by_type<lc_t_rem_cav>(
state,
id);
1558 }
else if(
name ==
"enemy_unit_type_3") {
1559 return make_element_by_type<lc_static_icon<2>>(
state, id);
1560 }
else if(
name ==
"enemy_unit_type_3_1_text") {
1561 return make_element_by_type<lc_t_initial_art>(
state,
id);
1562 }
else if(
name ==
"enemy_unit_type_3_2_text") {
1563 return make_element_by_type<lc_t_loss_art>(
state,
id);
1564 }
else if(
name ==
"enemy_unit_type_3_3_text") {
1565 return make_element_by_type<lc_t_rem_art>(
state,
id);
1566 }
else if(
name ==
"our_total_armies") {
1567 return make_element_by_type<lc_o_initial_total>(
state,
id);
1568 }
else if(
name ==
"our_total_loss") {
1569 return make_element_by_type<lc_o_loss_total>(
state,
id);
1570 }
else if(
name ==
"our_total_left") {
1571 return make_element_by_type<lc_o_rem_total>(
state,
id);
1572 }
else if(
name ==
"enemy_total_armies") {
1573 return make_element_by_type<lc_t_initial_total>(
state,
id);
1574 }
else if(
name ==
"enemy_total_loss") {
1575 return make_element_by_type<lc_t_loss_total>(
state,
id);
1576 }
else if(
name ==
"enemy_total_left") {
1577 return make_element_by_type<lc_t_rem_total>(
state,
id);
1578 }
else if(
name ==
"agreebutton") {
1579 auto ptr = make_element_by_type<lc_close_button>(
state,
id);
1580 ptr->base_data.position.y += 146;
1582 }
else if(
name ==
"declinebutton") {
1583 auto ptr = make_element_by_type<lc_goto_location_button>(
state,
id);
1584 ptr->base_data.position.y += 146;
1587 }
else if(
name ==
"centerok") {
1588 return make_element_by_type<invisible_element>(
state,
id);
1589 }
else if(
name ==
"warscore") {
1590 auto ptr = make_element_by_type<lc_warscore>(
state,
id);
1592 }
else if(
name ==
"winorlose") {
1593 auto ptr = make_element_by_type<lc_win_lose>(
state,
id);
1600inline void lc_close_button::button_action(
sys::state&
state)
noexcept {
1601 parent->set_visible(
state,
false);
1602 auto uptr =
state.ui_state.
root->remove_child(parent);
void add_child_to_front(std::unique_ptr< element_base > child) noexcept final
void impl_on_update(sys::state &state) 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
void render(sys::state &state, int32_t x, int32_t y) noexcept override
virtual message_result get(sys::state &state, Cyto::Any &payload) noexcept
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
std::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
static void make_new_report(sys::state &state, military::land_battle_report const &r)
military::land_battle_report report
static std::vector< std::unique_ptr< ui::land_combat_end_popup > > land_reports_pool
message_result get(sys::state &state, Cyto::Any &payload) 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
dcon::land_battle_id battle
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 render(sys::state &state, int32_t x, int32_t y) noexcept override
dcon::national_identity_id get_current_nation(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void 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::national_identity_id get_current_nation(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
text::layout internal_layout
std::vector< lc_modifier_data > row_contents
void update(sys::state &state)
void set_text(sys::state &state, std::string const &new_text)
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
#define assert(condition)
void retreat_from_land_battle(sys::state &state, dcon::nation_id source, dcon::land_battle_id b)
bool can_retreat_from_land_battle(sys::state &state, dcon::nation_id source, dcon::land_battle_id b)
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
constexpr float zoom_very_close
constexpr uint8_t defender_bonus_crossing_none
constexpr uint8_t defender_bonus_crossing_river
war_role get_role(sys::state const &state, dcon::war_id w, dcon::nation_id n)
constexpr uint8_t defender_bonus_dig_in_mask
dcon::nation_id get_land_battle_lead_attacker(sys::state &state, dcon::land_battle_id b)
constexpr uint8_t defender_bonus_crossing_mask
constexpr int32_t days_before_retreat
dcon::nation_id get_land_battle_lead_defender(sys::state &state, dcon::land_battle_id b)
std::string int_to_tag(uint32_t v)
void render_masked_rect(sys::state const &state, color_modification enabled, float x, float y, float width, float height, GLuint texture_handle, GLuint mask_texture_handle, ui::rotation r, bool flipped, bool rtl)
GLuint get_texture_handle(sys::state &state, dcon::texture_id id, bool keep_data)
std::string rebel_name(sys::state &state, dcon::rebel_faction_id reb)
uint32_t reduce(uint32_t value_in, uint32_t upper_bound)
uint64_t get_random(sys::state const &state, uint32_t value_in)
audio_instance & get_random_land_battle_sound(sys::state &state)
void play_effect(sys::state &state, audio_instance &s, float volume)
uint32_t pack_color(float r, float g, float b)
void add_to_layout_box(sys::state &state, layout_base &dest, layout_box &box, embedded_flag ico)
layout_box open_layout_box(layout_base &dest, int32_t indent)
void localised_format_box(sys::state &state, layout_base &dest, layout_box &box, std::string_view key, text::substitution_map const &sub)
std::string 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_to_substitution_map(substitution_map &mp, variable_type key, substitution value)
ankerl::unordered_dense::map< uint32_t, substitution > substitution_map
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
dcon::text_key get_name(sys::state &state, dcon::nation_id id)
std::string format_percentage(float num, size_t digits)
void close_layout_box(columnar_layout &dest, layout_box &box)
void display_leader_attributes(sys::state &state, dcon::leader_id lid, text::layout_base &contents, int32_t indent)
ogl::color_modification get_color_modification(bool is_under_mouse, bool is_disabled, bool is_interactable)
dcon::leader_id attacking_general
dcon::leader_id defending_general
float attacker_cavalry_losses
bool player_on_winning_side
dcon::province_id location
float defender_cavalry_losses
float attacker_support_losses
float defender_infantry_losses
float attacker_infantry_losses
float defender_support_losses
element_type get_element_type() const
rotation get_rotation() const
union ui::element_data::internal_data data
dcon::gfx_object_id gfx_object
ankerl::unordered_dense::map< dcon::text_key, element_target, hash_text_key > defs_by_name
std::unique_ptr< element_base > root
element_base * province_window
element_base * army_combat_window
element_base * under_mouse