6#include "dcon_generated.hpp"
25 static dcon::text_key names[5];
41 return dcon::text_key{ 0 };
95 float w_subsidies_amount =
99 if(w_subsidies_amount > 0.0f) {
105 }
else if(w_subsidies_amount < 0.0f) {
113 if(reparations_amount > 0.0f) {
119 }
else if(reparations_amount < 0.0f) {
130 if(subjectpayments_income != 0.0f) {
139 for(
auto on :
state.world.in_nation) {
140 auto rel =
state.world.nation_get_overlord_as_subject(on);
141 auto overlord =
state.world.overlord_get_ruler(rel);
156 if(subjectpayments_expense != 0.0f) {
182 auto n =
state.local_player_nation;
187 text::fp_percentage{ 1.0f +
state.world.nation_get_modifier_values(n, sys::national_mod_offsets::administrative_efficiency_modifier) });
195 auto non_colonial =
state.world.nation_get_non_colonial_population(n);
196 auto total = non_colonial > 0.0f ?
state.world.nation_get_non_colonial_bureaucrats(n) / non_colonial : 0.0f;
205 float issue_sum = 0.0f;
206 for(
auto i :
state.culture_definitions.social_issues) {
207 issue_sum = issue_sum +
state.world.issue_option_get_administrative_multiplier(
state.world.nation_get_issues(n, i));
209 auto from_issues = issue_sum *
state.defines.bureaucracy_percentage_increment;
222template<culture::pop_strata Strata>
242 for(
auto prov :
state.world.nation_get_province_ownership(
state.local_player_nation)) {
244 for(
auto pop_loc : prov.get_province().get_pop_location()) {
245 auto pop_id = pop_loc.get_pop();
246 auto pop_strata =
state.world.pop_type_get_strata(
state.world.pop_get_poptype(pop_id));
247 auto pop_size = pop_strata ==
uint8_t(Strata) ?
state.world.pop_get_size(pop_id) : 0.f;
255 float integral = 0.f;
256 float total_area = 0.f;
259 float cutoff = (float)i /
count + 0.01f;
262 for(
auto prov :
state.world.nation_get_province_ownership(
state.local_player_nation)) {
264 for(
auto pop_loc : prov.get_province().get_pop_location()) {
265 auto pop_id = pop_loc.get_pop();
266 auto pop_strata =
state.world.pop_type_get_strata(
state.world.pop_get_poptype(pop_id));
267 auto pop_size = pop_strata ==
uint8_t(Strata) ?
state.world.pop_get_size(pop_id) : 0.f;
274 if(total / 3.f >= cutoff)
277 integral += total / 3.f * pop_size;
278 total_area += pop_size;
285 float area_ratio = integral / (total_area + 0.0001f);
291 r = 1.f - area_ratio * 0.5f;
292 g = std::sqrt(area_ratio);
293 b = std::sqrt(area_ratio) * 0.8f;
299template<culture::pop_strata Strata>
309 std::array<float, 5> sat_pool = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
310 for(
auto prov :
state.world.nation_get_province_ownership(
state.local_player_nation)) {
312 for(
auto pop_loc : prov.get_province().get_pop_location()) {
313 auto pop_id = pop_loc.get_pop();
314 auto pop_strata =
state.world.pop_type_get_strata(
state.world.pop_get_poptype(pop_id));
315 auto pop_size = pop_strata ==
uint8_t(Strata) ?
state.world.pop_get_size(pop_id) : 0.f;
338 static bool has_run =
false;
357 static const std::string needs_types[5] = {
"no_need",
"some_life_needs",
"life_needs",
"everyday_needs",
"luxury_needs"};
408template<budget_sl
ider_target Sl
iderTarget, sl
ider_scaling Sl
iderDisplayScaling, sl
ider_update_type Sl
iderUpdateType>
444 if(num_children >= 6) {
445 auto child_tag = dcon::gui_def_id(dcon::gui_def_id::value_base_t(5 + first_child.index()));
446 auto ch_res = make_element_by_type<image_element_base>(
state, child_tag);
451 if(num_children >= 5) {
452 auto child_tag = dcon::gui_def_id(dcon::gui_def_id::value_base_t(4 + first_child.index()));
453 auto ch_res = make_element_by_type<image_element_base>(
state, child_tag);
459 if(num_children >= 4) {
461 auto child_tag = dcon::gui_def_id(dcon::gui_def_id::value_base_t(2 + first_child.index()));
462 auto ch_res = make_element_by_type<scrollbar_slider>(
state, child_tag);
467 auto child_tag = dcon::gui_def_id(dcon::gui_def_id::value_base_t(0 + first_child.index()));
468 auto ch_res = make_element_by_type<scrollbar_left>(
state, child_tag);
481 auto child_tag = dcon::gui_def_id(dcon::gui_def_id::value_base_t(1 + first_child.index()));
482 auto ch_res = make_element_by_type<scrollbar_right>(
state, child_tag);
495 auto child_tag = dcon::gui_def_id(dcon::gui_def_id::value_base_t(3 + first_child.index()));
496 auto ch_res = make_element_by_type<scrollbar_track>(
state, child_tag);
524 float amount = float(v) / 100.0f;
529 switch(SliderDisplayScaling) {
533 amount = amount * amount;
542 commit_changes(
state);
546 switch(SliderTarget) {
549 int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::min_tax));
551 int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::max_tax));
554 max_tax = std::max(min_tax, max_tax);
560 new_settings.
lower_limit = std::clamp(min_tax, 0, 100);
561 new_settings.
upper_limit = std::clamp(max_tax, 0, 100);
566 int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::min_tax));
568 int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::max_tax));
571 max_tax = std::max(min_tax, max_tax);
577 new_settings.
lower_limit = std::clamp(min_tax, 0, 100);
578 new_settings.
upper_limit = std::clamp(max_tax, 0, 100);
583 int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::min_tax));
585 int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::max_tax));
588 max_tax = std::max(min_tax, max_tax);
594 new_settings.
lower_limit = std::clamp(min_tax, 0, 100);
595 new_settings.
upper_limit = std::clamp(max_tax, 0, 100);
599 auto min_spend = int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation,
600 sys::national_mod_offsets::min_social_spending));
601 auto max_spend = int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation,
602 sys::national_mod_offsets::max_social_spending));
605 max_spend = std::max(min_spend, max_spend);
611 new_settings.
lower_limit = std::clamp(min_spend, 0, 100);
612 new_settings.
upper_limit = std::clamp(max_spend, 0, 100);
616 auto min_spend = int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation,
617 sys::national_mod_offsets::min_military_spending));
618 auto max_spend = int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation,
619 sys::national_mod_offsets::max_military_spending));
622 max_spend = std::max(min_spend, max_spend);
628 new_settings.
lower_limit = std::clamp(min_spend, 0, 100);
629 new_settings.
upper_limit = std::clamp(max_spend, 0, 100);
633 auto min_tariff = int32_t(
634 100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::min_tariff));
635 auto max_tariff = int32_t(
636 100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::max_tariff));
637 max_tariff = std::max(min_tariff, max_tariff);
643 new_settings.
lower_limit = std::clamp(min_tariff, 0, 100);
644 new_settings.
upper_limit = std::clamp(max_tariff, 0, 100);
649 auto min_domestic_investment = int32_t(
650 100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::min_domestic_investment));
651 auto max_domestic_investment = int32_t(
652 100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::max_domestic_investment));
653 if(max_domestic_investment <= 0)
654 max_domestic_investment = 100;
655 max_domestic_investment = std::max(min_domestic_investment, max_domestic_investment);
661 new_settings.
lower_limit = std::clamp(min_domestic_investment, 0, 100);
662 new_settings.
upper_limit = std::clamp(max_domestic_investment, 0, 100);
682 float amount = float(v) / 100.f;
683 switch(SliderDisplayScaling) {
687 amount = amount * amount;
703 commit_changes(
state);
709 update_budget_settings(budget_settings);
715 switch(SliderTarget) {
717 budget_settings.poor_tax = new_val;
720 budget_settings.middle_tax = new_val;
723 budget_settings.rich_tax = new_val;
726 budget_settings.land_spending = new_val;
729 budget_settings.naval_spending = new_val;
732 budget_settings.construction_spending = new_val;
735 budget_settings.education_spending = new_val;
738 budget_settings.administrative_spending = new_val;
741 budget_settings.social_spending = new_val;
744 budget_settings.military_spending = new_val;
747 budget_settings.tariffs_import = new_val;
750 budget_settings.domestic_investment = new_val;
753 budget_settings.overseas = new_val;
763 return int32_t(
state.world.nation_get_poor_tax(
state.local_player_nation));
782 return int32_t(
state.world.nation_get_middle_tax(
state.local_player_nation));
801 return int32_t(
state.world.nation_get_rich_tax(
state.local_player_nation));
820 return int32_t(
state.world.nation_get_land_spending(
state.local_player_nation));
835 for(
uint32_t i = 1; i < total_commodities; ++i) {
836 dcon::commodity_id cid{ dcon::commodity_id::value_base_t(i) };
839 state.world.nation_for_each_state_ownership(n, [&](
auto soid) {
840 auto local_state =
state.world.state_ownership_get_state(soid);
841 auto market =
state.world.state_instance_get_market_from_local_market(local_state);
842 amount = amount +
state.world.market_get_army_demand(market, cid);
845 *
state.world.market_get_army_demand(market, cid);
855 std::string padding = cid.index() < 10 ?
"0" :
"";
856 std::string description =
"@$" + padding + std::to_string(cid.index());
868 return int32_t(
state.world.nation_get_naval_spending(
state.local_player_nation));
881 for(
uint32_t i = 1; i < total_commodities; ++i) {
882 dcon::commodity_id cid{ dcon::commodity_id::value_base_t(i) };
885 state.world.nation_for_each_state_ownership(n, [&](
auto soid) {
886 auto local_state =
state.world.state_ownership_get_state(soid);
887 auto market =
state.world.state_instance_get_market_from_local_market(local_state);
888 amount = amount +
state.world.market_get_navy_demand(market, cid);
891 *
state.world.market_get_navy_demand(market, cid);
902 std::string padding = cid.index() < 10 ?
"0" :
"";
903 std::string description =
"@$" + padding + std::to_string(cid.index());
915 return int32_t(
state.world.nation_get_construction_spending(
state.local_player_nation));
927 std::vector<float> total;
928 total.resize(
size_t(
state.world.commodity_size()), 0.0f);
929 std::vector<float> need;
930 need.resize(
size_t(
state.world.commodity_size()), 0.0f);
932 float admin_eff =
state.world.nation_get_administrative_efficiency(n);
933 float admin_cost_factor = 2.0f - admin_eff;
934 for(
auto lc :
state.world.nation_get_province_land_construction(n)) {
935 auto province =
state.world.pop_get_province_from_pop_location(
state.world.province_land_construction_get_pop(lc));
936 auto s =
state.world.province_get_state_membership(
province);
937 auto market =
state.world.state_instance_get_market_from_local_market(s);
938 if(
state.world.province_get_nation_from_province_control(
province) == n) {
939 auto& base_cost =
state.military_definitions.unit_base_definitions[
state.world.province_land_construction_get_type(lc)].build_cost;
940 auto& current_purchased =
state.world.province_land_construction_get_purchased_goods(lc);
941 float construction_time = float(
state.military_definitions.unit_base_definitions[
state.world.province_land_construction_get_type(lc)].build_time);
943 float total_cost = 0.f;
945 if(
auto cid = base_cost.commodity_type[i]; cid) {
946 if(current_purchased.commodity_amounts[i] < base_cost.commodity_amounts[i] * admin_cost_factor) {
947 float amount =
state.world.market_get_demand_satisfaction(market, cid) * base_cost.commodity_amounts[i] / construction_time;
949 total_cost += cost * amount;
950 total[base_cost.commodity_type[i].index()] += cost * amount;
951 need[base_cost.commodity_type[i].index()] += amount;
965 for(
auto po :
state.world.nation_get_province_ownership(n)) {
966 auto p = po.get_province();
967 auto s =
state.world.province_get_state_membership(p);
968 auto market =
state.world.state_instance_get_market_from_local_market(s);
969 if(
state.world.province_get_nation_from_province_control(p) != n)
971 auto rng =
state.world.province_get_province_naval_construction(p);
972 if(
rng.begin() !=
rng.end()) {
973 auto c = *(
rng.begin());
974 auto& base_cost =
state.military_definitions.unit_base_definitions[c.get_type()].build_cost;
975 auto& current_purchased = c.get_purchased_goods();
976 float construction_time = float(
state.military_definitions.unit_base_definitions[c.get_type()].build_time);
978 float total_cost = 0.f;
980 if(
auto cid = base_cost.commodity_type[i]; cid) {
981 if(current_purchased.commodity_amounts[i] < base_cost.commodity_amounts[i] * admin_cost_factor) {
982 float amount =
state.world.market_get_demand_satisfaction(market, cid) * base_cost.commodity_amounts[i] / construction_time;
984 total_cost += cost * amount;
985 total[base_cost.commodity_type[i].index()] += cost * amount;
986 need[base_cost.commodity_type[i].index()] += amount;
1000 for(
auto c :
state.world.nation_get_province_building_construction(n)) {
1001 auto p = c.get_province();
1002 auto s =
state.world.province_get_state_membership(p);
1003 auto market =
state.world.state_instance_get_market_from_local_market(s);
1004 if(n == c.get_province().get_nation_from_province_control() && !c.get_is_pop_project()) {
1006 auto& base_cost =
state.economy_definitions.building_definitions[int32_t(t)].cost;
1007 auto& current_purchased = c.get_purchased_goods();
1008 float construction_time = float(
state.economy_definitions.building_definitions[int32_t(t)].time);
1010 float total_cost = 0.f;
1012 if(
auto cid = base_cost.commodity_type[i]; cid) {
1013 if(current_purchased.commodity_amounts[i] < base_cost.commodity_amounts[i] * admin_cost_factor) {
1014 float amount =
state.world.market_get_demand_satisfaction(market, cid) * base_cost.commodity_amounts[i] / construction_time;
1016 total_cost += cost * amount;
1017 total[base_cost.commodity_type[i].index()] += cost * amount;
1018 need[base_cost.commodity_type[i].index()] += amount;
1032 float factory_mod =
state.world.nation_get_modifier_values(n, sys::national_mod_offsets::factory_cost) + 1.0f;
1033 for(
auto c :
state.world.nation_get_state_building_construction(n)) {
1034 auto market =
state.world.state_instance_get_market_from_local_market(c.get_state());
1035 if(!c.get_is_pop_project()) {
1036 auto& base_cost = c.get_type().get_construction_costs();
1037 auto& current_purchased = c.get_purchased_goods();
1038 float construction_time = float(c.get_type().get_construction_time()) * (c.get_is_upgrade() ? 0.1f : 1.0f);
1040 float total_cost = 0.f;
1042 if(
auto cid = base_cost.commodity_type[i]; cid) {
1043 if(current_purchased.commodity_amounts[i] < base_cost.commodity_amounts[i] * admin_cost_factor) {
1044 float amount =
state.world.market_get_demand_satisfaction(market, cid) * base_cost.commodity_amounts[i] * factory_mod / construction_time;
1046 total_cost += cost * amount;
1047 total[base_cost.commodity_type[i].index()] += cost * amount;
1048 need[base_cost.commodity_type[i].index()] += amount;
1063 bool is_spending =
false;
1064 for(
uint32_t i = 1; i < total_commodities; ++i) {
1065 is_spending = is_spending || (total[i] > 0.f);
1069 for(
uint32_t i = 1; i < total_commodities; ++i) {
1070 dcon::commodity_id cid{ dcon::commodity_id::value_base_t(i) };
1071 auto amount = total[i];
1072 auto required = need[i];
1074 if(required > 0.f) {
1082 std::string padding = cid.index() < 10 ?
"0" :
"";
1083 std::string description =
"@$" + padding + std::to_string(cid.index());
1096 return int32_t(
state.world.nation_get_education_spending(
state.local_player_nation));
1102 auto n = retrieve<dcon::nation_id>(
state,
parent);
1111 return int32_t(
state.world.nation_get_administrative_spending(
state.local_player_nation));
1117 auto n = retrieve<dcon::nation_id>(
state,
parent);
1126 return int32_t(
state.world.nation_get_social_spending(
state.local_player_nation));
1132 auto n = retrieve<dcon::nation_id>(
state,
parent);
1143 return int32_t(
state.world.nation_get_military_spending(
state.local_player_nation));
1149 auto n = retrieve<dcon::nation_id>(
state,
parent);
1160 return int32_t(
state.world.nation_get_tariffs_import(
state.local_player_nation));
1166 auto n = retrieve<dcon::nation_id>(
state,
parent);
1191 multipliers[i] = 1.f;
1198 total += values[i] * multipliers[i];
1206 }
else if(total > 0.0f) {
1224 auto n = retrieve<dcon::nation_id>(
state,
parent);
1228 float total_exp = 0.f;
1229 float total_inc = 0.f;
1231 float v = values[i] * multipliers[i];
1240 if(total_inc != 0.f) {
1244 float v = values[i] * multipliers[i];
1274 if(total_exp != 0.f) {
1278 float v = values[i] * multipliers[i];
1332 auto sig = any_cast<budget_slider_signal>(payload);
1333 multipliers[
uint8_t(sig.target)] = sig.amount;
1334 if(values[
uint8_t(sig.target)] != 0.f)
1383template<culture::pop_strata Strata, budget_sl
ider_target BudgetTarget>
1390template<culture::income_type IncomeType, budget_sl
ider_target BudgetTarget>
1499 return make_element_by_type<image_element_base>(
state,
id);
1500 }
else if(
name ==
"take_loan_label") {
1501 return make_element_by_type<simple_text_element_base>(
state,
id);
1502 }
else if(
name ==
"ok") {
1503 return make_element_by_type<button_element_base>(
state,
id);
1504 }
else if(
name ==
"cancel") {
1505 return make_element_by_type<generic_close_button>(
state,
id);
1506 }
else if(
name ==
"money_value") {
1507 return make_element_by_type<simple_text_element_base>(
state,
id);
1521 return make_element_by_type<image_element_base>(
state,
id);
1522 }
else if(
name ==
"repay_loan_label") {
1523 return make_element_by_type<simple_text_element_base>(
state,
id);
1524 }
else if(
name ==
"ok") {
1525 return make_element_by_type<button_element_base>(
state,
id);
1526 }
else if(
name ==
"cancel") {
1527 return make_element_by_type<generic_close_button>(
state,
id);
1528 }
else if(
name ==
"money_value") {
1529 return make_element_by_type<simple_text_element_base>(
state,
id);
1545 frame = int32_t(
state.world.pop_type_get_sprite(t) - 1);
1559 std::array<float, 5> sat_pool = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
1560 for(
auto prov :
state.world.nation_get_province_ownership(
state.local_player_nation)) {
1561 for(
auto pop_loc : prov.get_province().get_pop_location()) {
1562 auto pop_id = pop_loc.get_pop();
1563 if(pop_id.get_poptype() ==
type) {
1564 auto pop_size =
state.world.pop_get_size(pop_id);
1577 auto type_strata =
state.world.pop_type_get_strata(
type);
1602 static const std::string needs_types[5] = {
"no_need",
"some_life_needs",
"life_needs",
"everyday_needs",
"luxury_needs"};
1672 auto ptr = make_element_by_type<tax_list_pop_type_icon>(
state,
id);
1682 auto pop_type_id = any_cast<wrapped_listbox_row_content<dcon::pop_type_id>>(payload).content;
1690template<culture::pop_strata Strata>
1694 return "pop_listitem";
1700 state.world.for_each_pop_type([&](dcon::pop_type_id pt) {
1701 if(
state.world.pop_type_get_strata(pt) ==
uint8_t(Strata)) {
1709template<culture::income_type Income>
1713 return "pop_listitem";
1719 state.world.for_each_pop_type([&](dcon::pop_type_id pt) {
1720 if(
state.world.pop_type_get_life_needs_income_type(pt) ==
uint8_t(Income) ||
1721 state.world.pop_type_get_everyday_needs_income_type(pt) ==
uint8_t(Income) ||
1722 state.world.pop_type_get_luxury_needs_income_type(pt) ==
uint8_t(Income)) {
1730template<culture::income_type Income>
1734 return "pop_listitem_small";
1742 auto sig = any_cast<budget_slider_signal>(payload);
1752 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
1761 auto t =
state.world.nation_get_local_loan(
state.local_player_nation);
1764 float share = 10.0f;
1776 return n == o.n &&
amount == o.amount;
1779 return !(*
this == o);
1804 return make_element_by_type<debtor_name>(
state,
id);
1805 }
else if(
name ==
"debt") {
1806 return make_element_by_type<debtor_amount>(
state,
id);
1816 return "debt_listitem";
1823 auto t =
state.world.nation_get_local_loan(
state.local_player_nation);
1836 frame =
state.world.nation_get_is_debt_spending(
state.local_player_nation) ? 1 : 0;
1839 auto last_br =
state.world.nation_get_bankrupt_until(
state.local_player_nation);
1840 if(last_br &&
state.current_date < last_br)
1853 auto last_br =
state.world.nation_get_bankrupt_until(
state.local_player_nation);
1854 if(last_br &&
state.current_date < last_br) {
1868 return int32_t(
state.world.nation_get_domestic_investment_spending(
state.local_player_nation));
1874 auto n = retrieve<dcon::nation_id>(
state,
parent);
1883 "alice_domestic_investment_pops",
1887 state.world.nation_get_demographics(n,
1889 ) +
state.world.nation_get_demographics(n,
1898 "alice_domestic_investment_needs",
1908 float value =
state.world.nation_get_domestic_investment_spending(
state.local_player_nation) / 100.0f;
1918 return int32_t(
state.world.nation_get_overseas_spending(
state.local_player_nation));
1924 auto n = retrieve<dcon::nation_id>(
state,
parent);
1932 float value =
state.world.nation_get_overseas_spending(
state.local_player_nation) / 100.0f;
1946 auto win1337 = make_element_by_type<budget_take_loan_window>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"take_loan_window"))->second.definition);
1947 budget_take_loan_win = win1337.
get();
1948 win1337->base_data.position.y -= 66;
1949 win1337->set_visible(
state,
false);
1952 auto win101 = make_element_by_type<budget_repay_loan_window>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"repay_loan_window"))->second.definition);
1953 budget_repay_loan_win = win101.
get();
1954 win101->base_data.position.y -= 66;
1955 win101->set_visible(
state,
false);
1959 auto elm = make_element_by_type<enable_debt_toggle>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"alice_debt_checkbox"))->second.definition);
1964 auto elm = make_element_by_type<domestic_investment_slider>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"alice_domestic_investment_slider"))->second.definition);
1968 auto elm = make_element_by_type<simple_text_element_base>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"alice_domestic_investment_label"))->second.definition);
1972 auto elm = make_element_by_type<domestic_investment_estimated_text>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"alice_domestic_investment_value"))->second.definition);
1977 auto elm = make_element_by_type<overseas_maintenance_slider>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"alice_overseas_maintenance_slider"))->second.definition);
1981 auto elm = make_element_by_type<simple_text_element_base>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"alice_overseas_maintenance_label"))->second.definition);
1985 auto elm = make_element_by_type<overseas_maintenance_estimated_text>(
state,
state.ui_state.
defs_by_name.find(
state.lookup_key(
"alice_overseas_maintenance_value"))->second.definition);
1993 if(
name ==
"main_bg") {
1994 return make_element_by_type<image_element_base>(
state,
id);
1995 }
else if(
name ==
"bg_budget") {
1996 return make_element_by_type<opaque_element_base>(
state,
id);
1997 }
else if(
name ==
"tariff_mid") {
1998 return make_element_by_type<invisible_element>(
state,
id);
1999 }
else if(
name ==
"close_button") {
2000 return make_element_by_type<generic_close_button>(
state,
id);
2001 }
else if(
name ==
"tariffs_percent") {
2002 auto ptr = make_element_by_type<budget_tariff_percentage_text>(
state,
id);
2003 ptr->base_data.position.x += int16_t(10);
2005 }
else if(
name ==
"total_funds_val") {
2006 return make_element_by_type<nation_budget_funds_text>(
state,
id);
2007 }
else if(
name ==
"national_bank_val") {
2008 return make_element_by_type<nation_budget_bank_text>(
state,
id);
2009 }
else if(
name ==
"debt_val") {
2010 return make_element_by_type<nation_budget_debt_text>(
state,
id);
2011 }
else if(
name ==
"interest_val") {
2012 return make_element_by_type<nation_budget_interest_text>(
state,
id);
2013 }
else if(
name ==
"tab_takenloans") {
2014 return make_element_by_type<invisible_element>(
state,
id);
2015 }
else if(
name ==
"tab_givenloans") {
2016 return make_element_by_type<invisible_element>(
state,
id);
2017 }
else if(
name ==
"givenloans_text") {
2018 return make_element_by_type<invisible_element>(
state,
id);
2019 }
else if(
name ==
"take_loan") {
2020 return make_element_by_type<invisible_element>(
state,
id);
2021 }
else if(
name ==
"repay_loan") {
2022 return make_element_by_type<invisible_element>(
state,
id);
2023 }
else if(
name ==
"gunboat_alert") {
2024 return make_element_by_type<invisible_element>(
state,
id);
2025 }
else if(
name ==
"chart_debt") {
2026 return make_element_by_type<debt_piechart>(
state,
id);
2027 }
else if(
name ==
"debt_listbox") {
2028 return make_element_by_type<debt_listbox>(
state,
id);
2029 }
else if(
name ==
"chart_0") {
2030 return make_element_by_type<satisfaction_graph<culture::pop_strata::poor>>(
state, id);
2031 }
else if(
name ==
"chart_1") {
2032 return make_element_by_type<satisfaction_graph<culture::pop_strata::middle>>(
state, id);
2033 }
else if(
name ==
"chart_2") {
2034 return make_element_by_type<satisfaction_graph<culture::pop_strata::rich>>(
state, id);
2035 }
else if(
name ==
"overlay_0" ||
name ==
"overlay_1" ||
name ==
"overlay_2") {
2036 return make_element_by_type<invisible_element>(
state,
id);
2037 }
else if(
name ==
"nat_stock_val") {
2038 auto ptr = make_element_by_type<budget_actual_stockpile_spending_text>(
state,
id);
2039 ptr->expense =
true;
2041 }
else if(
name ==
"nat_stock_est") {
2042 auto ptr = make_element_by_type<budget_estimated_stockpile_spending_text>(
state,
id);
2043 ptr->expense =
true;
2045 }
else if(
name ==
"mil_cost_val") {
2046 auto ptr = make_element_by_type<budget_military_spending_text>(
state,
id);
2047 ptr->expense =
true;
2049 }
else if(
name ==
"overseas_cost_val") {
2050 auto ptr = make_element_by_type<budget_overseas_spending_text>(
state,
id);
2051 ptr->expense =
true;
2053 }
else if(
name ==
"tariff_val") {
2054 return make_element_by_type<budget_tariff_income_text>(
state,
id);
2055 }
else if(
name ==
"gold_inc") {
2056 return make_element_by_type<nation_gold_income_text>(
state,
id);
2057 }
else if(
name ==
"tax_0_inc") {
2058 return make_element_by_type<budget_stratified_tax_income_text<culture::pop_strata::poor, budget_slider_target::poor_tax>>(
state, id);
2059 }
else if(
name ==
"tax_1_inc") {
2060 return make_element_by_type<budget_stratified_tax_income_text<culture::pop_strata::middle, budget_slider_target::middle_tax>>(
state, id);
2061 }
else if(
name ==
"tax_2_inc") {
2062 return make_element_by_type<budget_stratified_tax_income_text<culture::pop_strata::rich, budget_slider_target::rich_tax>>(
state, id);
2063 }
else if(
name ==
"exp_val_0") {
2064 auto ptr = make_element_by_type<budget_expenditure_text<culture::income_type::education, budget_slider_target::education>>(
state, id);
2065 ptr->expense =
true;
2067 }
else if(
name ==
"exp_val_1") {
2068 auto ptr = make_element_by_type<budget_expenditure_text<culture::income_type::administration, budget_slider_target::admin>>(
state, id);
2069 ptr->expense =
true;
2071 }
else if(
name ==
"exp_val_2") {
2072 auto ptr = make_element_by_type<budget_social_spending_text>(
state,
id);
2073 ptr->expense =
true;
2075 }
else if(
name ==
"exp_val_3") {
2076 auto ptr = make_element_by_type<budget_expenditure_text<culture::income_type::military, budget_slider_target::military>>(
state, id);
2077 ptr->expense =
true;
2079 }
else if(
name ==
"admin_efficiency") {
2080 return make_element_by_type<nation_administrative_efficiency_text>(
state,
id);
2081 }
else if(
name ==
"interest_val") {
2082 return make_element_by_type<nation_loan_spending_text>(
state,
id);
2083 }
else if(
name ==
"ind_sub_val") {
2084 return make_element_by_type<nation_subsidy_spending_text>(
state,
id);
2085 }
else if(
name ==
"diplomatic_balance") {
2086 return make_element_by_type<nation_diplomatic_balance_text>(
state,
id);
2087 }
else if(
name ==
"total_inc") {
2088 return make_element_by_type<budget_income_projection_text>(
state,
id);
2089 }
else if(
name ==
"total_exp") {
2090 auto ptr = make_element_by_type<budget_expenditure_projection_text>(
state,
id);
2091 ptr->expense =
true;
2093 }
else if(
name ==
"balance") {
2094 return make_element_by_type<budget_balance_projection_text>(
state,
id);
2095 }
else if(
name ==
"tax_0_slider") {
2096 return make_element_by_type<budget_poor_tax_slider>(
state,
id);
2097 }
else if(
name ==
"tax_1_slider") {
2098 return make_element_by_type<budget_middle_tax_slider>(
state,
id);
2099 }
else if(
name ==
"tax_2_slider") {
2100 return make_element_by_type<budget_rich_tax_slider>(
state,
id);
2101 }
else if(
name ==
"land_stockpile_slider") {
2102 return make_element_by_type<budget_army_stockpile_slider>(
state,
id);
2103 }
else if(
name ==
"naval_stockpile_slider") {
2104 return make_element_by_type<budget_navy_stockpile_slider>(
state,
id);
2105 }
else if(
name ==
"projects_stockpile_slider") {
2106 return make_element_by_type<budget_construction_stockpile_slider>(
state,
id);
2107 }
else if(
name ==
"exp_0_slider") {
2108 return make_element_by_type<budget_education_slider>(
state,
id);
2109 }
else if(
name ==
"exp_1_slider") {
2110 return make_element_by_type<budget_administration_slider>(
state,
id);
2111 }
else if(
name ==
"exp_2_slider") {
2112 return make_element_by_type<budget_social_spending_slider>(
state,
id);
2113 }
else if(
name ==
"exp_3_slider") {
2114 return make_element_by_type<budget_military_spending_slider>(
state,
id);
2115 }
else if(
name ==
"tariff_slider") {
2116 return make_element_by_type<budget_tariff_slider>(
state,
id);
2117 }
else if(
name ==
"take_loan") {
2118 return make_element_by_type<budget_take_loan_button>(
state,
id);
2119 }
else if(
name ==
"repay_loan") {
2120 return make_element_by_type<budget_repay_loan_button>(
state,
id);
2121 }
else if(
name ==
"tax_0_pops") {
2122 return make_element_by_type<budget_pop_tax_list<culture::pop_strata::poor>>(
state, id);
2123 }
else if(
name ==
"tax_1_pops") {
2124 return make_element_by_type<budget_pop_tax_list<culture::pop_strata::middle>>(
state, id);
2125 }
else if(
name ==
"tax_2_pops") {
2126 return make_element_by_type<budget_pop_tax_list<culture::pop_strata::rich>>(
state, id);
2127 }
else if(
name ==
"exp_0_pops") {
2128 return make_element_by_type<budget_small_pop_income_list<culture::income_type::education>>(
state, id);
2129 }
else if(
name ==
"exp_1_pops") {
2130 return make_element_by_type<budget_small_pop_income_list<culture::income_type::administration>>(
state, id);
2133 }
else if(
name ==
"exp_3_pops") {
2134 return make_element_by_type<budget_pop_income_list<culture::income_type::military>>(
state, id);
2141 if(payload.holds_type<dcon::nation_id>()) {
2142 payload.emplace<dcon::nation_id>(
state.local_player_nation);
2147 bool type = any_cast<element_selection_wrapper<bool>>(payload).data;
dcon::text_key get_name() noexcept
void set_name(dcon::text_key text) noexcept
pop_satisfaction_wrapper_id(uint8_t v)
pop_satisfaction_wrapper_id()
void put_values(sys::state &state, std::array< float, size_t(budget_slider_target::target_count)> &vals) noexcept override
void put_values(sys::state &state, std::array< float, size_t(budget_slider_target::target_count)> &vals) noexcept override
void put_values(sys::state &state, std::array< float, size_t(budget_slider_target::target_count)> &vals) noexcept override
void put_values(sys::state &state, std::array< float, size_t(budget_slider_target::target_count)> &vals) noexcept override
void put_values(sys::state &state, std::array< float, size_t(budget_slider_target::target_count)> &vals) noexcept override
void put_values(sys::state &state, std::array< float, size_t(budget_slider_target::target_count)> &vals) noexcept override
void put_values(sys::state &state, std::array< float, size_t(budget_slider_target::target_count)> &vals) noexcept override
void put_values(sys::state &state, std::array< float, size_t(budget_slider_target::target_count)> &vals) 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
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
std::string_view get_row_element_name() override
void on_create(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 set(sys::state &state, Cyto::Any &payload) 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
virtual void put_values(sys::state &state, std::array< float, size_t(budget_slider_target::target_count)> &vals) noexcept
void apply_multipliers(sys::state &state) noexcept
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_drag_finish(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept final
virtual int32_t get_true_value(sys::state &state) noexcept
void on_update(sys::state &state) noexcept final
void on_value_change(sys::state &state, int32_t v) noexcept final
std::string_view get_row_element_name() override
void put_values(sys::state &state, std::array< float, size_t(budget_slider_target::target_count)> &vals) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
void put_values(sys::state &state, std::array< float, size_t(budget_slider_target::target_count)> &vals) noexcept override
void on_update(sys::state &state) noexcept override
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
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
void on_create(sys::state &state) noexcept override
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::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_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
virtual message_result impl_set(sys::state &state, Cyto::Any &payload) noexcept
virtual message_result get(sys::state &state, Cyto::Any &payload) 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 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 button_action(sys::state &state) noexcept override
void set_data_points(sys::state &state, std::vector< float > const &datapoints) noexcept
std::vector< debt_item_data > row_contents
void update(sys::state &state)
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
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
std::vector< dcon::pop_type_id > row_contents
void update(sys::state &state)
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
void on_update(sys::state &state) noexcept override
void populate_tooltip(sys::state &state, dcon::pop_satisfaction_wrapper_id psw, float percentage, text::columnar_layout &contents) noexcept override
void on_create(sys::state &state) noexcept override
void on_create(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
void set_type(sys::state &state, dcon::pop_type_id t)
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
budget_settings_data make_empty_budget_settings()
void change_budget_settings(sys::state &state, dcon::nation_id source, budget_settings_data const &values)
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
constexpr dcon::demographics_key middle_total(21)
dcon::demographics_key to_key(sys::state const &state, dcon::pop_type_id v)
constexpr dcon::demographics_key rich_total(22)
constexpr dcon::demographics_key poor_total(20)
float estimate_reparations_income(sys::state &state, dcon::nation_id n)
float estimate_subsidy_spending(sys::state &state, dcon::nation_id n)
float estimate_social_spending(sys::state &state, dcon::nation_id n)
float estimate_subject_payments_paid(sys::state &state, dcon::nation_id n)
float estimate_diplomatic_balance(sys::state &state, dcon::nation_id n)
float estimate_pop_payouts_by_income_type(sys::state &state, dcon::nation_id n, culture::income_type in)
float estimate_domestic_investment(sys::state &state, dcon::nation_id n)
float estimate_overseas_penalty_spending(sys::state &state, dcon::nation_id n)
float max_loan(sys::state &state, dcon::nation_id n)
float estimate_construction_spending(sys::state &state, dcon::nation_id n)
float estimate_war_subsidies_income(sys::state &state, dcon::nation_id n)
float estimate_land_spending(sys::state &state, dcon::nation_id n)
float price(sys::state const &state, dcon::state_instance_id s, dcon::commodity_id c)
float estimate_tariff_import_income(sys::state &state, dcon::nation_id n)
float estimate_subject_payments_received(sys::state &state, dcon::nation_id o)
float estimate_war_subsidies_spending(sys::state &state, dcon::nation_id n)
float estimate_reparations_spending(sys::state &state, dcon::nation_id n)
float estimate_naval_spending(sys::state &state, dcon::nation_id n)
float average_capitalists_luxury_cost(sys::state &state, dcon::nation_id s)
float estimate_tax_income_by_strata(sys::state &state, dcon::nation_id n, culture::pop_strata ps)
float estimate_stockpile_filling_spending(sys::state &state, dcon::nation_id n)
float interest_payment(sys::state &state, dcon::nation_id n)
float estimate_gold_income(sys::state &state, dcon::nation_id n)
uint32_t get_ui_color(sys::state &state, T id)
float get_luxury_needs(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)
uint32_t pack_color(float r, float g, float b)
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 format_money(float num)
layout_box open_layout_box(layout_base &dest, int32_t indent)
void add_unparsed_text_to_layout_box(sys::state &state, layout_base &dest, layout_box &box, std::string_view sv, substitution_map const &mp)
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 prettify(int64_t num)
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)
ankerl::unordered_dense::map< uint32_t, substitution > substitution_map
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
dcon::text_key get_name(sys::state &state, dcon::nation_id id)
std::string format_percentage(float num, size_t digits)
dcon::text_key find_or_add_key(sys::state &state, std::string_view key, bool as_unicode)
void close_layout_box(columnar_layout &dest, layout_box &box)
void send(sys::state &state, element_base *parent, T value)
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)
static constexpr uint32_t set_size
Holds important data about the game world, state, and other data regarding windowing,...
budget_slider_target target
bool operator==(debt_item_data o) const noexcept
bool operator!=(debt_item_data o) const noexcept
element_type get_element_type() 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 * drag_target