2#include "dcon_generated.hpp"
17 if(
auto a = retrieve<dcon::army_id>(
state,
parent); a) {
19 }
else if(
auto v = retrieve<dcon::navy_id>(
state,
parent); v){
34 dcon::leader_id lid = retrieve<dcon::leader_id>(
state,
parent);
36 auto pculture =
state.world.nation_get_primary_culture(
state.local_player_nation);
37 auto ltype = pculture.get_group_from_culture_group_membership().get_leader();
40 auto admiral =
state.world.leader_get_is_admiral(lid);
42 auto arange = ltype.get_admirals();
43 if(arange.size() > 0) {
49 auto grange = ltype.get_generals();
50 if(grange.size() > 0) {
65 dcon::leader_id lid = retrieve<dcon::leader_id>(
state,
parent);
76 dcon::leader_id lid = retrieve<dcon::leader_id>(
state,
parent);
78 auto attack =
state.world.leader_trait_get_attack(
state.world.leader_get_background(lid)) +
state.world.leader_trait_get_attack(
state.world.leader_get_personality(lid));
97 dcon::leader_id lid = retrieve<dcon::leader_id>(
state,
parent);
99 auto v =
state.world.leader_trait_get_defense(
state.world.leader_get_background(lid)) +
state.world.leader_trait_get_defense(
state.world.leader_get_personality(lid));
118 dcon::leader_id lid = retrieve<dcon::leader_id>(
state,
parent);
120 auto v =
state.world.leader_trait_get_organisation(
state.world.leader_get_background(lid)) +
state.world.leader_trait_get_organisation(
state.world.leader_get_personality(lid));
139 dcon::leader_id lid = retrieve<dcon::leader_id>(
state,
parent);
141 auto v =
state.world.leader_trait_get_morale(
state.world.leader_get_background(lid)) +
state.world.leader_trait_get_morale(
state.world.leader_get_personality(lid));
160 dcon::leader_id lid = retrieve<dcon::leader_id>(
state,
parent);
162 auto v =
state.world.leader_trait_get_speed(
state.world.leader_get_background(lid)) +
state.world.leader_trait_get_speed(
state.world.leader_get_personality(lid));
181 dcon::leader_id lid = retrieve<dcon::leader_id>(
state,
parent);
183 auto v =
state.world.leader_trait_get_reconnaissance(
state.world.leader_get_background(lid)) +
state.world.leader_trait_get_reconnaissance(
state.world.leader_get_personality(lid));
202 dcon::leader_id lid = retrieve<dcon::leader_id>(
state,
parent);
204 auto v =
state.world.leader_trait_get_reliability(
state.world.leader_get_background(lid)) +
state.world.leader_trait_get_reliability(
state.world.leader_get_personality(lid));
223 dcon::leader_id lid = retrieve<dcon::leader_id>(
state,
parent);
225 auto v =
state.world.leader_trait_get_experience(
state.world.leader_get_background(lid)) +
state.world.leader_trait_get_experience(
state.world.leader_get_personality(lid));
375 auto lid = retrieve<dcon::leader_id>(
state,
parent);
376 if(
auto a = retrieve<dcon::army_id>(
state,
parent); a) {
378 }
else if(
auto v = retrieve<dcon::navy_id>(
state,
parent); v) {
420 if constexpr(std::is_same_v<T, dcon::army_id>) {
421 auto content = retrieve<dcon::army_id>(
state,
parent);
423 return state.world.army_get_general_from_army_leadership(content);
425 else if constexpr(std::is_same_v<T, dcon::navy_id>) {
426 auto content = retrieve<dcon::navy_id>(
state,
parent);
428 return state.world.navy_get_admiral_from_navy_leadership(content);
430 else if constexpr(std::is_same_v<T, dcon::leader_id>) {
431 dcon::leader_id lid = retrieve<dcon::leader_id>(
state,
parent);
446 if(
name ==
"leader_button") {
447 return make_element_by_type<set_leader_button>(
state,
id);
449 else if(
name ==
"leader_prestige_bar") {
450 return make_element_by_type<leader_prestige_progress_bar<dcon::leader_id>>(
state, id);
452 else if(
name ==
"photo") {
453 return make_element_by_type<passive_leader_image>(
state,
id);
454 }
else if(
name ==
"leader_name") {
455 return make_element_by_type<passive_leader_name>(
state,
id);
456 }
else if(
name ==
"unitleader_a") {
457 return make_element_by_type < passive_leader_attack>(
state,
id);
458 }
else if(
name ==
"unitleader_b") {
459 return make_element_by_type <passive_leader_defense >(
state,
id);
460 }
else if(
name ==
"unitleader_c") {
461 return make_element_by_type < passive_leader_org>(
state,
id);
462 }
else if(
name ==
"unitleader_d") {
463 return make_element_by_type < passive_leader_morale>(
state,
id);
464 }
else if(
name ==
"unitleader_e") {
465 return make_element_by_type < passive_leader_speed>(
state,
id);
466 }
else if(
name ==
"unitleader_f") {
467 return make_element_by_type < passive_leader_recon>(
state,
id);
468 }
else if(
name ==
"unitleader_g") {
469 return make_element_by_type < passive_leader_reliability>(
state,
id);
470 }
else if(
name ==
"unitleader_h") {
471 return make_element_by_type < passive_leader_exp>(
state,
id);
481 return "alice_leader_entry";
490 if(
auto a = retrieve<dcon::army_id>(
state,
parent); a) {
491 for(
auto l :
state.world.nation_get_leader_loyalty(
state.local_player_nation)) {
492 if(l.get_leader().get_is_admiral() ==
false) {
493 if(
bool(l.get_leader().get_army_from_army_leadership()) ==
false)
497 }
else if(
auto v = retrieve<dcon::navy_id>(
state,
parent); v) {
498 for(
auto l :
state.world.nation_get_leader_loyalty(
state.local_player_nation)) {
499 if(l.get_leader().get_is_admiral() ==
true) {
500 if(
bool(l.get_leader().get_navy_from_navy_leadership()) ==
false)
509 auto av = state.world.leader_trait_get_attack(state.world.leader_get_background(a)) + state.world.leader_trait_get_attack(state.world.leader_get_personality(a));
510 auto bv = state.world.leader_trait_get_attack(state.world.leader_get_background(b)) + state.world.leader_trait_get_attack(state.world.leader_get_personality(b));
514 return a.index() < b.index();
519 auto av = state.world.leader_trait_get_defense(state.world.leader_get_background(a)) + state.world.leader_trait_get_defense(state.world.leader_get_personality(a));
520 auto bv = state.world.leader_trait_get_defense(state.world.leader_get_background(b)) + state.world.leader_trait_get_defense(state.world.leader_get_personality(b));
524 return a.index() < b.index();
529 auto av = state.world.leader_trait_get_reconnaissance(state.world.leader_get_background(a)) + state.world.leader_trait_get_reconnaissance(state.world.leader_get_personality(a));
530 auto bv = state.world.leader_trait_get_reconnaissance(state.world.leader_get_background(b)) + state.world.leader_trait_get_reconnaissance(state.world.leader_get_personality(b));
534 return a.index() < b.index();
539 auto av = state.world.leader_trait_get_morale(state.world.leader_get_background(a)) + state.world.leader_trait_get_morale(state.world.leader_get_personality(a));
540 auto bv = state.world.leader_trait_get_morale(state.world.leader_get_background(b)) + state.world.leader_trait_get_morale(state.world.leader_get_personality(b));
544 return a.index() < b.index();
549 auto av = state.world.leader_trait_get_reliability(state.world.leader_get_background(a)) + state.world.leader_trait_get_reliability(state.world.leader_get_personality(a));
550 auto bv = state.world.leader_trait_get_reliability(state.world.leader_get_background(b)) + state.world.leader_trait_get_reliability(state.world.leader_get_personality(b));
554 return a.index() < b.index();
559 auto av = state.world.leader_trait_get_organisation(state.world.leader_get_background(a)) + state.world.leader_trait_get_organisation(state.world.leader_get_personality(a));
560 auto bv = state.world.leader_trait_get_organisation(state.world.leader_get_background(b)) + state.world.leader_trait_get_organisation(state.world.leader_get_personality(b));
564 return a.index() < b.index();
569 auto av = state.world.leader_trait_get_speed(state.world.leader_get_background(a)) + state.world.leader_trait_get_speed(state.world.leader_get_personality(a));
570 auto bv = state.world.leader_trait_get_speed(state.world.leader_get_background(b)) + state.world.leader_trait_get_speed(state.world.leader_get_personality(b));
574 return a.index() < b.index();
579 auto av = state.world.leader_trait_get_experience(state.world.leader_get_background(a)) + state.world.leader_trait_get_experience(state.world.leader_get_personality(a));
580 auto bv = state.world.leader_trait_get_experience(state.world.leader_get_background(b)) + state.world.leader_trait_get_experience(state.world.leader_get_personality(b));
584 return a.index() < b.index();
601 if(
name ==
"select_leader_bg") {
602 return make_element_by_type<opaque_element_base>(
state,
id);
603 }
else if(
name ==
"prestige_bar_frame") {
604 return make_element_by_type<image_element_base>(
state,
id);
605 }
else if(
name ==
"leader_prestige_bar") {
606 return make_element_by_type<leader_prestige_progress_bar<dcon::leader_id>>(
state, id);
607 }
else if(
name ==
"selected_photo") {
608 return make_element_by_type<passive_leader_image>(
state,
id);
609 }
else if(
name ==
"selected_leader_name") {
610 return make_element_by_type<passive_leader_name>(
state,
id);
611 }
else if(
name ==
"unitleader_a") {
612 return make_element_by_type < passive_leader_attack>(
state,
id);
613 }
else if(
name ==
"unitleader_b") {
614 return make_element_by_type <passive_leader_defense >(
state,
id);
615 }
else if(
name ==
"unitleader_c") {
616 return make_element_by_type < passive_leader_org>(
state,
id);
617 }
else if(
name ==
"unitleader_d") {
618 return make_element_by_type < passive_leader_morale>(
state,
id);
619 }
else if(
name ==
"unitleader_e") {
620 return make_element_by_type < passive_leader_speed>(
state,
id);
621 }
else if(
name ==
"unitleader_f") {
622 return make_element_by_type < passive_leader_recon>(
state,
id);
623 }
else if(
name ==
"unitleader_g") {
624 return make_element_by_type < passive_leader_reliability>(
state,
id);
625 }
else if(
name ==
"unitleader_h") {
626 return make_element_by_type < passive_leader_exp>(
state,
id);
627 }
else if(
name ==
"sort_prestige") {
628 return make_element_by_type<button_element_base>(
state,
id);
629 }
else if(
name ==
"sort_prestige_icon") {
631 }
else if(
name ==
"sort_name") {
633 }
else if(
name ==
"sort_a") {
634 return make_element_by_type<sort_leader_attack>(
state,
id);
635 }
else if(
name ==
"sort_b") {
636 return make_element_by_type<sort_leader_def>(
state,
id);
637 }
else if(
name ==
"sort_c") {
638 return make_element_by_type<sort_leader_org>(
state,
id);
639 }
else if(
name ==
"sort_d") {
640 return make_element_by_type<sort_leader_morale>(
state,
id);
641 }
else if(
name ==
"sort_e") {
642 return make_element_by_type<sort_leader_speed>(
state,
id);
643 }
else if(
name ==
"sort_f") {
644 return make_element_by_type<sort_leader_recon>(
state,
id);
645 }
else if(
name ==
"sort_g") {
646 return make_element_by_type<sort_leader_reliable>(
state,
id);
647 }
else if(
name ==
"sort_h") {
648 return make_element_by_type<sort_leader_exp>(
state,
id);
649 }
else if(
name ==
"back_button") {
650 return make_element_by_type<generic_close_button>(
state,
id);
651 }
else if(
name ==
"noleader_button") {
652 return make_element_by_type<unset_leader_button>(
state,
id);
653 }
else if(
name ==
"leaderlist") {
654 auto ptr = make_element_by_type<leader_select_listbox>(
state,
id);
663 if(payload.holds_type<dcon::leader_id>()) {
665 payload.emplace<dcon::leader_id>(
state.world.army_get_general_from_army_leadership(
a));
667 payload.emplace<dcon::leader_id>(
state.world.navy_get_admiral_from_navy_leadership(
v));
669 }
else if(payload.holds_type<dcon::army_id>()) {
670 payload.emplace<dcon::army_id>(
a);
672 }
else if(payload.holds_type<dcon::navy_id>()) {
673 payload.emplace<dcon::navy_id>(
v);
676 lb->
sort_type = any_cast<leader_select_sort>(payload);
void impl_on_update(sys::state &state) noexcept override
virtual message_result get(sys::state &state, Cyto::Any &payload) noexcept
virtual void on_create(sys::state &state) noexcept
void set_visible(sys::state &state, bool vis)
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
dcon::leader_id get_leader_id(sys::state &state) noexcept
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
leader_select_sort sort_type
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_create(sys::state &state) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
leader_select_listbox * lb
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
std::vector< dcon::leader_id > row_contents
void update(sys::state &state)
void on_update(sys::state &state) noexcept override
dcon::gfx_object_id default_img
void on_update(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
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
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
tooltip_behavior has_tooltip(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 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
tooltip_behavior has_tooltip(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 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 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
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 on_create(sys::state &state) noexcept override
uint32_t reduce(uint32_t value_in, uint32_t upper_bound)
uint64_t get_random(sys::state const &state, uint32_t value_in)
void add_to_layout_box(sys::state &state, layout_base &dest, layout_box &box, embedded_flag ico)
layout_box open_layout_box(layout_base &dest, int32_t indent)
void localised_format_box(sys::state &state, layout_base &dest, layout_box &box, std::string_view key, text::substitution_map const &sub)
std::string format_float(float num, size_t digits)
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
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)
void send(sys::state &state, element_base *parent, T value)
union ui::element_data::internal_data data
dcon::gfx_object_id gfx_object
element_base * change_leader_window