3#include "dcon_generated.hpp"
22 const dcon::national_identity_id niid = retrieve<dcon::national_identity_id>(
state,
parent);
27 const dcon::national_identity_id niid = retrieve<dcon::national_identity_id>(
state,
parent);
36 const dcon::national_identity_id niid = retrieve<dcon::national_identity_id>(
state,
parent);
41 const dcon::national_identity_id niid = retrieve<dcon::national_identity_id>(
state,
parent);
61 int64_t province_count = 0;
63 state.world.national_identity_for_each_core(
id, [&](dcon::core_id core) {
65 if(
state.world.province_get_nation_from_province_ownership(
province) ==
state.local_player_nation && province_count++ < 5) {
66 if(!provinces.empty()) {
78 if(province_count > 5) {
90 const dcon::national_identity_id niid = retrieve<dcon::national_identity_id>(
state, parent);
99 return make_element_by_type<generic_name_text<dcon::national_identity_id>>(
state, id);
100 }
else if(
name ==
"country_flag") {
101 return make_element_by_type<flag_button>(
state,
id);
102 }
else if(
name ==
"type") {
103 return make_element_by_type<national_identity_vassal_type_text>(
state,
id);
104 }
else if(
name ==
"desc") {
105 return make_element_by_type<release_nation_description_text>(
state,
id);
106 }
else if(
name ==
"country_release_vassal") {
107 return make_element_by_type<release_nation_button>(
state,
id);
117 return "vassal_nation";
122 row_contents.clear();
123 state.world.for_each_national_identity([&](dcon::national_identity_id
ident) {
125 row_contents.push_back(ident);
128 std::sort(row_contents.begin(), row_contents.end(), [&](dcon::national_identity_id a, dcon::national_identity_id b) {
129 auto av = text::produce_simple_string(state, state.world.national_identity_get_name(a));
130 auto bv = text::produce_simple_string(state, state.world.national_identity_get_name(b));
134 return a.index() < b.index();
143 window_element_base::on_create(
state);
144 set_visible(
state,
false);
148 if(
name ==
"nations") {
149 return make_element_by_type<release_nation_listbox>(
state,
id);
160 int64_t province_count = 0;
162 state.world.national_identity_for_each_core(
id, [&](dcon::core_id core) {
164 if(
state.world.province_get_nation_from_province_ownership(
province) ==
state.local_player_nation && province_count++ < 5) {
165 if(!provinces.empty()) {
177 if(province_count > 5) {
183 for(
auto& txt : contents.base_layout.contents) {
199 window_element_base::on_create(
state);
200 set_visible(
state,
false);
201 base_data.position.x = base_data.position.y = 0;
205 if(
name ==
"background") {
206 auto ptr = make_element_by_type<draggable_target>(
state,
id);
207 ptr->base_data.size = base_data.size;
209 }
else if(
name ==
"default_popup_banner")
210 return make_element_by_type<image_element_base>(
state,
id);
211 else if(
name ==
"title")
212 return make_element_by_type<politics_release_nation_window_title>(
state,
id);
213 else if(
name ==
"description")
214 return make_element_by_type<release_nation_window_description_text>(
state,
id);
215 else if(
name ==
"agreebutton")
216 return make_element_by_type<release_agree_button>(
state,
id);
217 else if(
name ==
"declinebutton")
218 return make_element_by_type<generic_close_button>(
state,
id);
219 else if(
name ==
"playasbutton")
220 return make_element_by_type<release_play_as_button>(
state,
id);
226 if(payload.holds_type<dcon::national_identity_id>()) {
228 parent->impl_get(
state, n_payload);
229 auto content =
state.world.nation_get_identity_from_identity_holder(any_cast<dcon::nation_id>(n_payload));
230 payload.emplace<dcon::national_identity_id>(content);
231 return message_result::consumed;
232 }
else if(payload.holds_type<dcon::nation_id>()) {
234 parent->impl_get(
state, n_payload);
235 auto content = any_cast<release_query_wrapper>(n_payload).
content;
236 payload.emplace<dcon::nation_id>(content);
237 return message_result::consumed;
239 return message_result::unseen;
virtual void on_create(sys::state &state) noexcept
void set_visible(sys::state &state, bool vis)
void on_update(sys::state &state) 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
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
void on_create(sys::state &state) noexcept override
void populate_layout(sys::state &state, text::endless_layout &contents, dcon::national_identity_id id) 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
void populate_layout(sys::state &state, text::endless_layout &contents, dcon::national_identity_id id) noexcept override
void on_create(sys::state &state) 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
void set_text(sys::state &state, std::string const &new_text)
bool can_release_and_play_as(sys::state &state, dcon::nation_id source, dcon::national_identity_id t)
void release_and_play_as(sys::state &state, dcon::nation_id source, dcon::national_identity_id t)
bool can_make_vassal(sys::state &state, dcon::nation_id source, dcon::national_identity_id t)
bool can_release_as_vassal(sys::state const &state, dcon::nation_id n, dcon::national_identity_id releasable)
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)
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)
void close_layout_box(columnar_layout &dest, layout_box &box)
void send(sys::state &state, element_base *parent, T value)