10 auto location =
state.world.pop_get_province_from_pop_location(ids);
11 auto owner =
state.world.province_get_nation_from_province_ownership(
location);
15 state.defines.conversion_scale *
16 (
state.world.province_get_modifier_values(
location, sys::provincial_mod_offsets::conversion_rate) + 1.0f) *
17 (
state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::global_conversion_rate) + 1.0f) *
20 auto pr =
state.world.pop_get_religion(ids);
21 auto state_religion =
state.world.nation_get_religion(owner);
24 if(state_religion == pr)
34 if(state_religion == pr) {
56 auto loc =
state.world.pop_get_province_from_pop_location(ids);
59 if(
state.world.province_get_is_colonial(loc)) {
63 if(
state.world.pop_get_poptype(ids) ==
state.culture_definitions.slaves) {
68 auto owners =
state.world.province_get_nation_from_province_ownership(loc);
70 auto prov_mod = (
state.world.province_get_modifier_values(loc, sys::provincial_mod_offsets::immigrant_push) + 1.0f);
71 auto scale =
state.defines.immigration_scale;
83 auto loc =
state.world.pop_get_province_from_pop_location(ids);
84 auto owner =
state.world.province_get_nation_from_province_ownership(loc);
87 if(
state.world.nation_get_is_colonial_nation(owner) ==
false) {
91 if(
state.world.province_get_is_colonial(loc)) {
95 auto pt =
state.world.pop_get_poptype(ids);
96 if(pt ==
state.culture_definitions.slaves) {
104 if(pt ==
state.culture_definitions.primary_factory_worker || pt ==
state.culture_definitions.secondary_factory_worker) {
110 auto im_push = (
state.world.province_get_modifier_values(loc, sys::provincial_mod_offsets::immigrant_push) + 1.0f);
111 auto cmig = (
state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::colonial_migration) + 1.0f);
112 auto scale =
state.defines.immigration_scale;
126 auto loc =
state.world.pop_get_province_from_pop_location(ids);
127 auto owners =
state.world.province_get_nation_from_province_ownership(loc);
129 if(
state.world.nation_get_is_civilized(
owners) ==
false) {
133 if(
state.world.province_get_is_colonial(loc)) {
137 if(
state.world.pop_get_poptype(ids) ==
state.culture_definitions.slaves) {
141 if(
state.world.culture_group_get_is_overseas(
142 state.world.culture_get_group_from_culture_group_membership(
state.world.pop_get_culture(ids))) ==
false) {
147 auto impush = (
state.world.province_get_modifier_values(loc, sys::provincial_mod_offsets::immigrant_push) + 1.0f);
149 auto scale =
state.defines.immigration_scale;
169 auto loc =
state.world.pop_get_province_from_pop_location(ids);
170 auto si =
state.world.province_get_state_membership(loc);
171 auto nf =
state.world.state_instance_get_owner_focus(si);
172 auto promoted_type =
state.world.national_focus_get_promotion_type(nf);
173 auto promotion_bonus =
state.world.national_focus_get_promotion_amount(nf);
174 auto ptype =
state.world.pop_get_poptype(ids);
175 auto strata =
state.world.pop_type_get_strata(ptype);
179 if(promoted_type == ptype) {
181 }
else if(
state.world.pop_type_get_strata(promoted_type) >= strata) {
183 promotion_chance += promotion_bonus;
184 }
else if(
state.world.pop_type_get_strata(promoted_type) <= strata) {
185 demotion_chance += promotion_bonus;
195 if(promoted_type == ptype) {
197 }
else if(
state.world.pop_type_get_strata(promoted_type) >= strata) {
199 }
else if(
state.world.pop_type_get_strata(promoted_type) <= strata) {
208 if(promotion_chance <= 0.0f && demotion_chance <= 0.0f) {
213 bool promoting = promotion_chance >= demotion_chance;
229 auto loc =
state.world.pop_get_province_from_pop_location(ids);
230 auto owner =
state.world.province_get_nation_from_province_ownership(loc);
233 auto types =
state.world.pop_get_poptype(ids);
235 float lx_mod =
state.world.pop_get_luxury_needs_satisfaction(ids) *
state.defines.con_luxury_goods;
237 state.defines.con_poor_clergy :
state.defines.con_midrich_clergy);
238 float lit_mod = ((
state.world.nation_get_plurality(owner) / 10.0f) *
239 (
state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::literacy_con_impact) + 1.0f) *
240 state.defines.con_literacy *
state.world.pop_get_literacy(ids) *
241 (
state.world.province_get_is_colonial(loc) ?
state.defines.con_colonial_factor : 1.0f)) / 10.f;
243 float pmod =
state.world.province_get_modifier_values(loc, sys::provincial_mod_offsets::pop_consciousness_modifier);
244 float omod =
state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::global_pop_consciousness_modifier);
245 float cmod = (
state.world.province_get_is_colonial(loc) ? 0.0f :
246 state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::core_pop_consciousness_modifier));
248 float local_mod = (pmod + omod) + cmod;
250 float sep_mod = (
state.world.pop_get_is_primary_or_accepted_culture(ids) ? 0.0f :
251 state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::non_accepted_pop_consciousness_modifier));
252 auto old_con =
state.world.pop_get_consciousness(ids) * 0.01f;
253 auto total = (lx_mod + (cl_mod + lit_mod - old_con)) + (local_mod + sep_mod);
276 text::fp_percentage{
state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::literacy_con_impact) + 1.0f},
282 if(
state.world.province_get_is_colonial(loc)) {
311 if(!
state.world.province_get_is_colonial(loc)) {
323 if(!
state.world.pop_get_is_primary_or_accepted_culture(ids)) {
342 auto loc =
state.world.pop_get_province_from_pop_location(ids);
343 auto owner =
state.world.province_get_nation_from_province_ownership(loc);
347 float lx_mod = std::max(
state.world.pop_get_luxury_needs_satisfaction(ids) - 0.5f, 0.0f) *
state.defines.mil_has_luxury_need;
348 float con_sup = (
state.world.pop_get_demographics(ids, conservatism_key) *
state.defines.mil_ideology);
350 state.defines.mil_ruling_party
352 float ref_mod =
state.world.province_get_is_colonial(loc)
354 : (
state.world.pop_get_social_reform_desire(ids) +
state.world.pop_get_political_reform_desire(ids)) *
355 (
state.defines.mil_require_reform * 0.25f);
357 float sub_t = (lx_mod + ruling_sup) + (con_sup + ref_mod);
359 auto o_spending =
state.world.nation_get_overseas_penalty(owner);
360 auto spending_level =
state.world.nation_get_spending_level(owner);
361 auto overseas_mil = 0.f;
363 overseas_mil = 2.f *
state.defines.alice_overseas_mil * (0.5f - (o_spending * spending_level));
366 float pmod =
state.world.province_get_modifier_values(loc, sys::provincial_mod_offsets::pop_militancy_modifier);
367 float omod =
state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::global_pop_militancy_modifier);
368 float cmod = (
state.world.province_get_is_colonial(loc) ? 0.0f :
369 state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::core_pop_militancy_modifier));
371 float local_mod = (pmod + omod) + cmod;
373 float sep_mod = (
state.world.pop_get_is_primary_or_accepted_culture(ids) ? 0.0f :
374 (
state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::non_accepted_pop_militancy_modifier) + 1.0f) *
375 state.defines.mil_non_accepted);
376 float ln_mod = std::min((
state.world.pop_get_life_needs_satisfaction(ids) - 0.5f), 0.0f) *
state.defines.mil_no_life_need;
378 std::min(0.0f, (
state.world.pop_get_everyday_needs_satisfaction(ids) - 0.5f)) *
state.defines.mil_lack_everyday_need;
380 std::max(0.0f, (
state.world.pop_get_everyday_needs_satisfaction(ids) - 0.5f)) *
state.defines.mil_has_everyday_need;
382 float war_exhaustion =
383 state.world.nation_get_war_exhaustion(owner) *
state.defines.mil_war_exhaustion;
384 auto old_mil =
state.world.pop_get_militancy(ids) * 0.01f;
385 float total = (sub_t + local_mod) + ((sep_mod - ln_mod - old_mil) + (en_mod_b - en_mod_a) + (war_exhaustion + overseas_mil));
404 if(en_mod_b - en_mod_a >= 0) {
440 if(!
state.world.province_get_is_colonial(loc)) {
452 if(!
state.world.pop_get_is_primary_or_accepted_culture(ids)) {
459 if(war_exhaustion > 0) {
466 if(overseas_mil <= 0) {
480 auto loc =
state.world.pop_get_province_from_pop_location(ids);
481 auto owner =
state.world.province_get_nation_from_province_ownership(loc);
485 auto tmod =
state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::education_efficiency) + 1.0f;
486 auto nmod =
state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::education_efficiency_modifier) + 1.0f;
488 (float(
state.world.nation_get_education_spending(owner)) / 100.0f) *
state.world.nation_get_spending_level(owner);
489 auto cmod = std::max(0.0f, std::min(1.0f, (cfrac -
state.defines.base_clergy_for_literacy) /
490 (
state.defines.max_clergy_for_literacy -
state.defines.base_clergy_for_literacy)));
492 float total = (0.01f *
state.defines.literacy_change_speed) * ((espending * cmod) * (tmod * nmod));
519 auto type =
state.world.pop_get_poptype(ids);
521 auto loc =
state.world.pop_get_province_from_pop_location(ids);
522 auto owner =
state.world.province_get_nation_from_province_ownership(loc);
524 auto base_life_rating = float(
state.world.province_get_life_rating(loc));
525 auto mod_life_rating = std::min(
526 base_life_rating * (
state.world.province_get_modifier_values(loc, sys::provincial_mod_offsets::life_rating) + 1.0f), 40.0f);
528 std::max((mod_life_rating -
state.defines.min_life_rating_for_growth) *
state.defines.life_rating_growth_bonus, 0.0f);
529 auto province_factor = lr_factor +
state.defines.base_popgrowth;
531 auto ln_factor =
state.world.pop_get_life_needs_satisfaction(ids) -
state.defines.life_need_starvation_limit;
532 auto mod_sum =
state.world.province_get_modifier_values(loc, sys::provincial_mod_offsets::population_growth) +
533 state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::pop_growth);
535 auto total_factor = ln_factor * province_factor * 4.0f + mod_sum * 0.1f;
537 if(
type ==
state.culture_definitions.slaves)
543 if(total_factor >= 0) {
554 if(
type ==
state.culture_definitions.slaves) {
581 auto location =
state.world.pop_get_province_from_pop_location(ids);
582 auto owner =
state.world.province_get_nation_from_province_ownership(
location);
586 state.defines.assimilation_scale *
587 (
state.world.province_get_modifier_values(
location, sys::provincial_mod_offsets::assimilation_rate) + 1.0f) *
588 (
state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::global_assimilation_rate) + 1.0f) *
589 assimilation_chances;
597 auto pc =
state.world.pop_get_culture(ids);
598 if(!
state.world.culture_group_get_is_overseas(
state.world.culture_get_group_from_culture_group_membership(pc))) {
599 base_amount /= 10.0f;
608 if(core.get_identity().get_primary_culture() == pc) {
609 base_amount /= 100.0f;
614 if(
state.world.pop_get_poptype(ids) ==
state.culture_definitions.slaves)
618 if(
state.world.pop_get_is_primary_or_accepted_culture(ids))
628 if(
state.world.pop_get_poptype(ids) ==
state.culture_definitions.slaves) {
632 if(
state.world.pop_get_is_primary_or_accepted_culture(ids)) {
651 if(!
state.world.culture_group_get_is_overseas(
state.world.culture_get_group_from_culture_group_membership(pc))) {
654 float core_factor = 1.0f;
656 if(core.get_identity().get_primary_culture() == pc) {
657 core_factor /= 100.0f;
660 if(core_factor < 1.0f) {
669 static const std::vector<dcon::pop_id> empty{};
681 win->impl_get(
state, payload);
682 id = any_cast<dcon::pop_id>(payload);
690 Cyto::Any payload = dcon::state_instance_id{};
691 parent->impl_get(
state, payload);
694 pop_window->focus_state = any_cast<dcon::state_instance_id>(payload);
695 pop_window->nf_win->set_visible(
state, !pop_window->nf_win->is_visible());
696 pop_window->nf_win->base_data.position = base_data.position;
697 pop_window->move_child_to_front(pop_window->nf_win);
698 pop_window->impl_on_update(
state);
constexpr dcon::demographics_key total(0)
dcon::demographics_key to_key(sys::state const &state, dcon::pop_type_id v)
dcon::nation_id owner_of_pop(sys::state const &state, dcon::pop_id pop_ids)
dcon::pop_demographics_key to_key(sys::state const &state, dcon::ideology_id v)
bool is_overseas(sys::state const &state, dcon::province_id ids)
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_line(sys::state &state, layout_base &dest, dcon::text_key txt, int32_t indent)
void add_line_break_to_layout(sys::state &state, columnar_layout &dest)
void add_space_to_layout_box(sys::state &state, layout_base &dest, layout_box &box)
void close_layout_box(columnar_layout &dest, layout_box &box)
int32_t to_generic(dcon::province_id v)
float evaluate_additive_modifier(sys::state &state, dcon::value_modifier_key modifier, int32_t primary, int32_t this_slot, int32_t from_slot)
void describe_conversion(sys::state &state, text::columnar_layout &contents, dcon::pop_id ids)
std::vector< dcon::pop_id > const & get_pop_window_list(sys::state &state)
void describe_mil(sys::state &state, text::columnar_layout &contents, dcon::pop_id ids)
void describe_growth(sys::state &state, text::columnar_layout &contents, dcon::pop_id ids)
void additive_value_modifier_description(sys::state &state, text::layout_base &layout, dcon::value_modifier_key modifier, int32_t primary, int32_t this_slot, int32_t from_slot)
void describe_emigration(sys::state &state, text::columnar_layout &contents, dcon::pop_id ids)
void describe_lit(sys::state &state, text::columnar_layout &contents, dcon::pop_id ids)
void describe_migration(sys::state &state, text::columnar_layout &contents, dcon::pop_id ids)
void describe_con(sys::state &state, text::columnar_layout &contents, dcon::pop_id ids)
void describe_promotion_demotion(sys::state &state, text::columnar_layout &contents, dcon::pop_id ids)
void describe_colonial_migration(sys::state &state, text::columnar_layout &contents, dcon::pop_id ids)
void describe_assimilation(sys::state &state, text::columnar_layout &contents, dcon::pop_id ids)
dcon::pop_id get_pop_details_pop(sys::state &state)
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 * population_subwindow