4#include "dcon_generated.hpp"
28 dcon::nation_id nation_id = retrieve<dcon::nation_id>(
state,
parent);
29 dcon::movement_id movement_id = retrieve<dcon::movement_id>(
state,
parent);
34 dcon::nation_id nation_id = retrieve<dcon::nation_id>(
state,
parent);
35 dcon::movement_id movement_id = retrieve<dcon::movement_id>(
state,
parent);
46 return make_element_by_type<movement_issue_name_text>(
state,
id);
47 }
else if(
name ==
"nationalist_name") {
48 return make_element_by_type<movement_nationalist_name_text>(
state,
id);
49 }
else if(
name ==
"flag") {
50 auto ptr = make_element_by_type<flag_button>(
state,
id);
51 nationalist_flag = ptr.
get();
53 }
else if(
name ==
"size") {
54 return make_element_by_type<movement_size_text>(
state,
id);
55 }
else if(
name ==
"radical_val") {
56 return make_element_by_type<movement_radicalism_text>(
state,
id);
57 }
else if(
name ==
"suppress_button") {
58 return make_element_by_type<movement_suppress_button>(
state,
id);
65 if(
state.world.movement_get_associated_independence(
content)) {
73 if(payload.holds_type<dcon::national_identity_id>()) {
74 payload.emplace<dcon::national_identity_id>(
state.world.movement_get_associated_independence(
content));
85 return "movement_entry";
93 for(
auto movement :
state.world.nation_get_movement_within(
state.local_player_nation)) {
94 if (movement.get_movement().get_pop_support() >= 1.0f) {
102 [&](dcon::movement_id a, dcon::movement_id b) {
103 auto a_size = state.world.movement_get_pop_support(a);
104 auto b_size = state.world.movement_get_pop_support(b);
105 return a_size > b_size;
110 [&](dcon::movement_id a, dcon::movement_id b) {
111 auto a_rad = state.world.movement_get_radicalism(a);
112 auto b_rad = state.world.movement_get_radicalism(b);
113 return a_rad > b_rad;
118 [&](dcon::movement_id a, dcon::movement_id b) {
119 auto fat_a = dcon::fatten(state.world, a);
121 if(fat_a.get_associated_independence()) {
122 a_name = text::get_name_as_string(state, fat_a.get_associated_independence());
124 a_name = text::produce_simple_string(state, fat_a.get_associated_issue_option().get_movement_name());
128 if(fat_b.get_associated_independence()) {
129 b_name = text::get_name_as_string(state, fat_b.get_associated_independence());
131 b_name = text::produce_simple_string(state, fat_b.get_associated_issue_option().get_movement_name());
133 return a_name < b_name;
147 for(
auto member :
state.world.rebel_faction_get_pop_rebellion_membership(rebel_faction_id)) {
148 total += member.get_pop().get_size();
189 auto reb = retrieve<dcon::rebel_faction_id>(
state, parent);
194 return tooltip_behavior::variable_tooltip;
198 auto n =
state.local_player_nation;
199 auto reb = retrieve<dcon::rebel_faction_id>(
state, parent);
200 auto type =
state.world.rebel_faction_get_type(reb);
201 if(
auto k =
state.world.rebel_type_get_demands_enforced_trigger(type); k) {
205 if(
auto k =
state.world.rebel_type_get_demands_enforced_effect(type); k) {
209 auto prov =
state.world.nation_get_capital(n);
210 if(
auto k =
state.world.rebel_type_get_siege_won_trigger(type); k) {
214 if(
auto k =
state.world.rebel_type_get_siege_won_effect(type); k) {
224 auto content = retrieve<dcon::rebel_faction_id>(
state, parent);
225 frame = int32_t(
state.world.rebel_type_get_icon(
state.world.rebel_faction_get_type(content)) - 1);
233 return make_element_by_type<rebel_faction_size_text>(
state,
id);
234 }
else if(
name ==
"name") {
235 return make_element_by_type<rebel_faction_name_text>(
state,
id);
236 }
else if(
name ==
"type") {
237 return make_element_by_type<rebel_faction_type_icon>(
state,
id);
238 }
else if(
name ==
"brigades_ready") {
239 return make_element_by_type<rebel_faction_ready_brigade_count_text>(
state,
id);
240 }
else if(
name ==
"brigades_active") {
241 return make_element_by_type<rebel_faction_active_brigade_count_text>(
state,
id);
242 }
else if(
name ==
"organization") {
243 return make_element_by_type<rebel_faction_organization_text>(
state,
id);
244 }
else if(
name ==
"revolt_risk") {
245 return make_element_by_type<rebel_faction_revolt_risk_text>(
state,
id);
255 return "rebel_window";
260 row_contents.clear();
261 for(
auto rebellion :
state.world.nation_get_rebellion_within(
state.local_player_nation)) {
262 row_contents.push_back(rebellion.get_rebels().id);
274 window_element_base::on_create(
state);
275 set_visible(
state,
false);
279 if(
name ==
"sortby_size_button") {
280 auto ptr = make_element_by_type<movements_sort_order_button>(
state,
id, movements_sort_order::size);
281 ptr->base_data.position.y -= 1;
283 }
else if(
name ==
"sortby_radical_button") {
284 auto ptr = make_element_by_type<movements_sort_order_button>(
state,
id, movements_sort_order::radicalism);
285 ptr->base_data.position.y -= 1;
287 }
else if(
name ==
"sortby_name_button") {
288 return make_element_by_type<movements_sort_order_button>(
state,
id, movements_sort_order::name);
289 }
else if(
name ==
"rebel_listbox") {
290 return make_element_by_type<movements_rebel_list>(
state,
id);
291 }
else if(
name ==
"movements_listbox") {
292 auto ptr = make_element_by_type<movements_list>(
state,
id);
293 movements_listbox = ptr.
get();
295 }
else if(
name ==
"suppression_value") {
296 return make_element_by_type<nation_suppression_points_text>(
state,
id);
304 auto enum_val = any_cast<movements_sort_order>(payload);
305 movements_listbox->
order = enum_val;
307 return message_result::consumed;
309 return message_result::unseen;
void impl_on_update(sys::state &state) noexcept override
virtual message_result get(sys::state &state, Cyto::Any &payload) noexcept
void set_visible(sys::state &state, bool vis)
std::vector< dcon::movement_id > row_contents
void update(sys::state &state)
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
dcon::movement_id content
std::string_view get_row_element_name() override
movements_sort_order order
void on_update(sys::state &state) noexcept 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
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
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::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
std::string get_text(sys::state &state, dcon::rebel_faction_id rebel_faction_id) noexcept override
tooltip_behavior has_tooltip(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
std::string get_text(sys::state &state, dcon::rebel_faction_id rebel_faction_id) noexcept override
std::string get_text(sys::state &state, dcon::rebel_faction_id rebel_faction_id) noexcept override
std::string get_text(sys::state &state, dcon::rebel_faction_id rebel_faction_id) noexcept override
std::string get_text(sys::state &state, dcon::rebel_faction_id rebel_faction_id) noexcept override
void on_update(sys::state &state) noexcept override
bool can_suppress_movement(sys::state &state, dcon::nation_id source, dcon::movement_id m)
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
int32_t get_faction_brigades_active(sys::state &state, dcon::rebel_faction_id r)
float get_faction_organization(sys::state &state, dcon::rebel_faction_id r)
std::string rebel_name(sys::state &state, dcon::rebel_faction_id reb)
float get_faction_revolt_risk(sys::state &state, dcon::rebel_faction_id r)
int32_t get_faction_brigades_ready(sys::state &state, dcon::rebel_faction_id r)
std::string prettify(int64_t num)
void add_line(sys::state &state, layout_base &dest, dcon::text_key txt, int32_t indent)
std::string format_percentage(float num, size_t digits)
int32_t to_generic(dcon::province_id v)
void effect_description(sys::state &state, text::layout_base &layout, dcon::effect_key k, int32_t primary_slot, int32_t this_slot, int32_t from_slot, uint32_t r_lo, uint32_t r_hi)
void send(sys::state &state, element_base *parent, T value)
void trigger_description(sys::state &state, text::layout_base &layout, dcon::trigger_key k, int32_t primary_slot=-1, int32_t this_slot=-1, int32_t from_slot=-1)