56 auto content = retrieve<dcon::province_id>(
state,
parent);
60 }
else if(result < 0) {
75 auto content = retrieve<dcon::province_id>(
state,
parent);
92 auto content = retrieve<dcon::state_instance_id>(
state,
parent);
96 }
else if(result < 0) {
111 auto content = retrieve<dcon::state_instance_id>(
state,
parent);
128 auto content = retrieve<dcon::nation_id>(
state,
parent);
132 }
else if(result < 0) {
147 auto content = retrieve<dcon::nation_id>(
state,
parent);
166 auto content = retrieve<dcon::pop_id>(
state,
parent);
169 auto rebel_fact = fat_id.get_pop_rebellion_membership().get_rebel_faction().get_type();
172 auto icon = rebel_fact.get_icon();
173 return int32_t(icon - 1);
195 auto content = retrieve<dcon::pop_id>(
state,
parent);
197 auto rebel_fact = fat_id.get_pop_rebellion_membership().get_rebel_faction().get_type();
201 if(
auto desc = rebel_fact.get_description();
state.key_is_localized(desc)) {
218 auto content = retrieve<dcon::pop_id>(
state,
parent);
221 auto movement_fact = fat_id.get_pop_movement_membership().get_movement().get_associated_issue_option();
223 auto parent_issue = movement_fact.get_parent_issue();
228 for(;
count < int32_t(
state.culture_definitions.social_issues.size()); ++
count) {
229 if(
state.culture_definitions.social_issues[
count] == parent_issue)
250 auto content = retrieve<dcon::pop_id>(
state,
parent);
252 auto movement_fact = fat_id.get_pop_movement_membership();
255 auto movement_issue = movement_fact.get_movement().get_associated_issue_option();
273 auto content = retrieve<dcon::pop_id>(
state,
parent);
275 auto movement_fact = fat_id.get_pop_movement_membership().get_movement().get_associated_issue_option();
277 auto parent_issue = movement_fact.get_parent_issue();
282 for(;
count < int32_t(
state.culture_definitions.political_issues.size()); ++
count) {
283 if(
state.culture_definitions.political_issues[
count] == parent_issue)
304 auto content = retrieve<dcon::pop_id>(
state,
parent);
306 auto movement_fact = fat_id.get_pop_movement_membership();
309 auto movement_issue = movement_fact.get_movement().get_associated_issue_option();
328 auto movement =
state.world.pop_get_movement_from_pop_movement_membership(pop);
330 if(
auto id =
state.world.movement_get_associated_independence(movement);
id) {
338 return dcon::national_identity_id{};
361 auto content = retrieve<dcon::pop_id>(
state,
parent);
370 auto content = retrieve<dcon::pop_id>(
state,
parent);
381 auto content = retrieve<dcon::pop_id>(
state,
parent);
399 auto total = int64_t(growth) + promote + assimilation + internal_migration + colonial_migration + emigration;
438 if(assimilation >= 0) {
449 if(internal_migration >= 0) {
460 if(colonial_migration >= 0) {
471 if(emigration >= 0) {
486 auto loc =
state.world.pop_get_province_from_pop_location(pop);
538 auto content = retrieve<dcon::pop_id>(
state,
parent);
554 auto content = retrieve<dcon::pop_id>(
state,
parent);
562 }
else if(result < 0) {
610 auto content = retrieve<dcon::pop_id>(
state,
parent);
628 auto content = retrieve<dcon::pop_id>(
state,
parent);
644 if(
state.world.pop_type_get_has_unemployment(
state.world.pop_get_poptype(content)))
654 auto content = retrieve<dcon::pop_id>(
state,
parent);
657 float un_empl =
state.world.pop_type_get_has_unemployment(
state.world.pop_get_poptype(content))
678 auto content = retrieve<dcon::pop_id>(
state,
parent);
702 auto content = retrieve<dcon::pop_id>(
state,
parent);
726 auto content = retrieve<dcon::pop_id>(
state,
parent);
742 state.world.for_each_issue_option(fun);
756 state.world.for_each_ideology(fun);
768using pop_left_side_data = std::variant< std::monostate, dcon::nation_id, dcon::state_instance_id, dcon::province_id>;
778 auto filter = any_cast<pop_list_filter>(filter_payload);
779 frame = std::holds_alternative<T>(filter) && std::get<T>(filter) ==
id ? 1 : 0;
795 if(
name ==
"poplistbutton") {
796 return make_element_by_type<pop_left_side_button<dcon::nation_id>>(
state, id);
797 }
else if(
name ==
"poplist_name") {
798 return make_element_by_type<generic_name_text<dcon::nation_id>>(
state, id);
799 }
else if(
name ==
"poplist_numpops") {
800 return make_element_by_type<nation_population_text>(
state,
id);
801 }
else if(
name ==
"growth_indicator") {
802 return make_element_by_type<nation_growth_indicator>(
state,
id);
820 auto id = retrieve<dcon::state_instance_id>(
state,
parent);
824 frame = std::get<bool>(any_cast<pop_left_side_expand_action>(payload)) ? 1 : 0;
830 auto id = retrieve<dcon::state_instance_id>(
state,
parent);
843 auto content = retrieve<dcon::state_instance_id>(
state,
parent);
844 return bool(
state.world.state_instance_get_owner_focus(content).id)
845 ?
state.world.state_instance_get_owner_focus(content).get_icon() - 1
850 auto content = retrieve<dcon::state_instance_id>(
state,
parent);
852 state.world.for_each_national_focus([&](dcon::national_focus_id nfid) {
860 auto content = retrieve<dcon::state_instance_id>(
state,
parent);
871 auto sid = retrieve<dcon::state_instance_id>(
state,
parent);
875 auto content =
state.world.state_instance_get_owner_focus(sid);
881 if(fat_nf.get_promotion_type()) {
883 if(fat_nf.get_promotion_type() ==
state.culture_definitions.clergy) {
887 }
else if(fat_nf.get_promotion_type() ==
state.culture_definitions.bureaucrat) {
897 if(
auto mid =
state.world.national_focus_get_modifier(content); mid) {
909 if(
name ==
"poplistbutton") {
910 return make_element_by_type<pop_left_side_button<dcon::state_instance_id>>(
state, id);
911 }
else if(
name ==
"poplist_name") {
912 return make_element_by_type<state_name_text>(
state,
id);
913 }
else if(
name ==
"poplist_numpops") {
914 return make_element_by_type<popwin_state_population>(
state,
id);
915 }
else if(
name ==
"colonial_state_icon") {
916 auto ptr = make_element_by_type<province_colony_button>(
state,
id);
917 colonial_icon = ptr.
get();
919 }
else if(
name ==
"state_focus") {
920 return make_element_by_type<pop_national_focus_button>(
state,
id);
921 }
else if(
name ==
"expand") {
922 return make_element_by_type<pop_left_side_expand_button>(
state,
id);
923 }
else if(
name ==
"growth_indicator") {
924 return make_element_by_type<state_growth_indicator>(
state,
id);
931 auto content = retrieve<dcon::state_instance_id>(
state,
parent);
938 if(
name ==
"poplistbutton") {
939 return make_element_by_type<pop_left_side_button<dcon::province_id>>(
state, id);
940 }
else if(
name ==
"poplist_name") {
941 return make_element_by_type<generic_name_text<dcon::province_id>>(
state, id);
942 }
else if(
name ==
"poplist_numpops") {
943 return make_element_by_type<province_population_text>(
state,
id);
944 }
else if(
name ==
"growth_indicator") {
945 return make_element_by_type<province_growth_indicator>(
state,
id);
961 auto ptr1 = make_element_by_type<pop_left_side_country_window>(
state,
963 country_window = ptr1.
get();
966 auto ptr2 = make_element_by_type<pop_left_side_state_window>(
state,
968 state_window = ptr2.
get();
971 auto ptr3 = make_element_by_type<pop_left_side_province_window>(
state,
973 province_window = ptr3.
get();
988 }
else if(payload.holds_type<dcon::province_id>()) {
989 if(std::holds_alternative<dcon::province_id>(
content))
990 payload.emplace<dcon::province_id>(std::get<dcon::province_id>(
content));
992 }
else if(payload.holds_type<dcon::state_instance_id>()) {
993 if(std::holds_alternative<dcon::state_instance_id>(
content))
994 payload.emplace<dcon::state_instance_id>(std::get<dcon::state_instance_id>(
content));
996 }
else if(payload.holds_type<dcon::nation_id>()) {
997 if(std::holds_alternative<dcon::nation_id>(
content))
998 payload.emplace<dcon::nation_id>(std::get<dcon::nation_id>(
content));
1008 return "pop_left_side_list_base_window";
1020template<
typename T,
bool Multiple>
1023 auto const weight_fn = [&](T id,
float weight) {
1024 auto it = std::find_if(this->
distribution.begin(), this->distribution.end(), [
id](
auto& e) { return e.key == id; });
1026 it->value += weight;
1031 if constexpr(std::is_same_v<T, dcon::issue_option_id>) {
1032 for(
auto iopt :
state.world.in_issue_option) {
1035 }
else if constexpr(std::is_same_v<T, dcon::ideology_id>) {
1036 for(
auto iopt :
state.world.in_ideology) {
1039 }
else if constexpr(std::is_same_v<T, dcon::political_party_id>) {
1040 auto prov_id =
state.world.pop_location_get_province(
state.world.pop_get_pop_location_as_pop(pop_id));
1041 if(!
state.world.province_get_is_colonial(prov_id)) {
1042 auto tag =
state.world.nation_get_identity_from_identity_holder(
1043 state.world.province_get_nation_from_province_ownership(prov_id));
1044 auto start =
state.world.national_identity_get_political_party_first(tag).id.index();
1045 auto end = start +
state.world.national_identity_get_political_party_count(tag);
1046 for(int32_t i = start; i < end; i++) {
1047 auto pid = T(
typename T::value_base_t(i));
1050 state.world.province_get_nation_from_province_ownership(prov_id), prov_id);
1051 weight_fn(pid, support);
1055 }
else if constexpr(std::is_same_v<T, dcon::culture_id>) {
1056 auto size =
state.world.pop_get_size(pop_id);
1057 weight_fn(
state.world.pop_get_culture(pop_id).id,
size);
1058 }
else if constexpr(std::is_same_v<T, dcon::religion_id>) {
1059 auto size =
state.world.pop_get_size(pop_id);
1060 weight_fn(
state.world.pop_get_religion(pop_id).id,
size);
1061 }
else if constexpr(std::is_same_v<T, dcon::pop_type_id>) {
1062 auto size =
state.world.pop_get_size(pop_id);
1063 weight_fn(
state.world.pop_get_poptype(pop_id).id,
size);
1072 if constexpr(Multiple) {
1074 for(
auto const pop_id : pop_list)
1075 iterate_one_pop(
state, pop_id);
1102 if(
name ==
"legend_color") {
1103 return make_element_by_type<pop_distribution_plupp<T>>(
state, id);
1104 }
else if(
name ==
"legend_title") {
1105 return make_element_by_type<generic_name_text<T>>(
state, id);
1106 }
else if(
name ==
"legend_value") {
1107 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1108 value_text = ptr.
get();
1120 if(payload.holds_type<T>()) {
1132 return "pop_legend_item";
1136template<
typename T,
bool Multiple>
1142 if(
name ==
"item_name") {
1143 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1144 if constexpr(std::is_same_v<T, dcon::issue_option_id>) {
1146 }
else if constexpr(std::is_same_v<T, dcon::culture_id>) {
1148 }
else if constexpr(std::is_same_v<T, dcon::ideology_id>) {
1150 }
else if constexpr(std::is_same_v<T, dcon::religion_id>) {
1152 }
else if constexpr(std::is_same_v<T, dcon::pop_type_id>) {
1154 }
else if constexpr(std::is_same_v<T, dcon::political_party_id>) {
1158 }
else if(
name ==
"chart") {
1159 return make_element_by_type<pop_distribution_piechart<T, Multiple>>(
state, id);
1160 }
else if(
name ==
"member_names") {
1161 auto ptr = make_element_by_type<pop_distribution_listbox<T>>(
state, id);
1162 distrib_listbox = ptr.
get();
1172 std::unordered_map<typename T::value_base_t, float> distrib{};
1173 for(
auto const pop_id : pop_list) {
1174 auto const weight_fn = [&](
auto id) {
1176 distrib[
typename T::value_base_t(
id.index())] += weight;
1179 if constexpr(std::is_same_v<T, dcon::issue_option_id>)
1180 state.world.for_each_issue_option(weight_fn);
1181 else if constexpr(std::is_same_v<T, dcon::ideology_id>)
1182 state.world.for_each_ideology(weight_fn);
1184 if constexpr(std::is_same_v<T, dcon::culture_id>)
1185 distrib[
typename T::value_base_t(
state.world.pop_get_culture(pop_id).id.index())] +=
state.world.pop_get_size(pop_id);
1186 else if constexpr(std::is_same_v<T, dcon::religion_id>)
1187 distrib[
typename T::value_base_t(
state.world.pop_get_religion(pop_id).id.index())] +=
state.world.pop_get_size(pop_id);
1188 else if constexpr(std::is_same_v<T, dcon::pop_type_id>)
1189 distrib[
typename T::value_base_t(
state.world.pop_get_poptype(pop_id).id.index())] +=
state.world.pop_get_size(pop_id);
1190 else if constexpr(std::is_same_v<T, dcon::political_party_id>) {
1191 auto prov_id =
state.world.pop_location_get_province(
state.world.pop_get_pop_location_as_pop(pop_id));
1192 if(
state.world.province_get_is_colonial(prov_id))
1194 auto tag =
state.world.nation_get_identity_from_identity_holder(
1195 state.world.province_get_nation_from_province_ownership(prov_id));
1196 auto start =
state.world.national_identity_get_political_party_first(tag).id.index();
1197 auto end = start +
state.world.national_identity_get_political_party_count(tag);
1198 for(int32_t i = start; i < end; i++) {
1199 auto pid = T(
typename T::value_base_t(i));
1202 state.world.province_get_nation_from_province_ownership(prov_id), prov_id);
1203 distrib[
typename T::value_base_t(pid.index())] += support;
1209 std::vector<std::pair<T, float>> sorted_distrib{};
1210 for(
auto const& e : distrib)
1212 sorted_distrib.emplace_back(T(e.first), e.second);
1213 std::sort(sorted_distrib.begin(), sorted_distrib.end(),
1214 [&](std::pair<T, float> a, std::pair<T, float> b) { return a.second > b.second; });
1219 for(
auto const& e : sorted_distrib)
1221 for(
auto const& e : sorted_distrib)
1222 distrib_listbox->
row_contents.emplace_back(e.first, e.second / total);
1230 auto issue = retrieve<dcon::issue_option_id>(
state,
parent);
1240 auto issue = retrieve<dcon::issue_option_id>(
state,
parent);
1242 auto opt = fatten(
state.world, issue);
1243 auto allow = opt.get_allow();
1244 auto parent_issue = opt.get_parent_issue();
1248 auto has_modifier = is_social_issue || is_political_issue;
1250 auto modifier_key = is_social_issue ? sys::national_mod_offsets::social_reform_desire : sys::national_mod_offsets::political_reform_desire;
1255 auto current_issue_setting =
state.world.nation_get_issues(owner, parent_issue).id;
1256 auto allowed_by_owner = (
state.world.nation_get_is_civilized(owner) || is_party_issue) &&
1257 (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));
1258 auto owner_modifier = has_modifier ? (
state.world.nation_get_modifier_values(owner, modifier_key) + 1.0f) : 1.0f;
1259 auto pop_type =
state.world.pop_get_poptype(ids);
1261 if(!allowed_by_owner) {
1268 auto attraction_factor = [&]() {
1269 if(
auto mtrigger =
state.world.pop_type_get_issues(pop_type, issue); mtrigger) {
1282 if(is_social_issue) {
1288 if(
auto mtrigger =
state.world.pop_type_get_issues(pop_type, issue); mtrigger) {
1292 if(
auto mtrigger =
state.world.pop_type_get_issues(pop_type, issue); mtrigger) {
1306 if(
name ==
"legend_color") {
1307 return make_element_by_type<pop_distribution_plupp<dcon::issue_option_id>>(
state, id);
1308 }
else if(
name ==
"legend_title") {
1309 return make_element_by_type<issue_with_explanation>(
state,
id);
1310 }
else if(
name ==
"legend_value") {
1311 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1312 value_text = ptr.
get();
1322 c->impl_on_update(
state);
1326 if(payload.holds_type<dcon::issue_option_id>()) {
1337 return "pop_legend_item";
1346 if(
name ==
"item_name") {
1347 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1350 }
else if(
name ==
"chart") {
1351 return make_element_by_type<pop_distribution_piechart<dcon::issue_option_id, false>>(
state, id);
1352 }
else if(
name ==
"member_names") {
1353 auto ptr = make_element_by_type<pop_detailed_issue_distribution_listbox>(
state,
id);
1354 distrib_listbox = ptr.
get();
1364 std::vector<dcon::issue_option_id> distrib;
1365 for(
auto io :
state.world.in_issue_option) {
1368 distrib.push_back(io.id);
1371 std::sort(distrib.begin(), distrib.end(), [&](
auto a,
auto b) {
1372 return pop_demographics::get_demo(state, pop, pop_demographics::to_key(state, a)) > pop_demographics::get_demo(state, pop, pop_demographics::to_key(state, b));
1377 for(
auto const& e : distrib)
1386 auto issue = retrieve<dcon::ideology_id>(
state,
parent);
1396 auto i = retrieve<dcon::ideology_id>(
state,
parent);
1398 auto type =
state.world.pop_get_poptype(ids);
1400 if(
state.world.ideology_get_enabled(i)) {
1401 if(
state.world.ideology_get_is_civilized_only(i)) {
1403 auto ptrigger =
state.world.pop_type_get_ideology(
type, i);
1426 auto ptrigger =
state.world.pop_type_get_ideology(
type, i);
1459 if(
name ==
"legend_color") {
1460 return make_element_by_type<pop_distribution_plupp<dcon::ideology_id>>(
state, id);
1461 }
else if(
name ==
"legend_title") {
1462 return make_element_by_type<ideology_with_explanation>(
state,
id);
1463 }
else if(
name ==
"legend_value") {
1464 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1465 value_text = ptr.
get();
1477 if(payload.holds_type<dcon::ideology_id>()) {
1488 return "pop_legend_item";
1497 if(
name ==
"item_name") {
1498 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1501 }
else if(
name ==
"chart") {
1502 return make_element_by_type<pop_distribution_piechart<dcon::ideology_id, false>>(
state, id);
1503 }
else if(
name ==
"member_names") {
1504 auto ptr = make_element_by_type<pop_detailed_ideology_distribution_listbox>(
state,
id);
1505 distrib_listbox = ptr.
get();
1515 std::vector<dcon::ideology_id> distrib;
1516 for(
auto io :
state.world.in_ideology) {
1519 distrib.push_back(io.id);
1522 std::sort(distrib.begin(), distrib.end(), [&](
auto a,
auto b) {
1523 return pop_demographics::get_demo(state, pop, pop_demographics::to_key(state, a)) > pop_demographics::get_demo(state, pop, pop_demographics::to_key(state, b));
1528 for(
auto const& e : distrib)
1536 dcon::value_modifier_key mod_key{};
1537 dcon::pop_location_id pop_loc{};
1550 auto prov_id =
state.world.pop_location_get_province(pop_loc);
1551 auto pop_id =
state.world.pop_location_get_pop(pop_loc);
1552 auto nat_id =
state.world.province_get_nation_from_province_ownership(prov_id);
1557 if(payload.holds_type<dcon::pop_location_id>()) {
1558 pop_loc = any_cast<dcon::pop_location_id>(payload);
1561 }
else if(payload.holds_type<dcon::value_modifier_key>()) {
1562 mod_key = any_cast<dcon::value_modifier_key>(payload);
1565 }
else if(payload.holds_type<
float>()) {
1566 chance = any_cast<float>(payload);
1576 dcon::pop_type_id content{};
1583 if(
name ==
"pop_type") {
1584 auto ptr = make_element_by_type<fixed_pop_type_icon>(
state,
id);
1585 type_icon = ptr.
get();
1587 }
else if(
name ==
"percentage") {
1588 auto ptr = make_element_by_type<pop_details_promotion_percent_text>(
state,
id);
1589 percent_text = ptr.
get();
1601 if(payload.holds_type<dcon::pop_type_id>()) {
1602 content = any_cast<dcon::pop_type_id>(payload);
1605 }
else if(payload.holds_type<dcon::pop_location_id>() || payload.holds_type<dcon::value_modifier_key>() || payload.holds_type<
float>()) {
1621 if(
name ==
"goods_type") {
1622 auto ptr = make_element_by_type<commodity_image>(
state,
id);
1623 commodity_icon = ptr.
get();
1625 }
else if(
name ==
"value") {
1626 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1627 value_text = ptr.
get();
1639 if(payload.holds_type<dcon::commodity_id>()) {
1640 payload.emplace<dcon::commodity_id>(
content.first);
1649 return "popdetail_needs_entry";
1656 auto internal_migration =
1683 auto internal_migration =
1780 auto movement =
state.world.pop_get_movement_from_pop_movement_membership(pop);
1782 if(
auto issue =
state.world.movement_get_associated_issue_option(movement); issue) {
1784 }
else if(
auto independence_target =
state.world.movement_get_associated_independence(movement); independence_target) {
1785 if(
state.world.national_identity_get_cultural_union_of(independence_target)) {
1800 auto faction =
state.world.pop_get_rebel_faction_from_pop_rebellion_membership(pop);
1804 auto nation =
state.world.rebel_faction_get_ruler_from_rebellion_within(faction);
1806 auto culture =
state.world.rebel_faction_get_primary_culture(faction);
1807 auto defection_target =
state.world.rebel_faction_get_defection_target(faction);
1812 if(defection_target) {
1813 auto adjective =
state.world.national_identity_get_adjective(defection_target);
1828 if(
name ==
"rebel_faction") {
1829 return make_element_by_type<generic_rebel_name_text>(
state,
id);
1830 }
else if(
name ==
"rebel_faction_icon") {
1831 return make_element_by_type<pop_revolt_faction>(
state,
id);
1832 }
else if(
name ==
"pop_movement_icon") {
1833 return make_element_by_type<pop_movement_flag>(
state,
id);
1834 }
else if(
name ==
"pop_movement_social_icon") {
1835 return make_element_by_type<pop_movement_social>(
state,
id);
1836 }
else if(
name ==
"pop_movement_political_icon") {
1837 return make_element_by_type<pop_movement_political>(
state,
id);
1851 std::vector<element_base*> promotion_windows;
1852 std::vector<element_base*> dist_windows;
1857 template<std::size_t... Targs>
1858 void generate_promotion_items(
sys::state&
state, std::integer_sequence<std::size_t, Targs...>
const&) {
1859 const xy_pair cell_offset{312, 153};
1861 auto win = make_element_by_type<pop_details_promotion_window<Targs>>(
state,
1863 win->base_data.position.x = cell_offset.x + (Targs * win->base_data.size.x);
1864 win->base_data.position.y = cell_offset.y;
1865 promotion_windows.push_back(win.get());
1876 generate_promotion_items(
state, std::integer_sequence<std::size_t, 0, 1, 2, 3, 4, 5, 6>{});
1878 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);
1879 dist_windows.push_back(win.get());
1883 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);
1884 dist_windows.push_back(win.get());
1892 state.ui_defs.gui[
state.ui_state.
defs_by_name.find(
state.lookup_key(
"popdetaildistribution_offset"))->second.definition].position;
1894 for(
auto const win : dist_windows) {
1895 win->base_data.position = offset;
1896 offset.
x += cell_size.
x;
1898 offset.
x = cell_offset.
x;
1899 offset.
y += cell_size.
y;
1905 if(
name ==
"close_button") {
1906 return make_element_by_type<generic_close_button>(
state,
id);
1907 }
else if(
name ==
"rebel_win") {
1908 return make_element_by_type<pop_rebels_details>(
state,
id);
1909 }
else if(
name ==
"background") {
1910 return make_element_by_type<draggable_target>(
state,
id);
1911 }
else if(
name ==
"pop_type_icon") {
1912 return make_element_by_type<pop_type_icon>(
state,
id);
1913 }
else if(
name ==
"pop_size") {
1914 return make_element_by_type<pop_size_text>(
state,
id);
1915 }
else if(
name ==
"pop_culture") {
1916 return make_element_by_type<pop_culture_text>(
state,
id);
1917 }
else if(
name ==
"pop_location") {
1918 return make_element_by_type<pop_location_text>(
state,
id);
1919 }
else if(
name ==
"internal_migration_label") {
1920 return make_element_by_type<pop_details_migration_label>(
state,
id);
1921 }
else if(
name ==
"internal_migration_val") {
1922 return make_element_by_type<pop_details_migration_value>(
state,
id);
1923 }
else if(
name ==
"colonial_migration_label") {
1924 return make_element_by_type<pop_details_colonial_migration_label>(
state,
id);
1925 }
else if(
name ==
"colonial_migration_val") {
1926 return make_element_by_type<pop_details_colonial_migration_value>(
state,
id);
1927 }
else if(
name ==
"growth_indicator") {
1928 return make_element_by_type<pop_growth_indicator>(
state,
id);
1929 }
else if(
name ==
"external_migration_label") {
1930 return make_element_by_type<pop_details_emigration_label>(
state,
id);
1931 }
else if(
name ==
"external_migration_val") {
1932 return make_element_by_type<pop_details_emigration_value>(
state,
id);
1933 }
else if(
name ==
"promotions_label") {
1934 return make_element_by_type<pop_details_promotion_label>(
state,
id);
1935 }
else if(
name ==
"promotions_val") {
1936 return make_element_by_type<pop_details_promotion_value>(
state,
id);
1937 }
else if(
name ==
"demotions_label") {
1938 return make_element_by_type<pop_details_promotion_label>(
state,
id);
1939 }
else if(
name ==
"demotions_val") {
1940 return make_element_by_type<pop_details_demotion_value>(
state,
id);
1941 }
else if(
name ==
"mil_value") {
1942 return make_element_by_type<pop_militancy_text>(
state,
id);
1943 }
else if(
name ==
"con_value") {
1944 return make_element_by_type<pop_con_text>(
state,
id);
1945 }
else if(
name ==
"literacy_value") {
1946 return make_element_by_type<pop_literacy_text>(
state,
id);
1947 }
else if(
name ==
"icon_religion") {
1948 return make_element_by_type<popwin_religion_type>(
state,
id);
1949 }
else if(
name ==
"money_value") {
1950 auto ptr = make_element_by_type<invisible_element>(
state,
id);
1953 }
else if(
name ==
"income_value") {
1954 auto ptr = make_element_by_type<invisible_element>(
state,
id);
1955 income_text = ptr.
get();
1957 }
else if(
name ==
"money_label") {
1958 auto ptr = make_element_by_type<invisible_element>(
state,
id);
1960 }
else if(
name ==
"income_label") {
1961 auto ptr = make_element_by_type<invisible_element>(
state,
id);
1963 }
else if(
name ==
"expenses_value") {
1964 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1965 expenses_text = ptr.
get();
1967 }
else if(
name ==
"bank_value") {
1968 auto ptr = make_element_by_type<simple_text_element_base>(
state,
id);
1969 savings_text = ptr.
get();
1971 }
else if(
name ==
"pop_unemployment_bar") {
1972 return make_element_by_type<pop_unemployment_progress_bar>(
state,
id);
1973 }
else if(
name ==
"lifeneed_progress") {
1974 return make_element_by_type<pop_life_needs_progress_bar>(
state,
id);
1975 }
else if(
name ==
"eveneed_progress") {
1976 return make_element_by_type<pop_everyday_needs_progress_bar>(
state,
id);
1977 }
else if(
name ==
"luxneed_progress") {
1978 return make_element_by_type<pop_luxury_needs_progress_bar>(
state,
id);
1979 }
else if(
name ==
"life_needs_list") {
1980 auto ptr = make_element_by_type<pop_details_needs_listbox>(
state,
id);
1981 life_needs_list = ptr.
get();
1983 }
else if(
name ==
"everyday_needs_list") {
1984 auto ptr = make_element_by_type<pop_details_needs_listbox>(
state,
id);
1985 everyday_needs_list = ptr.
get();
1987 }
else if(
name ==
"luxury_needs_list" ||
name ==
"luxuary_needs_list") {
1988 auto ptr = make_element_by_type<pop_details_needs_listbox>(
state,
id);
1989 luxury_needs_list = ptr.
get();
1991 }
else if(
name ==
"religion") {
1992 return make_element_by_type<generic_name_text<dcon::religion_id>>(
state, id);
1999 if(!std::holds_alternative<dcon::pop_id>(
content))
2003 auto prov_id =
state.world.pop_location_get_province(
state.world.pop_get_pop_location_as_pop(fat_id.id));
2004 auto nat_id =
state.world.province_get_nation_from_province_ownership(prov_id);
2007 float expenses = 0.f;
2008 state.world.for_each_commodity([&](dcon::commodity_id c) {
2009 expenses +=
state.world.nation_get_effective_prices(nat_id, c) * fat_id.get_poptype().get_life_needs(c);
2010 expenses +=
state.world.nation_get_effective_prices(nat_id, c) * fat_id.get_poptype().get_everyday_needs(c);
2011 expenses +=
state.world.nation_get_effective_prices(nat_id, c) * fat_id.get_poptype().get_luxury_needs(c);
2017 c->impl_set(
state, payload);
2018 c->impl_on_update(
state);
2022 for(std::size_t i = 0; i < promotion_windows.size(); ++i)
2024 std::unordered_map<dcon::pop_type_id::value_base_t, float> distrib = {};
2026 state.world.for_each_pop_type([&](dcon::pop_type_id ptid) {
2027 auto mod_key = fat_id.get_poptype().get_promotion(ptid);
2029 auto chance = std::max(0.0f,
2031 distrib[dcon::pop_type_id::value_base_t(ptid.index())] =
chance;
2037 for(
auto const& e : distrib)
2038 if(e.second > 0.f && index < promotion_windows.size()) {
2039 promotion_windows[index]->set_visible(
state,
true);
2040 Cyto::Any pt_payload = dcon::pop_type_id(e.first);
2041 promotion_windows[index]->impl_set(
state, pt_payload);
2042 Cyto::Any pl_payload =
state.world.pop_get_pop_location_as_pop(fat_id.id);
2043 promotion_windows[index]->impl_set(
state, pl_payload);
2044 Cyto::Any mod_payload =
state.world.pop_get_poptype(fat_id.id).get_promotion(dcon::pop_type_id(e.first));
2045 promotion_windows[index]->impl_set(
state, mod_payload);
2046 Cyto::Any chance_payload = float(total > 0.0f ? e.second / total : 0.0f);
2047 promotion_windows[index]->impl_set(
state, chance_payload);
2054 state.world.for_each_commodity([&](dcon::commodity_id cid) {
2055 auto kf =
state.world.commodity_get_key_factory(cid);
2056 if(
state.world.commodity_get_is_available_from_start(cid) || (kf &&
state.world.nation_get_active_building(nat_id, kf))) {
2057 auto lfn = state.world.pop_type_get_life_needs(fat_id.get_poptype(), cid)
2059 / state.defines.alice_needs_scaling_factor
2060 * state.defines.alice_lf_needs_scale;
2062 life_needs_list->row_contents.emplace_back(cid, lfn);
2063 auto evn = state.world.pop_type_get_everyday_needs(fat_id.get_poptype(), cid)
2065 / state.defines.alice_needs_scaling_factor
2066 * state.defines.alice_ev_needs_scale;
2068 everyday_needs_list->row_contents.emplace_back(cid, evn);
2069 auto lxn = state.world.pop_type_get_luxury_needs(fat_id.get_poptype(), cid)
2071 / state.defines.alice_needs_scaling_factor
2072 * state.defines.alice_lx_needs_scale;
2074 luxury_needs_list->row_contents.emplace_back(cid, lxn);
2083 if(std::holds_alternative<dcon::pop_id>(
content)) {
2084 if(payload.holds_type<dcon::pop_id>()) {
2085 payload.emplace<dcon::pop_id>(std::get<dcon::pop_id>(
content));
2087 }
else if(payload.holds_type<dcon::religion_id>()) {
2088 payload.emplace<dcon::religion_id>(
state.world.pop_get_religion(std::get<dcon::pop_id>(
content)));
2090 }
else if(payload.holds_type<dcon::pop_type_id>()) {
2091 payload.emplace<dcon::pop_type_id>(
state.world.pop_get_poptype(std::get<dcon::pop_id>(
content)).id);
2093 }
else if(payload.holds_type<dcon::province_id>()) {
2094 payload.emplace<dcon::province_id>(
state.world.pop_get_province_from_pop_location(std::get<dcon::pop_id>(
content)));
2096 }
else if(payload.holds_type<dcon::nation_id>()) {
2097 payload.emplace<dcon::nation_id>(
state.local_player_nation);
2112 auto content = retrieve<dcon::pop_id>(
state,
parent);
2114 frame = int32_t(fat_id.get_sprite() - 1);
2122 auto content = retrieve<dcon::pop_id>(
state,
parent);
2123 auto name =
state.world.pop_type_get_name(
state.world.pop_get_poptype(content));
2132 auto content = retrieve<dcon::pop_id>(
state,
parent);
2141 if(
name ==
"pops_pop_entry_bg") {
2142 return make_element_by_type<show_pop_detail_button>(
state,
id);
2143 }
else if(
name ==
"pop_size") {
2144 return make_element_by_type<pop_size_text>(
state,
id);
2145 }
else if(
name ==
"pop_nation") {
2146 return make_element_by_type<pop_culture_text>(
state,
id);
2147 }
else if(
name ==
"pop_location") {
2148 return make_element_by_type<pop_location_text>(
state,
id);
2149 }
else if(
name ==
"pop_mil") {
2150 return make_element_by_type<pop_militancy_text>(
state,
id);
2151 }
else if(
name ==
"pop_con") {
2152 return make_element_by_type<pop_con_text>(
state,
id);
2153 }
else if(
name ==
"pop_type") {
2154 return make_element_by_type<pop_details_icon>(
state,
id);
2155 }
else if(
name ==
"pop_religion") {
2156 return make_element_by_type<popwin_religion_type>(
state,
id);
2157 }
else if(
name ==
"pop_ideology") {
2158 return make_element_by_type<pop_ideology_piechart>(
state,
id);
2159 }
else if(
name ==
"pop_issues") {
2160 return make_element_by_type<pop_issues_piechart>(
state,
id);
2161 }
else if(
name ==
"pop_unemployment_bar") {
2162 return make_element_by_type<pop_unemployment_progress_bar>(
state,
id);
2163 }
else if(
name ==
"pop_revolt") {
2164 return make_element_by_type<pop_revolt_faction>(
state,
id);
2165 }
else if(
name ==
"pop_movement_social") {
2166 return make_element_by_type<pop_movement_social>(
state,
id);
2167 }
else if(
name ==
"pop_movement_political") {
2168 return make_element_by_type<pop_movement_political>(
state,
id);
2169 }
else if(
name ==
"pop_movement_flag") {
2170 return make_element_by_type<pop_movement_flag>(
state,
id);
2171 }
else if(
name ==
"pop_cash") {
2172 return make_element_by_type<pop_cash_reserve_text>(
state,
id);
2173 }
else if(
name ==
"lifeneed_progress") {
2174 return make_element_by_type<pop_life_needs_progress_bar>(
state,
id);
2175 }
else if(
name ==
"eveneed_progress") {
2176 return make_element_by_type<pop_everyday_needs_progress_bar>(
state,
id);
2177 }
else if(
name ==
"luxneed_progress") {
2178 return make_element_by_type<pop_luxury_needs_progress_bar>(
state,
id);
2179 }
else if(
name ==
"growth_indicator") {
2180 return make_element_by_type<pop_growth_indicator>(
state,
id);
2181 }
else if(
name ==
"pop_literacy") {
2182 return make_element_by_type<pop_literacy_text>(
state,
id);
2189 if(payload.holds_type<dcon::religion_id>()) {
2190 payload.emplace<dcon::religion_id>(
state.world.pop_get_religion(
content));
2192 }
else if(payload.holds_type<dcon::pop_type_id>()) {
2193 payload.emplace<dcon::pop_type_id>(
state.world.pop_get_poptype(
content).id);
2202 return "popinfomember_popview";
2221 bool is_gray =
false;
2225 is_gray = !std::get<bool>(any_cast<pop_filter_data>(payload));
2232 auto& gfx_def =
state.ui_defs.gfx[gid];
2233 if(gfx_def.primary_texture_handle) {
2234 assert(gfx_def.number_of_frames > 1);
2239 state.world.locale_get_native_rtl(
state.font_collection.get_current_locale()));
2288template<pop_list_sort Sort>
2358 std::vector<element_base*> dist_windows;
2360 ankerl::unordered_dense::map<dcon::state_instance_id::value_base_t, bool> view_expanded_state;
2361 std::vector<bool> pop_filters;
2362 dcon::state_instance_id focus_state{};
2364 bool sort_ascend =
true;
2369 auto nation_id = std::holds_alternative<dcon::nation_id>(filter) ? std::get<dcon::nation_id>(filter) :
state.local_player_nation;
2370 std::vector<dcon::state_instance_id> state_list{};
2371 for(
auto si :
state.world.nation_get_state_ownership(nation_id))
2372 state_list.push_back(si.get_state().id);
2374 std::vector<dcon::province_id> province_list{};
2375 for(
auto& state_id : state_list) {
2376 if(std::holds_alternative<dcon::state_instance_id>(filter) && std::get<dcon::state_instance_id>(filter) != state_id)
2382 for(
auto& province_id : province_list) {
2383 if(std::holds_alternative<dcon::province_id>(filter) && std::get<dcon::province_id>(filter) != province_id)
2386 fat_id.for_each_pop_location_as_province([&](dcon::pop_location_id
id) {
2388 auto pop_id =
state.world.pop_location_get_pop(
id);
2389 auto pt_id =
state.world.pop_get_poptype(pop_id);
2390 if(pop_filters[dcon::pop_type_id::value_base_t(pt_id.id.index())])
2397 std::function<bool(dcon::pop_id, dcon::pop_id)> fn;
2400 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2403 return a_fat_id.get_poptype().id.index() < b_fat_id.get_poptype().id.index();
2407 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2410 return a_fat_id.get_size() > b_fat_id.get_size();
2414 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2419 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2424 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2431 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2438 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2445 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2448 return a_fat_id.get_savings() > b_fat_id.get_savings();
2452 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2459 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2462 return a_fat_id.get_dominant_ideology().id.index() < b_fat_id.get_dominant_ideology().id.index();
2466 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2469 return a_fat_id.get_dominant_issue_option().id.index() < b_fat_id.get_dominant_issue_option().id.index();
2473 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2478 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2483 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2488 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2493 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2496 auto a_reb = a_fat_id.get_rebel_faction_from_pop_rebellion_membership();
2497 auto b_reb = b_fat_id.get_rebel_faction_from_pop_rebellion_membership();
2498 auto a_mov = a_fat_id.get_movement_from_pop_movement_membership();
2499 auto b_mov = b_fat_id.get_movement_from_pop_movement_membership();
2500 if(a_reb || b_reb) {
2501 return a_reb ? (b_reb ? a_reb.id.index() > b_reb.id.index() :
true) :
false;
2502 }
else if(a_mov || b_mov) {
2503 return a_mov ? (b_mov ? a_mov.id.index() > b_mov.id.index() :
true) :
false;
2505 return a_fat_id.id.index() > b_fat_id.id.index();
2510 fn = [&](dcon::pop_id a, dcon::pop_id b) {
2518 [&](dcon::pop_id a, dcon::pop_id b) {
2528 std::holds_alternative<dcon::nation_id>(filter) ? std::get<dcon::nation_id>(filter) :
state.local_player_nation;
2534 std::vector<dcon::state_instance_id> state_list;
2535 for(
auto si :
state.world.nation_get_state_ownership(nation_id))
2536 state_list.push_back(si.get_state().id);
2537 std::sort(state_list.begin(), state_list.end(), [&](dcon::state_instance_id a, dcon::state_instance_id b) {
2539 if(state.world.province_get_is_colonial(state.world.state_instance_get_capital(a)) !=
2540 state.world.province_get_is_colonial(state.world.state_instance_get_capital(b)))
2541 return !state.world.province_get_is_colonial(state.world.state_instance_get_capital(a));
2542 return state.world.state_instance_get_demographics(a, demographics::total) >
2543 state.world.state_instance_get_demographics(b, demographics::total);
2546 std::vector<dcon::province_id> province_list;
2547 for(
auto const state_id : state_list) {
2550 province_list.clear();
2553 std::sort(province_list.begin(), province_list.end(), [&](dcon::province_id a, dcon::province_id b) {
2554 return state.world.province_get_demographics(a, demographics::total) >
2555 state.world.province_get_demographics(b, demographics::total);
2558 if(view_expanded_state[dcon::state_instance_id::value_base_t(state_id.index())] ==
true)
2559 for(
auto const province_id : province_list)
2570 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);
2571 dist_windows.push_back(win1.get());
2574 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);
2575 dist_windows.push_back(win2.get());
2578 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);
2579 dist_windows.push_back(win3.get());
2582 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);
2583 dist_windows.push_back(win4.get());
2586 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);
2587 dist_windows.push_back(win5.get());
2590 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);
2591 dist_windows.push_back(win6.get());
2600 for(
auto const win : dist_windows) {
2601 win->base_data.position = offset;
2602 offset.
x += cell_size.
x;
2604 offset.
x = cell_offset.
x;
2605 offset.
y += cell_size.
y;
2618 state.world.for_each_pop_type([&](dcon::pop_type_id
id) {
2619 auto win = make_element_by_type<pop_filter_button>(
state,
2622 win->base_data.position = offset;
2623 win->impl_set(
state, payload);
2625 offset.
x += cell_size.
x;
2626 pop_filters.push_back(
true);
2631 make_element_by_type<pop_details_window>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"pop_details_win"))->second.definition);
2632 details_win = win7.
get();
2636 auto ptr = make_element_by_type<national_focus_window>(
state,
"state_focus_window");
2637 ptr->set_visible(
state,
false);
2644 if(
name ==
"main_bg") {
2645 return make_element_by_type<image_element_base>(
state,
id);
2646 }
else if(
name ==
"bg_pops") {
2647 return make_element_by_type<opaque_element_base>(
state,
id);
2648 }
else if(
name ==
"close_button") {
2649 return make_element_by_type<generic_close_button>(
state,
id);
2650 }
else if(
name ==
"pop_list") {
2651 auto ptr = make_element_by_type<pop_listbox>(
state,
id);
2652 country_pop_listbox = ptr.
get();
2654 }
else if(
name ==
"external_scroll_slider") {
2655 auto ptr = make_element_by_type<opaque_element_base>(
state,
id);
2657 }
else if(
name ==
"sortby_size_button") {
2658 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::size>>(
state, id);
2660 }
else if(
name ==
"sortby_type_button") {
2661 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::type>>(
state, id);
2663 }
else if(
name ==
"sortby_nationality_button") {
2664 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::nationality>>(
state, id);
2666 }
else if(
name ==
"sortby_religion_button") {
2667 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::religion>>(
state, id);
2669 }
else if(
name ==
"sortby_location_button") {
2670 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::location>>(
state, id);
2672 }
else if(
name ==
"sortby_mil_button") {
2673 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::mil>>(
state, id);
2674 ptr->set_button_text(
state,
"");
2675 ptr->base_data.position.y -= 1;
2677 }
else if(
name ==
"sortby_con_button") {
2678 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::con>>(
state, id);
2679 ptr->set_button_text(
state,
"");
2680 ptr->base_data.position.y -= 1;
2682 }
else if(
name ==
"sortby_ideology_button") {
2683 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::ideology>>(
state, id);
2684 ptr->set_button_text(
state,
"");
2685 ptr->base_data.position.y -= 1;
2687 }
else if(
name ==
"sortby_issues_button") {
2688 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::issues>>(
state, id);
2689 ptr->set_button_text(
state,
"");
2690 ptr->base_data.position.y -= 1;
2692 }
else if(
name ==
"sortby_unemployment_button") {
2693 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::unemployment>>(
state, id);
2694 ptr->set_button_text(
state,
"");
2695 ptr->base_data.position.y -= 1;
2697 }
else if(
name ==
"sortby_cash_button") {
2698 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::cash>>(
state, id);
2699 ptr->set_button_text(
state,
"");
2700 ptr->base_data.position.y -= 1;
2702 }
else if(
name ==
"sortby_subsistence_button") {
2703 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::life_needs>>(
state, id);
2704 ptr->set_button_text(
state,
"");
2705 ptr->base_data.position.y -= 1;
2707 }
else if(
name ==
"sortby_eve_button") {
2708 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::everyday_needs>>(
state, id);
2709 ptr->set_button_text(
state,
"");
2710 ptr->base_data.position.y -= 1;
2712 }
else if(
name ==
"sortby_luxury_button") {
2713 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::luxury_needs>>(
state, id);
2714 ptr->set_button_text(
state,
"");
2715 ptr->base_data.position.y -= 1;
2717 }
else if(
name ==
"sortby_revoltrisk_button") {
2718 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::revoltrisk>>(
state, id);
2719 ptr->set_button_text(
state,
"");
2720 ptr->base_data.position.y -= 1;
2722 }
else if(
name ==
"sortby_change_button") {
2723 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::change>>(
state, id);
2724 ptr->set_button_text(
state,
"");
2725 ptr->base_data.position.y -= 1;
2727 }
else if(
name ==
"sortby_literacy_button") {
2728 auto ptr = make_element_by_type<pop_sort_button<pop_list_sort::literacy>>(
state, id);
2729 ptr->set_button_text(
state,
"");
2730 ptr->base_data.position.y -= 1;
2732 }
else if(
name ==
"pop_province_list") {
2733 auto ptr = make_element_by_type<pop_left_side_listbox>(
state,
id);
2734 left_side_listbox = ptr.
get();
2736 }
else if(
name ==
"popfilter_all") {
2737 return make_element_by_type<pop_filter_select_button<true>>(
state, id);
2738 }
else if(
name ==
"popfilter_deselect_all") {
2739 return make_element_by_type<pop_filter_select_button<false>>(
state, id);
2746 if(country_pop_listbox) {
2747 update_pop_list(
state);
2748 sort_pop_list(
state);
2751 if(left_side_listbox) {
2753 populate_left_side_list(
state);
2761 filter = any_cast<pop_list_filter>(payload);
2770 auto expand_action = any_cast<pop_left_side_expand_action>(payload);
2771 auto sid = std::get<dcon::state_instance_id>(expand_action);
2772 view_expanded_state[dcon::state_instance_id::value_base_t(sid.index())] =
2773 !view_expanded_state[dcon::state_instance_id::value_base_t(sid.index())];
2777 auto data = any_cast<pop_filter_data>(payload);
2778 auto ptid = std::get<dcon::pop_type_id>(data);
2779 pop_filters[dcon::pop_type_id::value_base_t(ptid.index())] = !pop_filters[dcon::pop_type_id::value_base_t(ptid.index())];
2783 auto data = any_cast<pop_filter_select_action>(payload);
2784 state.world.for_each_pop_type(
2785 [&](dcon::pop_type_id
id) { pop_filters[dcon::pop_type_id::value_base_t(
id.index())] = data.value; });
2789 auto new_sort = any_cast<pop_list_sort>(payload);
2790 sort_ascend = (new_sort == sort) ? !sort_ascend :
true;
2803 auto expand_action = any_cast<pop_left_side_expand_action>(payload);
2804 auto sid = std::get<dcon::state_instance_id>(expand_action);
2809 auto data = any_cast<pop_filter_data>(payload);
2810 auto ptid = std::get<dcon::pop_type_id>(data);
2813 }
else if(payload.holds_type<dcon::state_instance_id>()) {
2814 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_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)
float get_employment(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_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)
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