11 auto for_nation = retrieve<dcon::nation_id>(
state,
parent);
13 auto for_rules =
state.world.nation_get_combined_issue_rules(for_nation);
31 auto for_nation = retrieve<dcon::nation_id>(
state,
parent);
42 if(
name ==
"country_select") {
43 return make_element_by_type<production_investment_country_select>(
state,
id);
44 }
else if(
name ==
"country_flag") {
45 auto ptr = make_element_by_type<flag_button>(
state,
id);
46 ptr->base_data.position.y -= 2;
47 country_flag = ptr.
get();
49 }
else if(
name ==
"country_name") {
50 return make_element_by_type<generic_name_text<dcon::nation_id>>(
state, id);
51 }
else if(
name ==
"invest") {
52 auto ptr = make_element_by_type<nation_player_investment_text>(
state,
id);
53 ptr->base_data.position.x -= 4;
55 }
else if(
name ==
"factories") {
56 return make_element_by_type<nation_industries_text>(
state,
id);
57 }
else if(
name ==
"country_boss_flag") {
58 auto ptr = make_element_by_type<nation_overlord_flag>(
state,
id);
59 ptr->base_data.position.y -= 2;
61 }
else if(
name ==
"country_prestige") {
62 return make_element_by_type<nation_prestige_rank_text>(
state,
id);
63 }
else if(
name ==
"country_economic") {
64 return make_element_by_type<nation_industry_rank_text>(
state,
id);
65 }
else if(
name ==
"country_military") {
66 return make_element_by_type<nation_military_rank_text>(
state,
id);
67 }
else if(
name ==
"country_total") {
68 return make_element_by_type<nation_rank_text>(
state,
id);
69 }
else if(
name ==
"country_opinion") {
70 return make_element_by_type<nation_player_opinion_text>(
state,
id);
71 }
else if(
name ==
"country_relation") {
72 return make_element_by_type<nation_player_relations_text>(
state,
id);
73 }
else if(
name.substr(0, 10) ==
"country_gp") {
74 auto ptr = make_element_by_type<nation_gp_investment_text>(
state,
id);
75 ptr->rank = uint16_t(std::stoi(std::string{
name.substr(10)}));
76 ptr->base_data.position.x -= 4;
84 if(payload.holds_type<dcon::nation_id>()) {
85 payload.emplace<dcon::nation_id>(
content);
99 return "investment_country_entry";
103 auto current_filter = retrieve< country_filter_setting>(
state,
parent);
104 auto current_sort = retrieve<country_sort_setting>(
state,
parent);
106 state.world.for_each_nation([&](dcon::nation_id
id) {
107 if(
state.world.nation_get_owned_province_count(
id) != 0) {
108 bool passes_filter = country_category_filter_check(state, current_filter.general_category, state.local_player_nation, id);
109 bool right_continent = !current_filter.continent || state.world.nation_get_capital(id).get_continent() == current_filter.continent;
111 if(passes_filter && right_continent)
112 row_contents.push_back(id);
130 return state.world.nation_get_identity_from_identity_holder(
state.local_player_nation);
151 if(
name ==
"country_listbox") {
152 auto ptr = make_element_by_type<production_country_listbox>(
state,
id);
153 ptr->base_data.position.x -= 8 + 5;
154 country_listbox = ptr.
get();
156 }
else if(
name ==
"sort_by_my_flag") {
157 auto ptr = make_element_by_type<production_sort_my_nation_flag>(
state,
id);
158 ptr->base_data.position.y -= 2;
160 }
else if(
name ==
"sort_by_country") {
161 auto ptr = make_element_by_type<country_sort_button<country_list_sort::country>>(
state, id);
162 ptr->base_data.position.y -= 1;
164 }
else if(
name ==
"sort_by_boss") {
165 auto ptr = make_element_by_type<country_sort_button<country_list_sort::boss>>(
state, id);
166 ptr->base_data.position.y -= 1;
168 }
else if(
name ==
"sort_by_prestige") {
169 auto ptr = make_element_by_type<country_sort_button<country_list_sort::prestige_rank>>(
state, id);
170 ptr->base_data.position.y -= 1;
172 }
else if(
name ==
"sort_by_economic") {
173 auto ptr = make_element_by_type<country_sort_button<country_list_sort::economic_rank>>(
state, id);
174 ptr->base_data.position.y -= 1;
176 }
else if(
name ==
"sort_by_military") {
177 auto ptr = make_element_by_type<country_sort_button<country_list_sort::military_rank>>(
state, id);
178 ptr->base_data.position.y -= 1;
180 }
else if(
name ==
"sort_by_total") {
181 auto ptr = make_element_by_type<country_sort_button<country_list_sort::total_rank>>(
state, id);
182 ptr->base_data.position.y -= 1;
184 }
else if(
name ==
"sort_by_relation") {
185 auto ptr = make_element_by_type<country_sort_button<country_list_sort::relation>>(
state, id);
186 ptr->base_data.position.y -= 1;
188 }
else if(
name ==
"sort_by_opinion") {
189 return make_element_by_type<country_sort_button<country_list_sort::opinion>>(
state, id);
190 }
else if(
name ==
"sort_by_prio") {
191 return make_element_by_type<country_sort_button<country_list_sort::priority>>(
state, id);
192 }
else if(
name ==
"filter_all") {
193 return make_element_by_type<category_filter_button<country_list_filter::all>>(
state, id);
194 }
else if(
name ==
"filter_enemies") {
195 return make_element_by_type<category_filter_button<country_list_filter::enemies>>(
state, id);
196 }
else if(
name ==
"filter_allies") {
197 return make_element_by_type<category_filter_button<country_list_filter::allies>>(
state, id);
198 }
else if(
name ==
"filter_neighbours") {
199 return make_element_by_type<category_filter_button<country_list_filter::neighbors>>(
state, id);
200 }
else if(
name ==
"filter_sphere") {
201 return make_element_by_type<category_filter_button<country_list_filter::sphere>>(
state, id);
202 }
else if(
name ==
"sort_by_invest_factories") {
203 auto ptr = make_element_by_type<country_sort_button<country_list_sort::factories>>(
state, id);
204 ptr->base_data.position.y -= 1;
206 }
else if(
name.length() >= 7 &&
name.substr(0, 7) ==
"filter_") {
207 auto const filter_name =
name.substr(7);
208 auto ptr = make_element_by_type<continent_filter_button>(
state,
id);
211 for(
auto m :
state.world.in_modifier) {
212 if(m.get_name() == k) {
219 }
else if(
name.substr(0, 14) ==
"sort_by_gpflag") {
220 auto ptr = make_element_by_type<production_sort_nation_gp_flag>(
state,
id);
221 ptr->rank = uint16_t(std::stoi(std::string{
name.substr(14)}));
222 ptr->base_data.position.y -= 2;
224 }
else if(
name.substr(0, 10) ==
"sort_by_gp") {
225 auto ptr = make_element_by_type<country_sort_button<country_list_sort::gp_investment>>(
state, id);
226 ptr->offset =
uint8_t(std::stoi(std::string{
name.substr(10)}));
228 }
else if(
name ==
"sort_by_my_invest") {
229 return make_element_by_type<country_sort_by_player_investment>(
state,
id);
243 auto new_sort = any_cast<element_selection_wrapper<country_list_sort>>(payload).data;
245 sort.
sort = new_sort;
249 auto temp = any_cast<country_list_filter>(payload);
253 }
else if(payload.holds_type<dcon::modifier_id>()) {
254 auto temp_c = any_cast<dcon::modifier_id>(payload);
255 filter.continent = filter.continent == temp_c ? dcon::modifier_id{} : temp_c;
void impl_on_update(sys::state &state) noexcept override
virtual message_result get(sys::state &state, Cyto::Any &payload) noexcept
message_result impl_get(sys::state &state, Cyto::Any &payload) noexcept
void set_visible(sys::state &state, bool vis)
message_result get(sys::state &state, Cyto::Any &payload) 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::vector< dcon::nation_id > row_contents
standard_listbox_scrollbar< RowWinT, RowConT > * list_scrollbar
void update(sys::state &state)
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
void on_update(sys::state &state) noexcept override
std::string_view get_row_element_name() 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 button_action(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
dcon::national_identity_id get_current_nation(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
constexpr uint32_t allow_foreign_investment
bool is_great_power(sys::state const &state, dcon::nation_id id)
void sort_countries(sys::state &state, std::vector< dcon::nation_id > &list, country_list_sort sort, bool sort_ascend)
void send(sys::state &state, element_base *parent, T value)
void open_foreign_investment(sys::state &state, dcon::nation_id n)