55 auto content = retrieve<dcon::province_id>(
state,
parent);
59 }
else if(result < 0) {
74 auto content = retrieve<dcon::province_id>(
state,
parent);
91 auto content = retrieve<dcon::state_instance_id>(
state,
parent);
95 }
else if(result < 0) {
110 auto content = retrieve<dcon::state_instance_id>(
state,
parent);
127 auto content = retrieve<dcon::nation_id>(
state,
parent);
131 }
else if(result < 0) {
146 auto content = retrieve<dcon::nation_id>(
state,
parent);
165 auto content = retrieve<dcon::pop_id>(
state,
parent);
168 auto rebel_fact = fat_id.get_pop_rebellion_membership().get_rebel_faction().get_type();
171 auto icon = rebel_fact.get_icon();
172 return int32_t(icon - 1);
194 auto content = retrieve<dcon::pop_id>(
state,
parent);
196 auto rebel_fact = fat_id.get_pop_rebellion_membership().get_rebel_faction().get_type();
200 if(
auto desc = rebel_fact.get_description();
state.key_is_localized(desc)) {
217 auto content = retrieve<dcon::pop_id>(
state,
parent);
220 auto movement_fact = fat_id.get_pop_movement_membership().get_movement().get_associated_issue_option();
222 auto parent_issue = movement_fact.get_parent_issue();
227 for(;
count < int32_t(
state.culture_definitions.social_issues.size()); ++
count) {
228 if(
state.culture_definitions.social_issues[
count] == parent_issue)
249 auto content = retrieve<dcon::pop_id>(
state,
parent);
251 auto movement_fact = fat_id.get_pop_movement_membership();
254 auto movement_issue = movement_fact.get_movement().get_associated_issue_option();
272 auto content = retrieve<dcon::pop_id>(
state,
parent);
274 auto movement_fact = fat_id.get_pop_movement_membership().get_movement().get_associated_issue_option();
276 auto parent_issue = movement_fact.get_parent_issue();
281 for(;
count < int32_t(
state.culture_definitions.political_issues.size()); ++
count) {
282 if(
state.culture_definitions.political_issues[
count] == parent_issue)
303 auto content = retrieve<dcon::pop_id>(
state,
parent);
305 auto movement_fact = fat_id.get_pop_movement_membership();
308 auto movement_issue = movement_fact.get_movement().get_associated_issue_option();
327 auto movement =
state.world.pop_get_movement_from_pop_movement_membership(pop);
329 if(
auto id =
state.world.movement_get_associated_independence(movement);
id) {
337 return dcon::national_identity_id{};
360 auto content = retrieve<dcon::pop_id>(
state,
parent);
369 auto content = retrieve<dcon::pop_id>(
state,
parent);
380 auto content = retrieve<dcon::pop_id>(
state,
parent);
399 auto total = int64_t(growth) + promote + assimilation + conversion + internal_migration + colonial_migration + emigration;
438 if(assimilation >= 0) {
449 if(internal_migration >= 0) {
460 if(colonial_migration >= 0) {
471 if(emigration >= 0) {
482 if(conversion >= 0) {
497 auto loc =
state.world.pop_get_province_from_pop_location(pop);
549 auto content = retrieve<dcon::pop_id>(
state,
parent);
565 auto content = retrieve<dcon::pop_id>(
state,
parent);
573 }
else if(result < 0) {
621 auto content = retrieve<dcon::pop_id>(
state,
parent);
639 auto content = retrieve<dcon::pop_id>(
state,
parent);
655 if(
state.world.pop_type_get_has_unemployment(
state.world.pop_get_poptype(content)))
656 return (1 - pfat_id.get_employment() / pfat_id.get_size());
665 auto content = retrieve<dcon::pop_id>(
state,
parent);
668 float un_empl =
state.world.pop_type_get_has_unemployment(
state.world.pop_get_poptype(content))
669 ? (1 - pfat_id.get_employment() / pfat_id.get_size())
682 return fat_id.get_life_needs_satisfaction();
690 auto content = retrieve<dcon::pop_id>(
state,
parent);
707 return fat_id.get_everyday_needs_satisfaction();
715 auto content = retrieve<dcon::pop_id>(
state,
parent);
732 return fat_id.get_luxury_needs_satisfaction();
740 auto content = retrieve<dcon::pop_id>(
state,
parent);
756 state.world.for_each_issue_option(fun);
770 state.world.for_each_ideology(fun);
782using pop_left_side_data = std::variant< std::monostate, dcon::nation_id, dcon::state_instance_id, dcon::province_id>;
792 auto filter = any_cast<pop_list_filter>(filter_payload);
793 frame = std::holds_alternative<T>(filter) && std::get<T>(filter) ==
id ? 1 : 0;
809 if(
name ==
"poplistbutton") {
810 return make_element_by_type<pop_left_side_button<dcon::nation_id>>(
state, id);
811 }
else if(
name ==
"poplist_name") {
812 return make_element_by_type<generic_name_text<dcon::nation_id>>(
state, id);
813 }
else if(
name ==
"poplist_numpops") {
814 return make_element_by_type<nation_population_text>(
state,
id);
815 }
else if(
name ==
"growth_indicator") {
816 return make_element_by_type<nation_growth_indicator>(
state,
id);
834 auto id = retrieve<dcon::state_instance_id>(
state,
parent);
838 frame = std::get<bool>(any_cast<pop_left_side_expand_action>(payload)) ? 1 : 0;
844 auto id = retrieve<dcon::state_instance_id>(
state,
parent);
857 auto content = retrieve<dcon::state_instance_id>(
state,
parent);
858 return bool(
state.world.state_instance_get_owner_focus(content).id)
859 ?
state.world.state_instance_get_owner_focus(content).get_icon() - 1
864 auto content = retrieve<dcon::state_instance_id>(
state,
parent);
866 state.world.for_each_national_focus([&](dcon::national_focus_id nfid) {
874 auto content = retrieve<dcon::state_instance_id>(
state,
parent);
885 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
889 auto content =
state.world.state_instance_get_owner_focus(sid);
895 if(fat_nf.get_promotion_type()) {
897 if(fat_nf.get_promotion_type() ==
state.culture_definitions.clergy) {
901 }
else if(fat_nf.get_promotion_type() ==
state.culture_definitions.bureaucrat) {
911 if(
auto mid =
state.world.national_focus_get_modifier(content); mid) {
923 if(
name ==
"poplistbutton") {
924 return make_element_by_type<pop_left_side_button<dcon::state_instance_id>>(
state, id);
925 }
else if(
name ==
"poplist_name") {
926 return make_element_by_type<state_name_text>(
state,
id);
927 }
else if(
name ==
"poplist_numpops") {
928 return make_element_by_type<popwin_state_population>(
state,
id);
929 }
else if(
name ==
"colonial_state_icon") {
930 auto ptr = make_element_by_type<province_colony_button>(
state,
id);
931 colonial_icon = ptr.
get();
933 }
else if(
name ==
"state_focus") {
934 return make_element_by_type<pop_national_focus_button>(
state,
id);
935 }
else if(
name ==
"expand") {
936 return make_element_by_type<pop_left_side_expand_button>(
state,
id);
937 }
else if(
name ==
"growth_indicator") {
938 return make_element_by_type<state_growth_indicator>(
state,
id);
945 auto content = retrieve<dcon::state_instance_id>(
state,
parent);
952 if(
name ==
"poplistbutton") {
953 return make_element_by_type<pop_left_side_button<dcon::province_id>>(
state, id);
954 }
else if(
name ==
"poplist_name") {
955 return make_element_by_type<generic_name_text<dcon::province_id>>(
state, id);
956 }
else if(
name ==
"poplist_numpops") {
957 return make_element_by_type<province_population_text>(
state,
id);
958 }
else if(
name ==
"growth_indicator") {
959 return make_element_by_type<province_growth_indicator>(
state,
id);
975 auto ptr1 = make_element_by_type<pop_left_side_country_window>(
state,
977 country_window = ptr1.
get();
980 auto ptr2 = make_element_by_type<pop_left_side_state_window>(
state,
982 state_window = ptr2.
get();
985 auto ptr3 = make_element_by_type<pop_left_side_province_window>(
state,
987 province_window = ptr3.
get();
1002 }
else if(payload.holds_type<dcon::province_id>()) {
1003 if(std::holds_alternative<dcon::province_id>(
content))
1004 payload.emplace<dcon::province_id>(std::get<dcon::province_id>(
content));
1006 }
else if(payload.holds_type<dcon::state_instance_id>()) {
1007 if(std::holds_alternative<dcon::state_instance_id>(
content))
1008 payload.emplace<dcon::state_instance_id>(std::get<dcon::state_instance_id>(
content));
1010 }
else if(payload.holds_type<dcon::nation_id>()) {
1011 if(std::holds_alternative<dcon::nation_id>(
content))
1012 payload.emplace<dcon::nation_id>(std::get<dcon::nation_id>(
content));
1022 return "pop_left_side_list_base_window";
1034template<
typename T,
bool Multiple>
1037 auto const weight_fn = [&](T id,
float weight) {
1038 auto it = std::find_if(this->
distribution.begin(), this->distribution.end(), [
id](
auto& e) { return e.key == id; });
1040 it->value += weight;
1045 if constexpr(std::is_same_v<T, dcon::issue_option_id>) {
1046 for(
auto iopt :
state.world.in_issue_option) {
1049 }
else if constexpr(std::is_same_v<T, dcon::ideology_id>) {
1050 for(
auto iopt :
state.world.in_ideology) {
1053 }
else if constexpr(std::is_same_v<T, dcon::political_party_id>) {
1054 auto prov_id =
state.world.pop_location_get_province(
state.world.pop_get_pop_location_as_pop(pop_id));
1055 if(!
state.world.province_get_is_colonial(prov_id)) {
1056 auto tag =
state.world.nation_get_identity_from_identity_holder(
1057 state.world.province_get_nation_from_province_ownership(prov_id));
1058 auto start =
state.world.national_identity_get_political_party_first(tag).id.index();
1059 auto end = start +
state.world.national_identity_get_political_party_count(tag);
1060 for(int32_t i = start; i < end; i++) {
1061 auto pid = T(
typename T::value_base_t(i));
1064 state.world.province_get_nation_from_province_ownership(prov_id), prov_id);
1065 weight_fn(pid, support);
1069 }
else if constexpr(std::is_same_v<T, dcon::culture_id>) {
1070 auto size =
state.world.pop_get_size(pop_id);
1071 weight_fn(
state.world.pop_get_culture(pop_id).id,
size);
1072 }
else if constexpr(std::is_same_v<T, dcon::religion_id>) {
1073 auto size =
state.world.pop_get_size(pop_id);
1074 weight_fn(
state.world.pop_get_religion(pop_id).id,
size);
1075 }
else if constexpr(std::is_same_v<T, dcon::pop_type_id>) {
1076 auto size =
state.world.pop_get_size(pop_id);
1077 weight_fn(
state.world.pop_get_poptype(pop_id).id,
size);
1086 if constexpr(Multiple) {
1088 for(
auto const pop_id : pop_list)
1089 iterate_one_pop(
state, pop_id);
1116 if(
name ==
"legend_color") {
1117 return make_element_by_type<pop_distribution_plupp<T>>(
state, id);
1118 }
else if(
name ==
"legend_title") {
1119 return make_element_by_type<generic_name_text<T>>(
state, id);
1120 }
else if(
name ==
"legend_value") {
1121 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1122 value_text = ptr.
get();
1134 if(payload.holds_type<T>()) {
1146 return "pop_legend_item";
1150template<
typename T,
bool Multiple>
1156 if(
name ==
"item_name") {
1157 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1158 if constexpr(std::is_same_v<T, dcon::issue_option_id>) {
1160 }
else if constexpr(std::is_same_v<T, dcon::culture_id>) {
1162 }
else if constexpr(std::is_same_v<T, dcon::ideology_id>) {
1164 }
else if constexpr(std::is_same_v<T, dcon::religion_id>) {
1166 }
else if constexpr(std::is_same_v<T, dcon::pop_type_id>) {
1168 }
else if constexpr(std::is_same_v<T, dcon::political_party_id>) {
1172 }
else if(
name ==
"chart") {
1173 return make_element_by_type<pop_distribution_piechart<T, Multiple>>(
state, id);
1174 }
else if(
name ==
"member_names") {
1175 auto ptr = make_element_by_type<pop_distribution_listbox<T>>(
state, id);
1176 distrib_listbox = ptr.
get();
1186 std::unordered_map<typename T::value_base_t, float> distrib{};
1187 for(
auto const pop_id : pop_list) {
1188 auto const weight_fn = [&](
auto id) {
1190 distrib[
typename T::value_base_t(
id.index())] += weight;
1193 if constexpr(std::is_same_v<T, dcon::issue_option_id>)
1194 state.world.for_each_issue_option(weight_fn);
1195 else if constexpr(std::is_same_v<T, dcon::ideology_id>)
1196 state.world.for_each_ideology(weight_fn);
1198 if constexpr(std::is_same_v<T, dcon::culture_id>)
1199 distrib[
typename T::value_base_t(
state.world.pop_get_culture(pop_id).id.index())] +=
state.world.pop_get_size(pop_id);
1200 else if constexpr(std::is_same_v<T, dcon::religion_id>)
1201 distrib[
typename T::value_base_t(
state.world.pop_get_religion(pop_id).id.index())] +=
state.world.pop_get_size(pop_id);
1202 else if constexpr(std::is_same_v<T, dcon::pop_type_id>)
1203 distrib[
typename T::value_base_t(
state.world.pop_get_poptype(pop_id).id.index())] +=
state.world.pop_get_size(pop_id);
1204 else if constexpr(std::is_same_v<T, dcon::political_party_id>) {
1205 auto prov_id =
state.world.pop_location_get_province(
state.world.pop_get_pop_location_as_pop(pop_id));
1206 if(
state.world.province_get_is_colonial(prov_id))
1208 auto tag =
state.world.nation_get_identity_from_identity_holder(
1209 state.world.province_get_nation_from_province_ownership(prov_id));
1210 auto start =
state.world.national_identity_get_political_party_first(tag).id.index();
1211 auto end = start +
state.world.national_identity_get_political_party_count(tag);
1212 for(int32_t i = start; i < end; i++) {
1213 auto pid = T(
typename T::value_base_t(i));
1216 state.world.province_get_nation_from_province_ownership(prov_id), prov_id);
1217 distrib[
typename T::value_base_t(pid.index())] += support;
1223 std::vector<std::pair<T, float>> sorted_distrib{};
1224 for(
auto const& e : distrib)
1226 sorted_distrib.emplace_back(T(e.first), e.second);
1227 std::sort(sorted_distrib.begin(), sorted_distrib.end(),
1228 [&](std::pair<T, float> a, std::pair<T, float> b) { return a.second > b.second; });
1233 for(
auto const& e : sorted_distrib)
1235 for(
auto const& e : sorted_distrib)
1236 distrib_listbox->
row_contents.emplace_back(e.first, e.second / total);
1244 auto issue = retrieve<dcon::issue_option_id>(
state,
parent);
1254 auto issue = retrieve<dcon::issue_option_id>(
state,
parent);
1256 auto opt = fatten(
state.world, issue);
1257 auto allow = opt.get_allow();
1258 auto parent_issue = opt.get_parent_issue();
1262 auto has_modifier = is_social_issue || is_political_issue;
1264 auto modifier_key = is_social_issue ? sys::national_mod_offsets::social_reform_desire : sys::national_mod_offsets::political_reform_desire;
1269 auto current_issue_setting =
state.world.nation_get_issues(owner, parent_issue).id;
1270 auto allowed_by_owner = (
state.world.nation_get_is_civilized(owner) || is_party_issue) &&
1271 (allow ?
trigger::evaluate(
state, allow,
trigger::to_generic(owner),
trigger::to_generic(owner), 0) :
true) && (current_issue_setting != issue || is_party_issue) && (!
state.world.issue_get_is_next_step_only(parent_issue) || (current_issue_setting.index() == issue.index() - 1) || (current_issue_setting.index() == issue.index() + 1));
1272 auto owner_modifier = has_modifier ? (
state.world.nation_get_modifier_values(owner, modifier_key) + 1.0f) : 1.0f;
1273 auto pop_type =
state.world.pop_get_poptype(ids);
1275 if(!allowed_by_owner) {
1282 auto attraction_factor = [&]() {
1283 if(
auto mtrigger =
state.world.pop_type_get_issues(pop_type, issue); mtrigger) {
1296 if(is_social_issue) {
1302 if(
auto mtrigger =
state.world.pop_type_get_issues(pop_type, issue); mtrigger) {
1306 if(
auto mtrigger =
state.world.pop_type_get_issues(pop_type, issue); mtrigger) {
1320 if(
name ==
"legend_color") {
1321 return make_element_by_type<pop_distribution_plupp<dcon::issue_option_id>>(
state, id);
1322 }
else if(
name ==
"legend_title") {
1323 return make_element_by_type<issue_with_explanation>(
state,
id);
1324 }
else if(
name ==
"legend_value") {
1325 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1326 value_text = ptr.
get();
1336 c->impl_on_update(
state);
1340 if(payload.holds_type<dcon::issue_option_id>()) {
1351 return "pop_legend_item";
1360 if(
name ==
"item_name") {
1361 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1364 }
else if(
name ==
"chart") {
1365 return make_element_by_type<pop_distribution_piechart<dcon::issue_option_id, false>>(
state, id);
1366 }
else if(
name ==
"member_names") {
1367 auto ptr = make_element_by_type<pop_detailed_issue_distribution_listbox>(
state,
id);
1368 distrib_listbox = ptr.
get();
1378 std::vector<dcon::issue_option_id> distrib;
1379 for(
auto io :
state.world.in_issue_option) {
1382 distrib.push_back(io.id);
1385 std::sort(distrib.begin(), distrib.end(), [&](
auto a,
auto b) {
1386 return state.world.pop_get_demographics(pop, pop_demographics::to_key(state, a)) > state.world.pop_get_demographics(pop, pop_demographics::to_key(state, b));
1391 for(
auto const& e : distrib)
1400 auto issue = retrieve<dcon::ideology_id>(
state,
parent);
1410 auto i = retrieve<dcon::ideology_id>(
state,
parent);
1412 auto type =
state.world.pop_get_poptype(ids);
1414 if(
state.world.ideology_get_enabled(i)) {
1415 if(
state.world.ideology_get_is_civilized_only(i)) {
1417 auto ptrigger =
state.world.pop_type_get_ideology(
type, i);
1440 auto ptrigger =
state.world.pop_type_get_ideology(
type, i);
1473 if(
name ==
"legend_color") {
1474 return make_element_by_type<pop_distribution_plupp<dcon::ideology_id>>(
state, id);
1475 }
else if(
name ==
"legend_title") {
1476 return make_element_by_type<ideology_with_explanation>(
state,
id);
1477 }
else if(
name ==
"legend_value") {
1478 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1479 value_text = ptr.
get();
1491 if(payload.holds_type<dcon::ideology_id>()) {
1502 return "pop_legend_item";
1511 if(
name ==
"item_name") {
1512 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1515 }
else if(
name ==
"chart") {
1516 return make_element_by_type<pop_distribution_piechart<dcon::ideology_id, false>>(
state, id);
1517 }
else if(
name ==
"member_names") {
1518 auto ptr = make_element_by_type<pop_detailed_ideology_distribution_listbox>(
state,
id);
1519 distrib_listbox = ptr.
get();
1529 std::vector<dcon::ideology_id> distrib;
1530 for(
auto io :
state.world.in_ideology) {
1533 distrib.push_back(io.id);
1536 std::sort(distrib.begin(), distrib.end(), [&](
auto a,
auto b) {
1537 return state.world.pop_get_demographics(pop, pop_demographics::to_key(state, a)) > state.world.pop_get_demographics(pop, pop_demographics::to_key(state, b));
1542 for(
auto const& e : distrib)
1550 dcon::value_modifier_key mod_key{};
1551 dcon::pop_location_id pop_loc{};
1564 auto prov_id =
state.world.pop_location_get_province(pop_loc);
1565 auto pop_id =
state.world.pop_location_get_pop(pop_loc);
1566 auto nat_id =
state.world.province_get_nation_from_province_ownership(prov_id);
1571 if(payload.holds_type<dcon::pop_location_id>()) {
1572 pop_loc = any_cast<dcon::pop_location_id>(payload);
1575 }
else if(payload.holds_type<dcon::value_modifier_key>()) {
1576 mod_key = any_cast<dcon::value_modifier_key>(payload);
1579 }
else if(payload.holds_type<
float>()) {
1580 chance = any_cast<float>(payload);
1590 dcon::pop_type_id content{};
1597 if(
name ==
"pop_type") {
1598 auto ptr = make_element_by_type<fixed_pop_type_icon>(
state,
id);
1599 type_icon = ptr.
get();
1601 }
else if(
name ==
"percentage") {
1602 auto ptr = make_element_by_type<pop_details_promotion_percent_text>(
state,
id);
1603 percent_text = ptr.
get();
1615 if(payload.holds_type<dcon::pop_type_id>()) {
1616 content = any_cast<dcon::pop_type_id>(payload);
1619 }
else if(payload.holds_type<dcon::pop_location_id>() || payload.holds_type<dcon::value_modifier_key>() || payload.holds_type<
float>()) {
1635 if(
name ==
"goods_type") {
1636 auto ptr = make_element_by_type<commodity_image>(
state,
id);
1637 commodity_icon = ptr.
get();
1639 }
else if(
name ==
"value") {
1640 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1641 value_text = ptr.
get();
1653 if(payload.holds_type<dcon::commodity_id>()) {
1654 payload.emplace<dcon::commodity_id>(
content.first);
1663 return "popdetail_needs_entry";
1670 auto internal_migration =
1697 auto internal_migration =
1794 auto movement =
state.world.pop_get_movement_from_pop_movement_membership(pop);
1796 if(
auto issue =
state.world.movement_get_associated_issue_option(movement); issue) {
1798 }
else if(
auto independence_target =
state.world.movement_get_associated_independence(movement); independence_target) {
1799 if(
state.world.national_identity_get_cultural_union_of(independence_target)) {
1814 auto faction =
state.world.pop_get_rebel_faction_from_pop_rebellion_membership(pop);
1818 auto nation =
state.world.rebel_faction_get_ruler_from_rebellion_within(faction);
1820 auto culture =
state.world.rebel_faction_get_primary_culture(faction);
1821 auto defection_target =
state.world.rebel_faction_get_defection_target(faction);
1826 if(defection_target) {
1827 auto adjective =
state.world.national_identity_get_adjective(defection_target);
1842 if(
name ==
"rebel_faction") {
1843 return make_element_by_type<generic_rebel_name_text>(
state,
id);
1844 }
else if(
name ==
"rebel_faction_icon") {
1845 return make_element_by_type<pop_revolt_faction>(
state,
id);
1846 }
else if(
name ==
"pop_movement_icon") {
1847 return make_element_by_type<pop_movement_flag>(
state,
id);
1848 }
else if(
name ==
"pop_movement_social_icon") {
1849 return make_element_by_type<pop_movement_social>(
state,
id);
1850 }
else if(
name ==
"pop_movement_political_icon") {
1851 return make_element_by_type<pop_movement_political>(
state,
id);
1865 std::vector<element_base*> promotion_windows;
1866 std::vector<element_base*> dist_windows;
1871 template<std::size_t... Targs>
1872 void generate_promotion_items(
sys::state&
state, std::integer_sequence<std::size_t, Targs...>
const&) {
1873 const xy_pair cell_offset{312, 153};
1875 auto win = make_element_by_type<pop_details_promotion_window<Targs>>(
state,
1877 win->base_data.position.x = cell_offset.x + (Targs * win->base_data.size.x);
1878 win->base_data.position.y = cell_offset.y;
1879 promotion_windows.push_back(win.get());
1890 generate_promotion_items(
state, std::integer_sequence<std::size_t, 0, 1, 2, 3, 4, 5, 6>{});
1892 auto win = make_element_by_type<pop_detailed_ideology_distribution>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"distribution_window"))->second.definition);
1893 dist_windows.push_back(win.get());
1897 auto win = make_element_by_type<pop_detailed_issue_distribution>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"distribution_window"))->second.definition);
1898 dist_windows.push_back(win.get());
1906 state.ui_defs.gui[
state.ui_state.
defs_by_name.find(
state.lookup_key(
"popdetaildistribution_offset"))->second.definition].position;
1908 for(
auto const win : dist_windows) {
1909 win->base_data.position = offset;
1910 offset.
x += cell_size.
x;
1912 offset.
x = cell_offset.
x;
1913 offset.
y += cell_size.
y;
1919 if(
name ==
"close_button") {
1920 return make_element_by_type<generic_close_button>(
state,
id);
1921 }
else if(
name ==
"rebel_win") {
1922 return make_element_by_type<pop_rebels_details>(
state,
id);
1923 }
else if(
name ==
"background") {
1924 return make_element_by_type<draggable_target>(
state,
id);
1925 }
else if(
name ==
"pop_type_icon") {
1926 return make_element_by_type<pop_type_icon>(
state,
id);
1927 }
else if(
name ==
"pop_size") {
1928 return make_element_by_type<pop_size_text>(
state,
id);
1929 }
else if(
name ==
"pop_culture") {
1930 return make_element_by_type<pop_culture_text>(
state,
id);
1931 }
else if(
name ==
"pop_location") {
1932 return make_element_by_type<pop_location_text>(
state,
id);
1933 }
else if(
name ==
"internal_migration_label") {
1934 return make_element_by_type<pop_details_migration_label>(
state,
id);
1935 }
else if(
name ==
"internal_migration_val") {
1936 return make_element_by_type<pop_details_migration_value>(
state,
id);
1937 }
else if(
name ==
"colonial_migration_label") {
1938 return make_element_by_type<pop_details_colonial_migration_label>(
state,
id);
1939 }
else if(
name ==
"colonial_migration_val") {
1940 return make_element_by_type<pop_details_colonial_migration_value>(
state,
id);
1941 }
else if(
name ==
"growth_indicator") {
1942 return make_element_by_type<pop_growth_indicator>(
state,
id);
1943 }
else if(
name ==
"external_migration_label") {
1944 return make_element_by_type<pop_details_emigration_label>(
state,
id);
1945 }
else if(
name ==
"external_migration_val") {
1946 return make_element_by_type<pop_details_emigration_value>(
state,
id);
1947 }
else if(
name ==
"promotions_label") {
1948 return make_element_by_type<pop_details_promotion_label>(
state,
id);
1949 }
else if(
name ==
"promotions_val") {
1950 return make_element_by_type<pop_details_promotion_value>(
state,
id);
1951 }
else if(
name ==
"demotions_label") {
1952 return make_element_by_type<pop_details_promotion_label>(
state,
id);
1953 }
else if(
name ==
"demotions_val") {
1954 return make_element_by_type<pop_details_demotion_value>(
state,
id);
1955 }
else if(
name ==
"mil_value") {
1956 return make_element_by_type<pop_militancy_text>(
state,
id);
1957 }
else if(
name ==
"con_value") {
1958 return make_element_by_type<pop_con_text>(
state,
id);
1959 }
else if(
name ==
"literacy_value") {
1960 return make_element_by_type<pop_literacy_text>(
state,
id);
1961 }
else if(
name ==
"icon_religion") {
1962 return make_element_by_type<popwin_religion_type>(
state,
id);
1963 }
else if(
name ==
"money_value") {
1964 auto ptr = make_element_by_type<invisible_element>(
state,
id);
1967 }
else if(
name ==
"income_value") {
1968 auto ptr = make_element_by_type<invisible_element>(
state,
id);
1969 income_text = ptr.
get();
1971 }
else if(
name ==
"money_label") {
1972 auto ptr = make_element_by_type<invisible_element>(
state,
id);
1974 }
else if(
name ==
"income_label") {
1975 auto ptr = make_element_by_type<invisible_element>(
state,
id);
1977 }
else if(
name ==
"expenses_value") {
1978 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1979 expenses_text = ptr.
get();
1981 }
else if(
name ==
"bank_value") {
1982 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1983 savings_text = ptr.
get();
1985 }
else if(
name ==
"pop_unemployment_bar") {
1986 return make_element_by_type<pop_unemployment_progress_bar>(
state,
id);
1987 }
else if(
name ==
"lifeneed_progress") {
1988 return make_element_by_type<pop_life_needs_progress_bar>(
state,
id);
1989 }
else if(
name ==
"eveneed_progress") {
1990 return make_element_by_type<pop_everyday_needs_progress_bar>(
state,
id);
1991 }
else if(
name ==
"luxneed_progress") {
1992 return make_element_by_type<pop_luxury_needs_progress_bar>(
state,
id);
1993 }
else if(
name ==
"life_needs_list") {
1994 auto ptr = make_element_by_type<pop_details_needs_listbox>(
state,
id);
1995 life_needs_list = ptr.
get();
1997 }
else if(
name ==
"everyday_needs_list") {
1998 auto ptr = make_element_by_type<pop_details_needs_listbox>(
state,
id);
1999 everyday_needs_list = ptr.
get();
2001 }
else if(
name ==
"luxury_needs_list" ||
name ==
"luxuary_needs_list") {
2002 auto ptr = make_element_by_type<pop_details_needs_listbox>(
state,
id);
2003 luxury_needs_list = ptr.
get();
2005 }
else if(
name ==
"religion") {
2006 return make_element_by_type<generic_name_text<dcon::religion_id>>(
state, id);
2013 if(!std::holds_alternative<dcon::pop_id>(
content))
2017 auto prov_id =
state.world.pop_location_get_province(
state.world.pop_get_pop_location_as_pop(fat_id.id));
2018 auto nat_id =
state.world.province_get_nation_from_province_ownership(prov_id);
2021 float expenses = 0.f;
2022 state.world.for_each_commodity([&](dcon::commodity_id c) {
2023 expenses +=
state.world.nation_get_effective_prices(nat_id, c) * fat_id.get_poptype().get_life_needs(c);
2024 expenses +=
state.world.nation_get_effective_prices(nat_id, c) * fat_id.get_poptype().get_everyday_needs(c);
2025 expenses +=
state.world.nation_get_effective_prices(nat_id, c) * fat_id.get_poptype().get_luxury_needs(c);
2031 c->impl_set(
state, payload);
2032 c->impl_on_update(
state);
2036 for(std::size_t i = 0; i < promotion_windows.size(); ++i)
2038 std::unordered_map<dcon::pop_type_id::value_base_t, float> distrib = {};
2040 state.world.for_each_pop_type([&](dcon::pop_type_id ptid) {
2041 auto mod_key = fat_id.get_poptype().get_promotion(ptid);
2043 auto chance = std::max(0.0f,
2045 distrib[dcon::pop_type_id::value_base_t(ptid.index())] =
chance;
2051 for(
auto const& e : distrib)
2052 if(e.second > 0.f && index < promotion_windows.size()) {
2053 promotion_windows[index]->set_visible(
state,
true);
2054 Cyto::Any pt_payload = dcon::pop_type_id(e.first);
2055 promotion_windows[index]->impl_set(
state, pt_payload);
2056 Cyto::Any pl_payload =
state.world.pop_get_pop_location_as_pop(fat_id.id);
2057 promotion_windows[index]->impl_set(
state, pl_payload);
2058 Cyto::Any mod_payload =
state.world.pop_get_poptype(fat_id.id).get_promotion(dcon::pop_type_id(e.first));
2059 promotion_windows[index]->impl_set(
state, mod_payload);
2060 Cyto::Any chance_payload = float(total > 0.0f ? e.second / total : 0.0f);
2061 promotion_windows[index]->impl_set(
state, chance_payload);
2068 state.world.for_each_commodity([&](dcon::commodity_id cid) {
2069 auto kf =
state.world.commodity_get_key_factory(cid);
2070 if(
state.world.commodity_get_is_available_from_start(cid) || (kf &&
state.world.nation_get_active_building(nat_id, kf))) {
2071 auto lfn = state.world.pop_type_get_life_needs(fat_id.get_poptype(), cid)
2073 / state.defines.alice_needs_scaling_factor
2074 * state.defines.alice_lf_needs_scale;
2076 life_needs_list->row_contents.emplace_back(cid, lfn);
2077 auto evn = state.world.pop_type_get_everyday_needs(fat_id.get_poptype(), cid)
2079 / state.defines.alice_needs_scaling_factor
2080 * state.defines.alice_ev_needs_scale;
2082 everyday_needs_list->row_contents.emplace_back(cid, evn);
2083 auto lxn = state.world.pop_type_get_luxury_needs(fat_id.get_poptype(), cid)
2085 / state.defines.alice_needs_scaling_factor
2086 * state.defines.alice_lx_needs_scale;
2088 luxury_needs_list->row_contents.emplace_back(cid, lxn);
2097 if(std::holds_alternative<dcon::pop_id>(
content)) {
2098 if(payload.holds_type<dcon::pop_id>()) {
2099 payload.emplace<dcon::pop_id>(std::get<dcon::pop_id>(
content));
2101 }
else if(payload.holds_type<dcon::religion_id>()) {
2102 payload.emplace<dcon::religion_id>(
state.world.pop_get_religion(std::get<dcon::pop_id>(
content)));
2104 }
else if(payload.holds_type<dcon::pop_type_id>()) {
2105 payload.emplace<dcon::pop_type_id>(
state.world.pop_get_poptype(std::get<dcon::pop_id>(
content)).id);
2107 }
else if(payload.holds_type<dcon::province_id>()) {
2108 payload.emplace<dcon::province_id>(
state.world.pop_get_province_from_pop_location(std::get<dcon::pop_id>(
content)));
2110 }
else if(payload.holds_type<dcon::nation_id>()) {
2111 payload.emplace<dcon::nation_id>(
state.local_player_nation);
2126 auto content = retrieve<dcon::pop_id>(
state,
parent);
2128 frame = int32_t(fat_id.get_sprite() - 1);
2136 auto content = retrieve<dcon::pop_id>(
state,
parent);
2137 auto name =
state.world.pop_type_get_name(
state.world.pop_get_poptype(content));
2146 auto content = retrieve<dcon::pop_id>(
state,
parent);
2155 if(
name ==
"pops_pop_entry_bg") {
2156 return make_element_by_type<show_pop_detail_button>(
state,
id);
2157 }
else if(
name ==
"pop_size") {
2158 return make_element_by_type<pop_size_text>(
state,
id);
2159 }
else if(
name ==
"pop_nation") {
2160 return make_element_by_type<pop_culture_text>(
state,
id);
2161 }
else if(
name ==
"pop_location") {
2162 return make_element_by_type<pop_location_text>(
state,
id);
2163 }
else if(
name ==
"pop_mil") {
2164 return make_element_by_type<pop_militancy_text>(
state,
id);
2165 }
else if(
name ==
"pop_con") {
2166 return make_element_by_type<pop_con_text>(
state,
id);
2167 }
else if(
name ==
"pop_type") {
2168 return make_element_by_type<pop_details_icon>(
state,
id);
2169 }
else if(
name ==
"pop_religion") {
2170 return make_element_by_type<popwin_religion_type>(
state,
id);
2171 }
else if(
name ==
"pop_ideology") {
2172 return make_element_by_type<pop_ideology_piechart>(
state,
id);
2173 }
else if(
name ==
"pop_issues") {
2174 return make_element_by_type<pop_issues_piechart>(
state,
id);
2175 }
else if(
name ==
"pop_unemployment_bar") {
2176 return make_element_by_type<pop_unemployment_progress_bar>(
state,
id);
2177 }
else if(
name ==
"pop_revolt") {
2178 return make_element_by_type<pop_revolt_faction>(
state,
id);
2179 }
else if(
name ==
"pop_movement_social") {
2180 return make_element_by_type<pop_movement_social>(
state,
id);
2181 }
else if(
name ==
"pop_movement_political") {
2182 return make_element_by_type<pop_movement_political>(
state,
id);
2183 }
else if(
name ==
"pop_movement_flag") {
2184 return make_element_by_type<pop_movement_flag>(
state,
id);
2185 }
else if(
name ==
"pop_cash") {
2186 return make_element_by_type<pop_cash_reserve_text>(
state,
id);
2187 }
else if(
name ==
"lifeneed_progress") {
2188 return make_element_by_type<pop_life_needs_progress_bar>(
state,
id);
2189 }
else if(
name ==
"eveneed_progress") {
2190 return make_element_by_type<pop_everyday_needs_progress_bar>(
state,
id);
2191 }
else if(
name ==
"luxneed_progress") {
2192 return make_element_by_type<pop_luxury_needs_progress_bar>(
state,
id);
2193 }
else if(
name ==
"growth_indicator") {
2194 return make_element_by_type<pop_growth_indicator>(
state,
id);
2195 }
else if(
name ==
"pop_literacy") {
2196 return make_element_by_type<pop_literacy_text>(
state,
id);
2203 if(payload.holds_type<dcon::religion_id>()) {
2204 payload.emplace<dcon::religion_id>(
state.world.pop_get_religion(
content));
2206 }
else if(payload.holds_type<dcon::pop_type_id>()) {
2207 payload.emplace<dcon::pop_type_id>(
state.world.pop_get_poptype(
content).id);
2216 return "popinfomember_popview";
2235 bool is_gray =
false;
2239 is_gray = !std::get<bool>(any_cast<pop_filter_data>(payload));
2246 auto& gfx_def =
state.ui_defs.gfx[gid];
2247 if(gfx_def.primary_texture_handle) {
2248 assert(gfx_def.number_of_frames > 1);
2253 state.world.locale_get_native_rtl(
state.font_collection.get_current_locale()));
2302template<pop_list_sort Sort>
2372 std::vector<element_base*> dist_windows;
2374 ankerl::unordered_dense::map<dcon::state_instance_id::value_base_t, bool> view_expanded_state;
2375 std::vector<bool> pop_filters;
2376 dcon::state_instance_id focus_state{};
2378 bool sort_ascend =
true;
2383 auto nation_id = std::holds_alternative<dcon::nation_id>(filter) ? std::get<dcon::nation_id>(filter) :
state.local_player_nation;
2384 std::vector<dcon::state_instance_id> state_list{};
2385 for(
auto si :
state.world.nation_get_state_ownership(nation_id))
2386 state_list.push_back(si.get_state().id);
2388 std::vector<dcon::province_id> province_list{};
2389 for(
auto& state_id : state_list) {
2390 if(std::holds_alternative<dcon::state_instance_id>(filter) && std::get<dcon::state_instance_id>(filter) != state_id)
2396 for(
auto& province_id : province_list) {
2397 if(std::holds_alternative<dcon::province_id>(filter) && std::get<dcon::province_id>(filter) != province_id)
2400 fat_id.for_each_pop_location_as_province([&](dcon::pop_location_id
id) {
2402 auto pop_id =
state.world.pop_location_get_pop(
id);
2403 auto pt_id =
state.world.pop_get_poptype(pop_id);
2404 if(pop_filters[dcon::pop_type_id::value_base_t(pt_id.id.index())])
2411 std::function<bool(dcon::pop_id, dcon::pop_id)> fn;
2414 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2417 return a_fat_id.get_poptype().id.index() < b_fat_id.get_poptype().id.index();
2421 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2424 return a_fat_id.get_size() > b_fat_id.get_size();
2428 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2431 return a_fat_id.get_consciousness() > b_fat_id.get_consciousness();
2435 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2438 return a_fat_id.get_militancy() > b_fat_id.get_militancy();
2442 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2449 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2456 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2463 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2466 return a_fat_id.get_savings() > b_fat_id.get_savings();
2470 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2473 return a_fat_id.get_employment() / a_fat_id.get_size() < b_fat_id.get_employment() / b_fat_id.get_size();
2477 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2480 return a_fat_id.get_dominant_ideology().id.index() < b_fat_id.get_dominant_ideology().id.index();
2484 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2487 return a_fat_id.get_dominant_issue_option().id.index() < b_fat_id.get_dominant_issue_option().id.index();
2491 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2494 return a_fat_id.get_life_needs_satisfaction() > b_fat_id.get_life_needs_satisfaction();
2498 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2501 return a_fat_id.get_everyday_needs_satisfaction() > b_fat_id.get_everyday_needs_satisfaction();
2505 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2508 return a_fat_id.get_luxury_needs_satisfaction() > b_fat_id.get_luxury_needs_satisfaction();
2512 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2515 return a_fat_id.get_literacy() > b_fat_id.get_literacy();
2519 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2522 auto a_reb = a_fat_id.get_rebel_faction_from_pop_rebellion_membership();
2523 auto b_reb = b_fat_id.get_rebel_faction_from_pop_rebellion_membership();
2524 auto a_mov = a_fat_id.get_movement_from_pop_movement_membership();
2525 auto b_mov = b_fat_id.get_movement_from_pop_movement_membership();
2526 if(a_reb || b_reb) {
2527 return a_reb ? (b_reb ? a_reb.id.index() > b_reb.id.index() :
true) :
false;
2528 }
else if(a_mov || b_mov) {
2529 return a_mov ? (b_mov ? a_mov.id.index() > b_mov.id.index() :
true) :
false;
2531 return a_fat_id.id.index() > b_fat_id.id.index();
2536 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2544 [&](dcon::pop_id a, dcon::pop_id b) {
2554 std::holds_alternative<dcon::nation_id>(filter) ? std::get<dcon::nation_id>(filter) :
state.local_player_nation;
2560 std::vector<dcon::state_instance_id> state_list;
2561 for(
auto si :
state.world.nation_get_state_ownership(nation_id))
2562 state_list.push_back(si.get_state().id);
2563 std::sort(state_list.begin(), state_list.end(), [&](dcon::state_instance_id a, dcon::state_instance_id b) {
2565 if(state.world.province_get_is_colonial(state.world.state_instance_get_capital(a)) !=
2566 state.world.province_get_is_colonial(state.world.state_instance_get_capital(b)))
2567 return !state.world.province_get_is_colonial(state.world.state_instance_get_capital(a));
2568 return state.world.state_instance_get_demographics(a, demographics::total) >
2569 state.world.state_instance_get_demographics(b, demographics::total);
2572 std::vector<dcon::province_id> province_list;
2573 for(
auto const state_id : state_list) {
2576 province_list.clear();
2579 std::sort(province_list.begin(), province_list.end(), [&](dcon::province_id a, dcon::province_id b) {
2580 return state.world.province_get_demographics(a, demographics::total) >
2581 state.world.province_get_demographics(b, demographics::total);
2584 if(view_expanded_state[dcon::state_instance_id::value_base_t(state_id.index())] ==
true)
2585 for(
auto const province_id : province_list)
2596 auto win1 = make_element_by_type<pop_distribution_window<dcon::pop_type_id, true>>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"distribution_window"))->second.definition);
2597 dist_windows.push_back(win1.get());
2600 auto win2 = make_element_by_type<pop_distribution_window<dcon::religion_id, true>>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"distribution_window"))->second.definition);
2601 dist_windows.push_back(win2.get());
2604 auto win3 = make_element_by_type<pop_distribution_window<dcon::ideology_id, true>>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"distribution_window"))->second.definition);
2605 dist_windows.push_back(win3.get());
2608 auto win4 = make_element_by_type<pop_distribution_window<dcon::culture_id, true>>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"distribution_window"))->second.definition);
2609 dist_windows.push_back(win4.get());
2612 auto win5 = make_element_by_type<pop_distribution_window<dcon::issue_option_id, true>>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"distribution_window"))->second.definition);
2613 dist_windows.push_back(win5.get());
2616 auto win6 = make_element_by_type<pop_distribution_window<dcon::political_party_id, true>>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"distribution_window"))->second.definition);
2617 dist_windows.push_back(win6.get());
2626 for(
auto const win : dist_windows) {
2627 win->base_data.position = offset;
2628 offset.
x += cell_size.
x;
2630 offset.
x = cell_offset.
x;
2631 offset.
y += cell_size.
y;
2644 state.world.for_each_pop_type([&](dcon::pop_type_id
id) {
2645 auto win = make_element_by_type<pop_filter_button>(
state,
2648 win->base_data.position = offset;
2649 win->impl_set(
state, payload);
2651 offset.
x += cell_size.
x;
2652 pop_filters.push_back(
true);
2657 make_element_by_type<pop_details_window>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"pop_details_win"))->second.definition);
2658 details_win = win7.
get();
2662 auto ptr = make_element_by_type<national_focus_window>(
state,
"state_focus_window");
2663 ptr->set_visible(
state,
false);
2670 if(
name ==
"main_bg") {
2671 return make_element_by_type<image_element_base>(
state,
id);
2672 }
else if(
name ==
"bg_pops") {
2673 return make_element_by_type<opaque_element_base>(
state,
id);
2674 }
else if(
name ==
"close_button") {
2675 return make_element_by_type<generic_close_button>(
state,
id);
2676 }
else if(
name ==
"pop_list") {
2677 auto ptr = make_element_by_type<pop_listbox>(
state,
id);
2678 country_pop_listbox = ptr.
get();
2680 }
else if(
name ==
"external_scroll_slider") {
2681 auto ptr = make_element_by_type<opaque_element_base>(
state,
id);
2683 }
else if(
name ==
"sortby_size_button") {
2684 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::size>>(
state, id);
2686 }
else if(
name ==
"sortby_type_button") {
2687 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::type>>(
state, id);
2689 }
else if(
name ==
"sortby_nationality_button") {
2690 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::nationality>>(
state, id);
2692 }
else if(
name ==
"sortby_religion_button") {
2693 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::religion>>(
state, id);
2695 }
else if(
name ==
"sortby_location_button") {
2696 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::location>>(
state, id);
2698 }
else if(
name ==
"sortby_mil_button") {
2699 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::mil>>(
state, id);
2700 ptr->set_button_text(
state,
"");
2701 ptr->base_data.position.y -= 1;
2703 }
else if(
name ==
"sortby_con_button") {
2704 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::con>>(
state, id);
2705 ptr->set_button_text(
state,
"");
2706 ptr->base_data.position.y -= 1;
2708 }
else if(
name ==
"sortby_ideology_button") {
2709 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::ideology>>(
state, id);
2710 ptr->set_button_text(
state,
"");
2711 ptr->base_data.position.y -= 1;
2713 }
else if(
name ==
"sortby_issues_button") {
2714 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::issues>>(
state, id);
2715 ptr->set_button_text(
state,
"");
2716 ptr->base_data.position.y -= 1;
2718 }
else if(
name ==
"sortby_unemployment_button") {
2719 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::unemployment>>(
state, id);
2720 ptr->set_button_text(
state,
"");
2721 ptr->base_data.position.y -= 1;
2723 }
else if(
name ==
"sortby_cash_button") {
2724 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::cash>>(
state, id);
2725 ptr->set_button_text(
state,
"");
2726 ptr->base_data.position.y -= 1;
2728 }
else if(
name ==
"sortby_subsistence_button") {
2729 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::life_needs>>(
state, id);
2730 ptr->set_button_text(
state,
"");
2731 ptr->base_data.position.y -= 1;
2733 }
else if(
name ==
"sortby_eve_button") {
2734 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::everyday_needs>>(
state, id);
2735 ptr->set_button_text(
state,
"");
2736 ptr->base_data.position.y -= 1;
2738 }
else if(
name ==
"sortby_luxury_button") {
2739 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::luxury_needs>>(
state, id);
2740 ptr->set_button_text(
state,
"");
2741 ptr->base_data.position.y -= 1;
2743 }
else if(
name ==
"sortby_revoltrisk_button") {
2744 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::revoltrisk>>(
state, id);
2745 ptr->set_button_text(
state,
"");
2746 ptr->base_data.position.y -= 1;
2748 }
else if(
name ==
"sortby_change_button") {
2749 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::change>>(
state, id);
2750 ptr->set_button_text(
state,
"");
2751 ptr->base_data.position.y -= 1;
2753 }
else if(
name ==
"sortby_literacy_button") {
2754 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::literacy>>(
state, id);
2755 ptr->set_button_text(
state,
"");
2756 ptr->base_data.position.y -= 1;
2758 }
else if(
name ==
"pop_province_list") {
2759 auto ptr = make_element_by_type<pop_left_side_listbox>(
state,
id);
2760 left_side_listbox = ptr.
get();
2762 }
else if(
name ==
"popfilter_all") {
2763 return make_element_by_type<pop_filter_select_button<true>>(
state, id);
2764 }
else if(
name ==
"popfilter_deselect_all") {
2765 return make_element_by_type<pop_filter_select_button<false>>(
state, id);
2772 if(country_pop_listbox) {
2773 update_pop_list(
state);
2774 sort_pop_list(
state);
2777 if(left_side_listbox) {
2779 populate_left_side_list(
state);
2787 filter = any_cast<pop_list_filter>(payload);
2796 auto expand_action = any_cast<pop_left_side_expand_action>(payload);
2797 auto sid = std::get<dcon::state_instance_id>(expand_action);
2798 view_expanded_state[dcon::state_instance_id::value_base_t(sid.index())] =
2799 !view_expanded_state[dcon::state_instance_id::value_base_t(sid.index())];
2803 auto data = any_cast<pop_filter_data>(payload);
2804 auto ptid = std::get<dcon::pop_type_id>(data);
2805 pop_filters[dcon::pop_type_id::value_base_t(ptid.index())] = !pop_filters[dcon::pop_type_id::value_base_t(ptid.index())];
2809 auto data = any_cast<pop_filter_select_action>(payload);
2810 state.world.for_each_pop_type(
2811 [&](dcon::pop_type_id
id) { pop_filters[dcon::pop_type_id::value_base_t(
id.index())] = data.value; });
2815 auto new_sort = any_cast<pop_list_sort>(payload);
2816 sort_ascend = (new_sort == sort) ? !sort_ascend :
true;
2829 auto expand_action = any_cast<pop_left_side_expand_action>(payload);
2830 auto sid = std::get<dcon::state_instance_id>(expand_action);
2835 auto data = any_cast<pop_filter_data>(payload);
2836 auto ptid = std::get<dcon::pop_type_id>(data);
2839 }
else if(payload.holds_type<dcon::state_instance_id>()) {
2840 payload.emplace<dcon::state_instance_id>(focus_state);
dcon::text_key get_name() noexcept
message_result impl_set(sys::state &state, Cyto::Any &payload) noexcept final
void add_child_to_back(std::unique_ptr< element_base > child) noexcept final
void add_child_to_front(std::unique_ptr< element_base > child) noexcept final
void move_child_to_front(element_base *child) noexcept final
std::vector< std::unique_ptr< element_base > > children
void impl_on_update(sys::state &state) noexcept override
virtual message_result impl_set(sys::state &state, Cyto::Any &payload) noexcept
virtual void render(sys::state &state, int32_t x, int32_t y) noexcept
virtual message_result get(sys::state &state, Cyto::Any &payload) noexcept
virtual void on_update(sys::state &state) noexcept
message_result impl_get(sys::state &state, Cyto::Any &payload) noexcept
virtual void on_create(sys::state &state) noexcept
void set_visible(sys::state &state, bool vis)
void set_type(sys::state &state, dcon::pop_type_id t)
void on_update(sys::state &state) noexcept override
std::vector< RowConT > row_contents
void update(sys::state &state)
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
pop_left_side_data content
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void update_chart(sys::state &state)
std::vector< entry > distribution
void on_create(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
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 update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
tooltip_behavior has_tooltip(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 on_update(sys::state &state) 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_update(sys::state &state) 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
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 update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) 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
void on_update(sys::state &state) noexcept override
tooltip_behavior has_tooltip(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 update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
tooltip_behavior has_tooltip(sys::state &state) 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
tooltip_behavior has_tooltip(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 update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
tooltip_behavior has_tooltip(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_update(sys::state &state) noexcept override
std::string_view get_row_element_name() 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
message_result set(sys::state &state, Cyto::Any &payload) noexcept override
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
void on_create(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
void on_update(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
std::string_view get_row_element_name() override
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
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
float get_progress(sys::state &state, dcon::pop_id content) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
int32_t get_icon_frame(sys::state &state) noexcept
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_create(sys::state &state) noexcept override
void for_each_demo(sys::state &state, std::function< void(dcon::ideology_id)> fun) override
void on_create(sys::state &state) noexcept override
void for_each_demo(sys::state &state, std::function< void(dcon::issue_option_id)> fun) 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_update(sys::state &state) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
void on_create(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
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
void on_update(sys::state &state) noexcept override
float get_progress(sys::state &state, dcon::pop_id content) 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
std::string_view get_row_element_name() 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 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
float get_progress(sys::state &state, dcon::pop_id content) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
tooltip_behavior has_tooltip(sys::state &state) 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 render(sys::state &state, int32_t x, int32_t y) noexcept override
dcon::national_identity_id get_current_nation(sys::state &state) noexcept override
void button_action(sys::state &) noexcept override
void render(sys::state &state, int32_t x, int32_t y) 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
int32_t get_icon_frame(sys::state &state) noexcept
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
int32_t get_icon_frame(sys::state &state) noexcept
void render(sys::state &state, int32_t x, int32_t y) 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_update(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
int32_t get_icon_frame(sys::state &state) noexcept
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
tooltip_behavior has_tooltip(sys::state &state) noexcept override
float get_progress(sys::state &state, dcon::pop_id content) 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
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
void on_create(sys::state &state) noexcept override
friend dcon::pop_id get_pop_details_pop(sys::state &state)
friend std::vector< dcon::pop_id > const & get_pop_window_list(sys::state &state)
message_result set(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 update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
tooltip_behavior has_tooltip(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 update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_update(sys::state &state) noexcept override
virtual float get_progress(sys::state &state, dcon::pop_id content) noexcept
void on_create(sys::state &state) noexcept override
virtual float get_progress(sys::state &state, dcon::pop_id content) noexcept
void on_create(sys::state &state) 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_create(sys::state &state) noexcept override
#define assert(condition)
bool can_set_national_focus(sys::state &state, dcon::nation_id source, dcon::state_instance_id target_state, dcon::national_focus_id focus)
void set_national_focus(sys::state &state, dcon::nation_id source, dcon::state_instance_id target_state, dcon::national_focus_id focus)
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
float get_effective_estimation_type_change(sys::state &state, dcon::nation_id nation, dcon::pop_type_id target_type)
float get_estimated_colonial_migration(sys::state &state, dcon::pop_id ids)
float get_estimated_type_change(sys::state &state, dcon::pop_id ids)
constexpr dcon::demographics_key total(0)
dcon::demographics_key to_key(sys::state const &state, dcon::pop_type_id v)
float get_estimated_conversion(sys::state &state, dcon::pop_id ids)
float get_estimated_internal_migration(sys::state &state, dcon::pop_id ids)
float get_estimated_demotion(sys::state &state, dcon::pop_id ids)
float get_monthly_pop_increase(sys::state &state, dcon::pop_id ids)
float get_estimated_assimilation(sys::state &state, dcon::pop_id ids)
float get_estimated_emigration(sys::state &state, dcon::pop_id ids)
float get_estimated_promotion(sys::state &state, dcon::pop_id ids)
dcon::nation_id owner_of_pop(sys::state const &state, dcon::pop_id pop_ids)
void render_subsprite(sys::state const &state, color_modification enabled, int frame, int total_frames, float x, float y, float width, float height, GLuint texture_handle, ui::rotation r, bool flipped, bool rtl)
GLuint get_texture_handle(sys::state &state, dcon::texture_id id, bool keep_data)
bool political_party_is_active(sys::state &state, dcon::nation_id n, dcon::political_party_id p)
float party_total_support(sys::state &state, dcon::pop_id pop, dcon::political_party_id par_id, dcon::nation_id nat_id, dcon::province_id prov_id)
dcon::pop_demographics_key to_key(sys::state const &state, dcon::ideology_id v)
void for_each_province_in_state_instance(sys::state &state, dcon::state_instance_id s, F const &func)
float state_admin_efficiency(sys::state &state, dcon::state_instance_id id)
void add_line_break_to_layout_box(sys::state &state, layout_base &dest, layout_box &box)
void add_to_layout_box(sys::state &state, layout_base &dest, layout_box &box, embedded_flag ico)
std::string resolve_string_substitution(sys::state &state, dcon::text_key source_text, substitution_map const &mp)
std::string format_money(float num)
std::string get_name_as_string(sys::state &state, T t)
layout_box open_layout_box(layout_base &dest, int32_t indent)
void localised_single_sub_box(sys::state &state, layout_base &dest, layout_box &box, std::string_view key, variable_type subkey, substitution value)
void localised_format_box(sys::state &state, layout_base &dest, layout_box &box, std::string_view key, text::substitution_map const &sub)
std::string format_float(float num, size_t digits)
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_to_substitution_map(substitution_map &mp, variable_type key, substitution value)
void add_divider_to_layout_box(sys::state &state, layout_base &dest, layout_box &box)
dcon::text_key get_adjective(sys::state &state, dcon::nation_id id)
ankerl::unordered_dense::map< uint32_t, substitution > substitution_map
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
std::string get_adjective_as_string(sys::state &state, T t)
std::string format_percentage(float num, size_t digits)
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)
std::variant< std::string_view, dcon::text_key, dcon::province_id, dcon::state_instance_id, dcon::nation_id, dcon::national_identity_id, int64_t, fp_one_place, sys::date, std::monostate, fp_two_places, fp_three_places, fp_four_places, fp_currency, pretty_integer, fp_percentage, fp_percentage_one_place, int_percentage, int_wholenum, dcon::state_definition_id, embedded_icon, embedded_flag, embedded_unit_icon > substitution
int32_t to_generic(dcon::province_id v)
bool evaluate(sys::state &state, dcon::trigger_key key, int32_t primary, int32_t this_slot, int32_t from_slot)
float evaluate_additive_modifier(sys::state &state, dcon::value_modifier_key modifier, int32_t primary, int32_t this_slot, int32_t from_slot)
float evaluate_multiplicative_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 modifier_description(sys::state &state, text::layout_base &layout, dcon::modifier_id mid, int32_t indentation=0)
void describe_mil(sys::state &state, text::columnar_layout &contents, dcon::pop_id ids)
void multiplicative_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_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)
std::variant< std::monostate, dcon::pop_type_id, bool > pop_filter_data
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)
std::variant< std::monostate, dcon::nation_id, dcon::state_instance_id, dcon::province_id > pop_list_filter
void describe_colonial_migration(sys::state &state, text::columnar_layout &contents, dcon::pop_id ids)
ogl::color_modification get_color_modification(bool is_under_mouse, bool is_disabled, bool is_interactable)
std::variant< std::monostate, dcon::pop_id > pop_details_data
std::variant< std::monostate, dcon::nation_id, dcon::state_instance_id, dcon::province_id > pop_left_side_data
std::pair< dcon::commodity_id, float > pop_details_needs_data
std::variant< std::monostate, dcon::state_instance_id, bool > pop_left_side_expand_action
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_type get_element_type() const
rotation get_rotation() const
union ui::element_data::internal_data data
ankerl::unordered_dense::map< dcon::text_key, element_target, hash_text_key > defs_by_name
element_base * population_subwindow
element_base * under_mouse