16 auto content = retrieve<dcon::nation_id>(
state,
parent);
17 frame =
state.world.nation_get_is_interesting(content) ? 1 : 0;
21 auto content = retrieve<dcon::nation_id>(
state,
parent);
23 fat_id.set_is_interesting(!fat_id.get_is_interesting());
32 if(
name ==
"entry_bg") {
33 return make_element_by_type<message_filters_country_button>(
state,
id);
34 }
else if(
name ==
"country_name") {
35 return make_element_by_type<generic_name_text<dcon::nation_id>>(
state, id);
42 if(payload.holds_type<dcon::nation_id>()) {
43 payload.emplace<dcon::nation_id>(
content);
53 return "message_filters_entry";
64 state.world.for_each_nation([&](dcon::nation_id
id) {
65 if(
state.world.nation_get_owned_province_count(
id) != 0)
77 if(
name ==
"close_button") {
78 return make_element_by_type<generic_close_button>(
state,
id);
79 }
else if(
name ==
"background") {
80 return make_element_by_type<draggable_target>(
state,
id);
81 }
else if(
name ==
"countries_listbox") {
82 auto ptr = make_element_by_type<message_filters_country_listbox>(
state,
id);
83 country_listbox = ptr.
get();
85 }
else if(
name ==
"filter_deselect") {
86 auto ptr = make_element_by_type<generic_tab_button<country_list_filter>>(
state, id);
89 }
else if(
name ==
"filter_bestguess") {
91 auto ptr = make_element_by_type<generic_tab_button<country_list_filter>>(
state, id);
94 }
else if(
name ==
"filter_enemies") {
96 auto ptr = make_element_by_type<generic_tab_button<country_list_filter>>(
state, id);
99 }
else if(
name ==
"filter_allies") {
101 auto ptr = make_element_by_type<generic_tab_button<country_list_filter>>(
state, id);
104 }
else if(
name ==
"filter_neighbours") {
106 auto ptr = make_element_by_type<generic_tab_button<country_list_filter>>(
state, id);
109 }
else if(
name ==
"filter_sphere") {
111 auto ptr = make_element_by_type<generic_tab_button<country_list_filter>>(
state, id);
114 }
else if(
name.length() >= 7 &&
name.substr(0, 7) ==
"filter_") {
115 auto const filter_name =
name.substr(7);
117 auto ptr = make_element_by_type<generic_tab_button<dcon::modifier_id>>(
state, id);
118 ptr->target = ([&]() {
119 dcon::modifier_id filter_mod_id{0};
122 state.world.for_each_modifier([&](dcon::modifier_id mod_id) {
124 if(k == fat_id.get_name())
125 filter_mod_id = mod_id;
127 return filter_mod_id;
137 auto filter = any_cast<country_list_filter>(payload);
140 state.world.for_each_nation([&](dcon::nation_id
id) {
141 auto rel =
state.world.get_diplomatic_relation_by_diplomatic_pair(
id,
state.local_player_nation);
142 if(
state.world.diplomatic_relation_get_are_allied(rel) ||
145 state.world.nation_get_in_sphere_of(
id) ==
state.local_player_nation ||
146 state.world.get_nation_adjacency_by_nation_adjacency_pair(
state.local_player_nation,
id))
147 state.world.nation_set_is_interesting(
id,
true);
151 state.world.for_each_nation([&](dcon::nation_id
id) {
state.world.nation_set_is_interesting(
id,
false); });
154 for(
const auto n :
state.world.in_nation) {
156 n.set_is_interesting(
true);
163 }
else if(payload.holds_type<dcon::modifier_id>()) {
164 auto mod_id = any_cast<dcon::modifier_id>(payload);
165 state.world.for_each_nation([&](dcon::nation_id
id) {
166 if(
state.world.nation_get_owned_province_count(
id) != 0) {
167 dcon::nation_fat_id fat_id = dcon::fatten(state.world, id);
168 if(mod_id == fat_id.get_capital().get_continent().id)
169 state.world.nation_set_is_interesting(id, true);
virtual message_result get(sys::state &state, Cyto::Any &payload) noexcept
virtual void impl_on_update(sys::state &state) noexcept
std::vector< dcon::nation_id > row_contents
void update(sys::state &state)
void on_create(sys::state &state) 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
message_result get(sys::state &state, Cyto::Any &payload) 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
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
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
bool are_allied_in_war(sys::state const &state, dcon::nation_id a, dcon::nation_id b)
bool are_at_war(sys::state const &state, dcon::nation_id a, dcon::nation_id b)
std::string lowercase_str(std::string_view sv)
uint16_t name_into_font_id(sys::state &state, std::string_view txt)
bool country_category_filter_check(sys::state &state, country_list_filter filt, dcon::nation_id a, dcon::nation_id b)