25 if(
state.world.nation_get_is_mobilized(n)) {
47 auto n =
state.local_player_nation;
48 if(
state.world.nation_get_is_mobilized(n) ==
false) {
52 int32_t cur_mobilization = 0;
53 for(
const auto ac :
state.world.nation_get_army_control_as_controller(n)) {
54 for(
const auto am : ac.get_army().get_army_membership()) {
55 auto pop = am.get_regiment().get_pop_from_regiment_source();
56 if(pop.get_poptype() !=
state.culture_definitions.soldiers
57 && pop.get_poptype() !=
state.culture_definitions.slaves
58 && pop.get_is_primary_or_accepted_culture()
64 int32_t rem_mobilization = 0;
65 auto schedule_array =
state.world.nation_get_mobilization_schedule(n);
66 for(
const auto s : schedule_array) {
67 for(
const auto pl :
state.world.province_get_pop_location(s.where)) {
68 auto pop = pl.get_pop();
69 if(pop.get_poptype() !=
state.culture_definitions.soldiers
70 && pop.get_poptype() !=
state.culture_definitions.slaves
71 && pop.get_is_primary_or_accepted_culture()
77 int32_t total_mobilization = cur_mobilization + rem_mobilization;
78 if(total_mobilization == 0) {
82 progress = float(cur_mobilization) / float(total_mobilization);
89 auto n =
state.local_player_nation;
90 if(
state.world.nation_get_is_mobilized(n) ==
false) {
94 int32_t cur_mobilization = 0;
95 for(
const auto ac :
state.world.nation_get_army_control_as_controller(n)) {
96 for(
const auto am : ac.get_army().get_army_membership()) {
97 auto pop = am.get_regiment().get_pop_from_regiment_source();
103 int32_t rem_mobilization = 0;
104 auto schedule_array =
state.world.nation_get_mobilization_schedule(n);
105 for(
const auto s : schedule_array) {
106 for(
const auto pl :
state.world.province_get_pop_location(s.where)) {
107 auto pop = pl.get_pop();
113 int32_t total_mobilization = cur_mobilization + rem_mobilization;
114 if(total_mobilization == 0) {
132 auto real_regs = std::max(int32_t(
state.world.nation_get_recruitable_regiments(
state.local_player_nation)), int32_t(
state.defines.min_mobilize_limit));
163 return state.world.nation_get_mobilized_is_ai_controlled(
state.local_player_nation);
184 auto win1 = make_element_by_type<military_units_window<dcon::army_id>>(
state,
191 auto win2 = make_element_by_type<military_units_window<dcon::navy_id>>(
state,
193 win2->base_data.position =
state.ui_defs.gui[
state.ui_state.
defs_by_name.find(
state.lookup_key(
"navy_pos"))->second.definition].position;
197 auto miac_btn = make_element_by_type<military_mobilized_is_ai_controlled>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"alice_military_mobilized_is_ai_controlled"))->second.definition);
200 auto build_units_window = make_element_by_type<build_unit_large_window>(
state,
202 build_units_window->base_data.position.y -= 63;
203 build_units_window->base_data.position.x += 1;
205 build_units_window->set_visible(
state,
false);
212 if(
name ==
"main_bg") {
213 return make_element_by_type<image_element_base>(
state,
id);
214 }
else if(
name ==
"bg_military") {
215 return make_element_by_type<opaque_element_base>(
state,
id);
216 }
else if(
name ==
"headline_military") {
217 return make_element_by_type<simple_text_element_base>(
state,
id);
218 }
else if(
name ==
"close_button") {
219 return make_element_by_type<generic_close_button>(
state,
id);
220 }
else if(
name ==
"icon_army") {
221 return make_element_by_type<image_element_base>(
state,
id);
222 }
else if(
name ==
"icon_navy") {
223 return make_element_by_type<image_element_base>(
state,
id);
224 }
else if(
name ==
"mobilize") {
225 return make_element_by_type<military_mob_button>(
state,
id);
226 }
else if(
name ==
"demobilize") {
227 return make_element_by_type<invisible_element>(
state,
id);
228 }
else if(
name ==
"mobilize_progress") {
229 return make_element_by_type<military_mob_progress_bar>(
state,
id);
230 }
else if(
name ==
"mobilize_progress_frame") {
231 return make_element_by_type<image_element_base>(
state,
id);
232 }
else if(
name ==
"mobilize_progress_text") {
233 return make_element_by_type<military_mob_progress_bar_text>(
state,
id);
234 }
else if(
name ==
"mob_size_label") {
235 return make_element_by_type<simple_text_element_base>(
state,
id);
236 }
else if(
name ==
"mob_size") {
237 return make_element_by_type<military_mob_size_text>(
state,
id);
238 }
else if(
name ==
"mob_impact_label") {
239 return make_element_by_type<simple_text_element_base>(
state,
id);
240 }
else if(
name ==
"mob_impact") {
241 return make_element_by_type<military_mob_impact_text>(
state,
id);
242 }
else if(
name ==
"leaders") {
243 return make_element_by_type<leaders_window>(
state,
id);
244 }
else if(
name ==
"stats") {
245 return make_element_by_type<stats_window>(
state,
id);
252 if(payload.holds_type<dcon::nation_id>()) {
253 payload.emplace<dcon::nation_id>(
state.local_player_nation);
void add_child_to_front(std::unique_ptr< element_base > child) noexcept final
virtual message_result get(sys::state &state, Cyto::Any &payload) 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
void on_update(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 on_update(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
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
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
bool is_active(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
void on_create(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_create(sys::state &state) noexcept override
@ toggle_mobilized_is_ai_controlled
float mobilization_size(sys::state const &state, dcon::nation_id n)
float mobilization_impact(sys::state const &state, dcon::nation_id n)
bool pop_eligible_for_mobilization(sys::state &state, dcon::pop_id p)
int32_t mobilized_regiments_pop_limit(sys::state &state, dcon::nation_id n)
void add_line(sys::state &state, layout_base &dest, dcon::text_key txt, int32_t indent)
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
std::string format_percentage(float num, size_t digits)
void active_modifiers_description(sys::state &state, text::layout_base &layout, dcon::nation_id n, int32_t identation, dcon::national_modifier_value nmid, bool header)
element_base * military_subwindow
element_base * unit_window_army
element_base * unit_window_navy
ankerl::unordered_dense::map< dcon::text_key, element_target, hash_text_key > defs_by_name
element_base * build_unit_window