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);
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) *
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));
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);
350 float ref_mod =
state.world.province_get_is_colonial(loc)
353 (
state.defines.mil_require_reform * 0.25f);
355 float sub_t = (lx_mod + ruling_sup) + (con_sup + ref_mod);
357 auto o_spending =
state.world.nation_get_overseas_penalty(owner);
358 auto spending_level =
state.world.nation_get_spending_level(owner);
359 auto overseas_mil = 0.f;
361 overseas_mil = 2.f *
state.defines.alice_overseas_mil * (0.5f - (o_spending * spending_level));
364 float pmod =
state.world.province_get_modifier_values(loc, sys::provincial_mod_offsets::pop_militancy_modifier);
365 float omod =
state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::global_pop_militancy_modifier);
366 float cmod = (
state.world.province_get_is_colonial(loc) ? 0.0f :
367 state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::core_pop_militancy_modifier));
369 float local_mod = (pmod + omod) + cmod;
371 float sep_mod = (
state.world.pop_get_is_primary_or_accepted_culture(ids) ? 0.0f :
372 (
state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::non_accepted_pop_militancy_modifier) + 1.0f) *
373 state.defines.mil_non_accepted);
380 float war_exhaustion =
381 state.world.nation_get_war_exhaustion(owner) *
state.defines.mil_war_exhaustion;
383 float total = (sub_t + local_mod) + ((sep_mod - ln_mod - old_mil) + (en_mod_b - en_mod_a) + (war_exhaustion + overseas_mil));
402 if(en_mod_b - en_mod_a >= 0) {
438 if(!
state.world.province_get_is_colonial(loc)) {
450 if(!
state.world.pop_get_is_primary_or_accepted_culture(ids)) {
457 if(war_exhaustion > 0) {
464 if(overseas_mil <= 0) {
478 auto loc =
state.world.pop_get_province_from_pop_location(ids);
479 auto owner =
state.world.province_get_nation_from_province_ownership(loc);
483 auto tmod =
state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::education_efficiency) + 1.0f;
484 auto nmod =
state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::education_efficiency_modifier) + 1.0f;
486 (float(
state.world.nation_get_education_spending(owner)) / 100.0f) *
state.world.nation_get_spending_level(owner);
487 auto cmod = std::max(0.0f, std::min(1.0f, (cfrac -
state.defines.base_clergy_for_literacy) /
488 (
state.defines.max_clergy_for_literacy -
state.defines.base_clergy_for_literacy)));
490 float total = (0.01f *
state.defines.literacy_change_speed) * ((espending * cmod) * (tmod * nmod));
517 auto type =
state.world.pop_get_poptype(ids);
519 auto loc =
state.world.pop_get_province_from_pop_location(ids);
520 auto owner =
state.world.province_get_nation_from_province_ownership(loc);
522 auto base_life_rating = float(
state.world.province_get_life_rating(loc));
523 auto mod_life_rating = std::min(
524 base_life_rating * (
state.world.province_get_modifier_values(loc, sys::provincial_mod_offsets::life_rating) + 1.0f), 40.0f);
526 std::max((mod_life_rating -
state.defines.min_life_rating_for_growth) *
state.defines.life_rating_growth_bonus, 0.0f);
527 auto province_factor = lr_factor +
state.defines.base_popgrowth;
530 auto mod_sum =
state.world.province_get_modifier_values(loc, sys::provincial_mod_offsets::population_growth) +
state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::pop_growth);
532 auto total_factor = ln_factor * province_factor * 4.0f + mod_sum * 0.1f;
534 if(
type ==
state.culture_definitions.slaves)
540 if(total_factor >= 0) {
551 if(
type ==
state.culture_definitions.slaves) {
578 auto location =
state.world.pop_get_province_from_pop_location(ids);
579 auto owner =
state.world.province_get_nation_from_province_ownership(
location);
583 state.defines.assimilation_scale *
584 (
state.world.province_get_modifier_values(
location, sys::provincial_mod_offsets::assimilation_rate) + 1.0f) *
585 (
state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::global_assimilation_rate) + 1.0f) *
586 assimilation_chances;
594 auto pc =
state.world.pop_get_culture(ids);
595 if(!
state.world.culture_group_get_is_overseas(
state.world.culture_get_group_from_culture_group_membership(pc))) {
596 base_amount /= 10.0f;
605 if(core.get_identity().get_primary_culture() == pc) {
606 base_amount /= 100.0f;
611 if(
state.world.pop_get_poptype(ids) ==
state.culture_definitions.slaves)
615 if(
state.world.pop_get_is_primary_or_accepted_culture(ids))
625 if(
state.world.pop_get_poptype(ids) ==
state.culture_definitions.slaves) {
629 if(
state.world.pop_get_is_primary_or_accepted_culture(ids)) {
648 if(!
state.world.culture_group_get_is_overseas(
state.world.culture_get_group_from_culture_group_membership(pc))) {
651 float core_factor = 1.0f;
653 if(core.get_identity().get_primary_culture() == pc) {
654 core_factor /= 100.0f;
657 if(core_factor < 1.0f) {
666 static const std::vector<dcon::pop_id> empty{};
678 win->impl_get(
state, payload);
679 id = any_cast<dcon::pop_id>(payload);
687 Cyto::Any payload = dcon::state_instance_id{};
688 parent->impl_get(
state, payload);
691 pop_window->focus_state = any_cast<dcon::state_instance_id>(payload);
692 pop_window->nf_win->set_visible(
state, !pop_window->nf_win->is_visible());
693 pop_window->nf_win->base_data.position = base_data.position;
694 pop_window->move_child_to_front(pop_window->nf_win);
695 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)
float get_social_reform_desire(sys::state const &state, dcon::pop_id p)
float get_luxury_needs(sys::state const &state, dcon::pop_id p)
dcon::pop_demographics_key to_key(sys::state const &state, dcon::ideology_id v)
float get_literacy(sys::state const &state, dcon::pop_id p)
float get_consciousness(sys::state const &state, dcon::pop_id p)
float get_militancy(sys::state const &state, dcon::pop_id p)
float get_life_needs(sys::state const &state, dcon::pop_id p)
float get_political_reform_desire(sys::state const &state, dcon::pop_id p)
float get_everyday_needs(sys::state const &state, dcon::pop_id p)
float get_demo(sys::state const &state, dcon::pop_id p, dcon::pop_demographics_key k)
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