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) {
145 auto n =
state.local_player_nation;
150 text::fp_percentage{ 1.0f +
state.world.nation_get_modifier_values(n, sys::national_mod_offsets::administrative_efficiency_modifier) });
158 auto non_colonial =
state.world.nation_get_non_colonial_population(n);
159 auto total = non_colonial > 0.0f ?
state.world.nation_get_non_colonial_bureaucrats(n) / non_colonial : 0.0f;
168 float issue_sum = 0.0f;
169 for(
auto i :
state.culture_definitions.social_issues) {
170 issue_sum = issue_sum +
state.world.issue_option_get_administrative_multiplier(
state.world.nation_get_issues(n, i));
172 auto from_issues = issue_sum *
state.defines.bureaucracy_percentage_increment;
185template<culture::pop_strata Strata>
205 for(
auto prov :
state.world.nation_get_province_ownership(
state.local_player_nation)) {
207 for(
auto pop_loc : prov.get_province().get_pop_location()) {
208 auto pop_id = pop_loc.get_pop();
209 auto pop_strata =
state.world.pop_type_get_strata(
state.world.pop_get_poptype(pop_id));
210 auto pop_size = pop_strata ==
uint8_t(Strata) ?
state.world.pop_get_size(pop_id) : 0.f;
216 std::vector<float> datapoints(
count);
218 float integral = 0.f;
219 float total_area = 0.f;
222 float cutoff = (float)i /
count + 0.01f;
225 for(
auto prov :
state.world.nation_get_province_ownership(
state.local_player_nation)) {
227 for(
auto pop_loc : prov.get_province().get_pop_location()) {
228 auto pop_id = pop_loc.get_pop();
229 auto pop_strata =
state.world.pop_type_get_strata(
state.world.pop_get_poptype(pop_id));
230 auto pop_size = pop_strata ==
uint8_t(Strata) ?
state.world.pop_get_size(pop_id) : 0.f;
237 if(total / 3.f >= cutoff)
240 integral += total / 3.f * pop_size;
241 total_area += pop_size;
245 datapoints[i] = value;
248 float area_ratio = integral / (total_area + 0.0001f);
254 r = 1.f - area_ratio * 0.5f;
255 g = std::sqrt(area_ratio);
256 b = std::sqrt(area_ratio) * 0.8f;
262template<culture::pop_strata Strata>
272 std::array<float, 5> sat_pool = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
273 for(
auto prov :
state.world.nation_get_province_ownership(
state.local_player_nation)) {
275 for(
auto pop_loc : prov.get_province().get_pop_location()) {
276 auto pop_id = pop_loc.get_pop();
277 auto pop_strata =
state.world.pop_type_get_strata(
state.world.pop_get_poptype(pop_id));
278 auto pop_size = pop_strata ==
uint8_t(Strata) ?
state.world.pop_get_size(pop_id) : 0.f;
301 static bool has_run =
false;
320 static const std::string needs_types[5] = {
"no_need",
"some_life_needs",
"life_needs",
"everyday_needs",
"luxury_needs"};
367template<budget_sl
ider_target Sl
iderTarget, sl
ider_scaling Sl
iderDisplayScaling>
403 if(num_children >= 6) {
404 auto child_tag = dcon::gui_def_id(dcon::gui_def_id::value_base_t(5 + first_child.index()));
405 auto ch_res = make_element_by_type<image_element_base>(
state, child_tag);
410 if(num_children >= 5) {
411 auto child_tag = dcon::gui_def_id(dcon::gui_def_id::value_base_t(4 + first_child.index()));
412 auto ch_res = make_element_by_type<image_element_base>(
state, child_tag);
418 if(num_children >= 4) {
420 auto child_tag = dcon::gui_def_id(dcon::gui_def_id::value_base_t(2 + first_child.index()));
421 auto ch_res = make_element_by_type<scrollbar_slider>(
state, child_tag);
426 auto child_tag = dcon::gui_def_id(dcon::gui_def_id::value_base_t(0 + first_child.index()));
427 auto ch_res = make_element_by_type<scrollbar_left>(
state, child_tag);
440 auto child_tag = dcon::gui_def_id(dcon::gui_def_id::value_base_t(1 + first_child.index()));
441 auto ch_res = make_element_by_type<scrollbar_right>(
state, child_tag);
454 auto child_tag = dcon::gui_def_id(dcon::gui_def_id::value_base_t(3 + first_child.index()));
455 auto ch_res = make_element_by_type<scrollbar_track>(
state, child_tag);
483 float amount = float(v) / 100.0f;
484 switch(SliderDisplayScaling) {
488 amount = amount * amount;
496 commit_changes(
state);
500 switch(SliderTarget) {
503 int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::min_tax));
505 int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::max_tax));
508 max_tax = std::max(min_tax, max_tax);
514 new_settings.
lower_limit = std::clamp(min_tax, 0, 100);
515 new_settings.
upper_limit = std::clamp(max_tax, 0, 100);
520 int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::min_tax));
522 int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::max_tax));
525 max_tax = std::max(min_tax, max_tax);
531 new_settings.
lower_limit = std::clamp(min_tax, 0, 100);
532 new_settings.
upper_limit = std::clamp(max_tax, 0, 100);
537 int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::min_tax));
539 int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::max_tax));
542 max_tax = std::max(min_tax, max_tax);
548 new_settings.
lower_limit = std::clamp(min_tax, 0, 100);
549 new_settings.
upper_limit = std::clamp(max_tax, 0, 100);
553 auto min_spend = int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation,
554 sys::national_mod_offsets::min_social_spending));
555 auto max_spend = int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation,
556 sys::national_mod_offsets::max_social_spending));
559 max_spend = std::max(min_spend, max_spend);
565 new_settings.
lower_limit = std::clamp(min_spend, 0, 100);
566 new_settings.
upper_limit = std::clamp(max_spend, 0, 100);
570 auto min_spend = int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation,
571 sys::national_mod_offsets::min_military_spending));
572 auto max_spend = int32_t(100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation,
573 sys::national_mod_offsets::max_military_spending));
576 max_spend = std::max(min_spend, max_spend);
582 new_settings.
lower_limit = std::clamp(min_spend, 0, 100);
583 new_settings.
upper_limit = std::clamp(max_spend, 0, 100);
587 auto min_tariff = int32_t(
588 100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::min_tariff));
589 auto max_tariff = int32_t(
590 100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::max_tariff));
591 max_tariff = std::max(min_tariff, max_tariff);
597 new_settings.
lower_limit = std::clamp(min_tariff, 0, 100);
598 new_settings.
upper_limit = std::clamp(max_tariff, 0, 100);
603 auto min_domestic_investment = int32_t(
604 100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::min_domestic_investment));
605 auto max_domestic_investment = int32_t(
606 100.0f *
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::max_domestic_investment));
607 if(max_domestic_investment <= 0)
608 max_domestic_investment = 100;
609 max_domestic_investment = std::max(min_domestic_investment, max_domestic_investment);
615 new_settings.
lower_limit = std::clamp(min_domestic_investment, 0, 100);
616 new_settings.
upper_limit = std::clamp(max_domestic_investment, 0, 100);
632 float amount = float(v) / 100.f;
633 switch(SliderDisplayScaling) {
637 amount = amount * amount;
652 commit_changes(
state);
658 update_budget_settings(budget_settings);
664 switch(SliderTarget) {
666 budget_settings.poor_tax = new_val;
669 budget_settings.middle_tax = new_val;
672 budget_settings.rich_tax = new_val;
675 budget_settings.land_spending = new_val;
678 budget_settings.naval_spending = new_val;
681 budget_settings.construction_spending = new_val;
684 budget_settings.education_spending = new_val;
687 budget_settings.administrative_spending = new_val;
690 budget_settings.social_spending = new_val;
693 budget_settings.military_spending = new_val;
696 budget_settings.tariffs = new_val;
699 budget_settings.domestic_investment = new_val;
702 budget_settings.overseas = new_val;
713 return int32_t(
state.world.nation_get_poor_tax(
state.local_player_nation));
732 return int32_t(
state.world.nation_get_middle_tax(
state.local_player_nation));
751 return int32_t(
state.world.nation_get_rich_tax(
state.local_player_nation));
770 return int32_t(
state.world.nation_get_land_spending(
state.local_player_nation));
783 for(
uint32_t i = 1; i < total_commodities; ++i) {
784 dcon::commodity_id cid{ dcon::commodity_id::value_base_t(i) };
785 auto cost =
state.world.commodity_get_current_price(cid);
786 auto amount =
state.world.nation_get_army_demand(n, cid);
803 return int32_t(
state.world.nation_get_naval_spending(
state.local_player_nation));
816 for(
uint32_t i = 1; i < total_commodities; ++i) {
817 dcon::commodity_id cid{ dcon::commodity_id::value_base_t(i) };
818 auto cost =
state.world.commodity_get_current_price(cid);
819 auto amount =
state.world.nation_get_navy_demand(n, cid);
836 return int32_t(
state.world.nation_get_construction_spending(
state.local_player_nation));
848 std::vector<float> total;
849 total.resize(
size_t(
state.world.commodity_size()), 0.0f);
851 float admin_eff =
state.world.nation_get_administrative_efficiency(n);
852 float admin_cost_factor = 2.0f - admin_eff;
853 for(
auto lc :
state.world.nation_get_province_land_construction(n)) {
854 auto province =
state.world.pop_get_province_from_pop_location(
state.world.province_land_construction_get_pop(lc));
855 if(
state.world.province_get_nation_from_province_control(
province) == n) {
856 auto& base_cost =
state.military_definitions.unit_base_definitions[
state.world.province_land_construction_get_type(lc)].build_cost;
857 auto& current_purchased =
state.world.province_land_construction_get_purchased_goods(lc);
858 float construction_time = float(
state.military_definitions.unit_base_definitions[
state.world.province_land_construction_get_type(lc)].build_time);
860 float total_cost = 0.f;
862 if(
auto cid = base_cost.commodity_type[i]; cid) {
863 if(current_purchased.commodity_amounts[i] < base_cost.commodity_amounts[i] * admin_cost_factor) {
864 float amount =
state.world.nation_get_demand_satisfaction(n, cid) * base_cost.commodity_amounts[i] / construction_time;
865 float cost =
state.world.commodity_get_current_price(cid);
866 total_cost += cost * amount;
867 total[base_cost.commodity_type[i].index()] += cost * amount;
881 for(
auto po :
state.world.nation_get_province_ownership(n)) {
882 auto p = po.get_province();
883 if(
state.world.province_get_nation_from_province_control(p) != n)
885 auto rng =
state.world.province_get_province_naval_construction(p);
886 if(
rng.begin() !=
rng.end()) {
887 auto c = *(
rng.begin());
888 auto& base_cost =
state.military_definitions.unit_base_definitions[c.get_type()].build_cost;
889 auto& current_purchased = c.get_purchased_goods();
890 float construction_time = float(
state.military_definitions.unit_base_definitions[c.get_type()].build_time);
892 float total_cost = 0.f;
894 if(
auto cid = base_cost.commodity_type[i]; cid) {
895 if(current_purchased.commodity_amounts[i] < base_cost.commodity_amounts[i] * admin_cost_factor) {
896 float amount =
state.world.nation_get_demand_satisfaction(n, cid) * base_cost.commodity_amounts[i] / construction_time;
897 float cost =
state.world.commodity_get_current_price(cid);
898 total_cost += cost * amount;
899 total[base_cost.commodity_type[i].index()] += cost * amount;
913 for(
auto c :
state.world.nation_get_province_building_construction(n)) {
914 if(n == c.get_province().get_nation_from_province_control() && !c.get_is_pop_project()) {
916 auto& base_cost =
state.economy_definitions.building_definitions[int32_t(t)].cost;
917 auto& current_purchased = c.get_purchased_goods();
918 float construction_time = float(
state.economy_definitions.building_definitions[int32_t(t)].time);
920 float total_cost = 0.f;
922 if(
auto cid = base_cost.commodity_type[i]; cid) {
923 if(current_purchased.commodity_amounts[i] < base_cost.commodity_amounts[i] * admin_cost_factor) {
924 float amount =
state.world.nation_get_demand_satisfaction(n, cid) * base_cost.commodity_amounts[i] / construction_time;
925 float cost =
state.world.commodity_get_current_price(cid);
926 total_cost += cost * amount;
927 total[base_cost.commodity_type[i].index()] += cost * amount;
941 float factory_mod =
state.world.nation_get_modifier_values(n, sys::national_mod_offsets::factory_cost) + 1.0f;
942 for(
auto c :
state.world.nation_get_state_building_construction(n)) {
943 if(!c.get_is_pop_project()) {
944 auto& base_cost = c.get_type().get_construction_costs();
945 auto& current_purchased = c.get_purchased_goods();
946 float construction_time = float(c.get_type().get_construction_time()) * (c.get_is_upgrade() ? 0.1f : 1.0f);
948 float total_cost = 0.f;
950 if(
auto cid = base_cost.commodity_type[i]; cid) {
951 if(current_purchased.commodity_amounts[i] < base_cost.commodity_amounts[i] * admin_cost_factor) {
952 float amount =
state.world.nation_get_demand_satisfaction(n, cid) * base_cost.commodity_amounts[i] * factory_mod / construction_time;
953 float cost =
state.world.commodity_get_current_price(cid);
954 total_cost += cost * amount;
955 total[base_cost.commodity_type[i].index()] += cost * amount;
970 bool is_spending =
false;
971 for(
uint32_t i = 1; i < total_commodities; ++i) {
972 is_spending = is_spending || (total[i] > 0.f);
976 for(
uint32_t i = 1; i < total_commodities; ++i) {
977 dcon::commodity_id cid{ dcon::commodity_id::value_base_t(i) };
978 auto cost =
state.world.commodity_get_current_price(cid);
979 auto amount = total[i];
997 return int32_t(
state.world.nation_get_education_spending(
state.local_player_nation));
1003 auto n = retrieve<dcon::nation_id>(
state,
parent);
1012 return int32_t(
state.world.nation_get_administrative_spending(
state.local_player_nation));
1018 auto n = retrieve<dcon::nation_id>(
state,
parent);
1027 return int32_t(
state.world.nation_get_social_spending(
state.local_player_nation));
1033 auto n = retrieve<dcon::nation_id>(
state,
parent);
1044 return int32_t(
state.world.nation_get_military_spending(
state.local_player_nation));
1050 auto n = retrieve<dcon::nation_id>(
state,
parent);
1061 return int32_t(
state.world.nation_get_tariffs(
state.local_player_nation));
1067 auto n = retrieve<dcon::nation_id>(
state,
parent);
1092 multipliers[i] = 1.f;
1099 total += values[i] * multipliers[i];
1107 }
else if(total > 0.0f) {
1125 auto n = retrieve<dcon::nation_id>(
state,
parent);
1129 float total_exp = 0.f;
1130 float total_inc = 0.f;
1132 float v = values[i] * multipliers[i];
1141 if(total_inc != 0.f) {
1145 float v = values[i] * multipliers[i];
1175 if(total_exp != 0.f) {
1179 float v = values[i] * multipliers[i];
1233 auto sig = any_cast<budget_slider_signal>(payload);
1234 multipliers[
uint8_t(sig.target)] = sig.amount;
1235 if(values[
uint8_t(sig.target)] != 0.f)
1284template<culture::pop_strata Strata, budget_sl
ider_target BudgetTarget>
1291template<culture::income_type IncomeType, budget_sl
ider_target BudgetTarget>
1334 *
state.world.nation_get_domestic_investment_spending(
state.local_player_nation) / 100.0f
1335 *
state.world.nation_get_domestic_investment_spending(
state.local_player_nation) / 100.0f;
1368 *
state.world.nation_get_domestic_investment_spending(
state.local_player_nation) / 100.0f
1369 *
state.world.nation_get_domestic_investment_spending(
state.local_player_nation) / 100.0f;
1404 return make_element_by_type<image_element_base>(
state,
id);
1405 }
else if(
name ==
"take_loan_label") {
1406 return make_element_by_type<simple_text_element_base>(
state,
id);
1407 }
else if(
name ==
"ok") {
1408 return make_element_by_type<button_element_base>(
state,
id);
1409 }
else if(
name ==
"cancel") {
1410 return make_element_by_type<generic_close_button>(
state,
id);
1411 }
else if(
name ==
"money_value") {
1412 return make_element_by_type<simple_text_element_base>(
state,
id);
1426 return make_element_by_type<image_element_base>(
state,
id);
1427 }
else if(
name ==
"repay_loan_label") {
1428 return make_element_by_type<simple_text_element_base>(
state,
id);
1429 }
else if(
name ==
"ok") {
1430 return make_element_by_type<button_element_base>(
state,
id);
1431 }
else if(
name ==
"cancel") {
1432 return make_element_by_type<generic_close_button>(
state,
id);
1433 }
else if(
name ==
"money_value") {
1434 return make_element_by_type<simple_text_element_base>(
state,
id);
1450 frame = int32_t(
state.world.pop_type_get_sprite(t) - 1);
1464 std::array<float, 5> sat_pool = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
1465 for(
auto prov :
state.world.nation_get_province_ownership(
state.local_player_nation)) {
1466 for(
auto pop_loc : prov.get_province().get_pop_location()) {
1467 auto pop_id = pop_loc.get_pop();
1468 if(pop_id.get_poptype() ==
type) {
1469 auto pop_size =
state.world.pop_get_size(pop_id);
1482 auto type_strata =
state.world.pop_type_get_strata(
type);
1507 static const std::string needs_types[5] = {
"no_need",
"some_life_needs",
"life_needs",
"everyday_needs",
"luxury_needs"};
1577 auto ptr = make_element_by_type<tax_list_pop_type_icon>(
state,
id);
1587 auto pop_type_id = any_cast<wrapped_listbox_row_content<dcon::pop_type_id>>(payload).content;
1595template<culture::pop_strata Strata>
1599 return "pop_listitem";
1605 state.world.for_each_pop_type([&](dcon::pop_type_id pt) {
1606 if(
state.world.pop_type_get_strata(pt) ==
uint8_t(Strata)) {
1614template<culture::income_type Income>
1618 return "pop_listitem";
1624 state.world.for_each_pop_type([&](dcon::pop_type_id pt) {
1625 if(
state.world.pop_type_get_life_needs_income_type(pt) ==
uint8_t(Income) ||
1626 state.world.pop_type_get_everyday_needs_income_type(pt) ==
uint8_t(Income) ||
1627 state.world.pop_type_get_luxury_needs_income_type(pt) ==
uint8_t(Income)) {
1635template<culture::income_type Income>
1639 return "pop_listitem_small";
1647 auto sig = any_cast<budget_slider_signal>(payload);
1657 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
1672 }
else if(t <= 2000.0f) {
1674 }
else if(t <= 4000.0f) {
1678 float share = 10.0f;
1679 for(
auto n :
state.nations_by_rank) {
1680 if(
state.world.nation_get_is_great_power(n) && n !=
state.local_player_nation) {
1699 return n == o.n &&
amount == o.amount;
1702 return !(*
this == o);
1727 return make_element_by_type<debtor_name>(
state,
id);
1728 }
else if(
name ==
"debt") {
1729 return make_element_by_type<debtor_amount>(
state,
id);
1739 return "debt_listitem";
1752 }
else if(t <= 2000.0f) {
1754 }
else if(t <= 4000.0f) {
1758 float share = 10.0f;
1759 float total_shares = 0.0f;
1760 for(
auto n :
state.nations_by_rank) {
1761 if(
state.world.nation_get_is_great_power(n) && n !=
state.local_player_nation) {
1763 total_shares += share;
1773 r.amount = -t * r.amount / total_shares;
1784 frame =
state.world.nation_get_is_debt_spending(
state.local_player_nation) ? 1 : 0;
1787 auto last_br =
state.world.nation_get_bankrupt_until(
state.local_player_nation);
1788 if(last_br &&
state.current_date < last_br)
1801 auto last_br =
state.world.nation_get_bankrupt_until(
state.local_player_nation);
1802 if(last_br &&
state.current_date < last_br) {
1816 return int32_t(
state.world.nation_get_domestic_investment_spending(
state.local_player_nation));
1822 auto n = retrieve<dcon::nation_id>(
state,
parent);
1835 float value =
state.world.nation_get_domestic_investment_spending(
state.local_player_nation) / 100.0f;
1845 return int32_t(
state.world.nation_get_overseas_spending(
state.local_player_nation));
1851 auto n = retrieve<dcon::nation_id>(
state,
parent);
1859 float value =
state.world.nation_get_overseas_spending(
state.local_player_nation) / 100.0f;
1873 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);
1874 budget_take_loan_win = win1337.
get();
1875 win1337->base_data.position.y -= 66;
1876 win1337->set_visible(
state,
false);
1879 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);
1880 budget_repay_loan_win = win101.
get();
1881 win101->base_data.position.y -= 66;
1882 win101->set_visible(
state,
false);
1886 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);
1891 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);
1895 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);
1899 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);
1904 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);
1908 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);
1912 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);
1920 if(
name ==
"main_bg") {
1921 return make_element_by_type<image_element_base>(
state,
id);
1922 }
else if(
name ==
"bg_budget") {
1923 return make_element_by_type<opaque_element_base>(
state,
id);
1924 }
else if(
name ==
"tariff_mid") {
1925 return make_element_by_type<invisible_element>(
state,
id);
1926 }
else if(
name ==
"close_button") {
1927 return make_element_by_type<generic_close_button>(
state,
id);
1928 }
else if(
name ==
"tariffs_percent") {
1929 auto ptr = make_element_by_type<budget_tariff_percentage_text>(
state,
id);
1930 ptr->base_data.position.x += int16_t(10);
1932 }
else if(
name ==
"total_funds_val") {
1933 return make_element_by_type<nation_budget_funds_text>(
state,
id);
1934 }
else if(
name ==
"national_bank_val") {
1935 return make_element_by_type<nation_budget_bank_text>(
state,
id);
1936 }
else if(
name ==
"debt_val") {
1937 return make_element_by_type<nation_budget_debt_text>(
state,
id);
1938 }
else if(
name ==
"interest_val") {
1939 return make_element_by_type<nation_budget_interest_text>(
state,
id);
1940 }
else if(
name ==
"tab_takenloans") {
1941 return make_element_by_type<invisible_element>(
state,
id);
1942 }
else if(
name ==
"tab_givenloans") {
1943 return make_element_by_type<invisible_element>(
state,
id);
1944 }
else if(
name ==
"givenloans_text") {
1945 return make_element_by_type<invisible_element>(
state,
id);
1946 }
else if(
name ==
"take_loan") {
1947 return make_element_by_type<invisible_element>(
state,
id);
1948 }
else if(
name ==
"repay_loan") {
1949 return make_element_by_type<invisible_element>(
state,
id);
1950 }
else if(
name ==
"gunboat_alert") {
1951 return make_element_by_type<invisible_element>(
state,
id);
1952 }
else if(
name ==
"chart_debt") {
1953 return make_element_by_type<debt_piechart>(
state,
id);
1954 }
else if(
name ==
"debt_listbox") {
1955 return make_element_by_type<debt_listbox>(
state,
id);
1956 }
else if(
name ==
"chart_0") {
1957 return make_element_by_type<satisfaction_graph<culture::pop_strata::poor>>(
state, id);
1958 }
else if(
name ==
"chart_1") {
1959 return make_element_by_type<satisfaction_graph<culture::pop_strata::middle>>(
state, id);
1960 }
else if(
name ==
"chart_2") {
1961 return make_element_by_type<satisfaction_graph<culture::pop_strata::rich>>(
state, id);
1962 }
else if(
name ==
"overlay_0" ||
name ==
"overlay_1" ||
name ==
"overlay_2") {
1963 return make_element_by_type<invisible_element>(
state,
id);
1964 }
else if(
name ==
"nat_stock_val") {
1965 auto ptr = make_element_by_type<budget_actual_stockpile_spending_text>(
state,
id);
1966 ptr->expense =
true;
1968 }
else if(
name ==
"nat_stock_est") {
1969 auto ptr = make_element_by_type<budget_estimated_stockpile_spending_text>(
state,
id);
1970 ptr->expense =
true;
1972 }
else if(
name ==
"mil_cost_val") {
1973 auto ptr = make_element_by_type<budget_military_spending_text>(
state,
id);
1974 ptr->expense =
true;
1976 }
else if(
name ==
"overseas_cost_val") {
1977 auto ptr = make_element_by_type<budget_overseas_spending_text>(
state,
id);
1978 ptr->expense =
true;
1980 }
else if(
name ==
"tariff_val") {
1981 return make_element_by_type<budget_tariff_income_text>(
state,
id);
1982 }
else if(
name ==
"gold_inc") {
1983 return make_element_by_type<nation_gold_income_text>(
state,
id);
1984 }
else if(
name ==
"tax_0_inc") {
1985 return make_element_by_type<budget_stratified_tax_income_text<culture::pop_strata::poor, budget_slider_target::poor_tax>>(
state, id);
1986 }
else if(
name ==
"tax_1_inc") {
1987 return make_element_by_type<budget_stratified_tax_income_text<culture::pop_strata::middle, budget_slider_target::middle_tax>>(
state, id);
1988 }
else if(
name ==
"tax_2_inc") {
1989 return make_element_by_type<budget_stratified_tax_income_text<culture::pop_strata::rich, budget_slider_target::rich_tax>>(
state, id);
1990 }
else if(
name ==
"exp_val_0") {
1991 auto ptr = make_element_by_type<budget_expenditure_text<culture::income_type::education, budget_slider_target::education>>(
state, id);
1992 ptr->expense =
true;
1994 }
else if(
name ==
"exp_val_1") {
1995 auto ptr = make_element_by_type<budget_expenditure_text<culture::income_type::administration, budget_slider_target::admin>>(
state, id);
1996 ptr->expense =
true;
1998 }
else if(
name ==
"exp_val_2") {
1999 auto ptr = make_element_by_type<budget_social_spending_text>(
state,
id);
2000 ptr->expense =
true;
2002 }
else if(
name ==
"exp_val_3") {
2003 auto ptr = make_element_by_type<budget_expenditure_text<culture::income_type::military, budget_slider_target::military>>(
state, id);
2004 ptr->expense =
true;
2006 }
else if(
name ==
"admin_efficiency") {
2007 return make_element_by_type<nation_administrative_efficiency_text>(
state,
id);
2008 }
else if(
name ==
"interest_val") {
2009 return make_element_by_type<nation_loan_spending_text>(
state,
id);
2010 }
else if(
name ==
"ind_sub_val") {
2011 return make_element_by_type<nation_subsidy_spending_text>(
state,
id);
2012 }
else if(
name ==
"diplomatic_balance") {
2013 return make_element_by_type<nation_diplomatic_balance_text>(
state,
id);
2014 }
else if(
name ==
"total_inc") {
2015 return make_element_by_type<budget_income_projection_text>(
state,
id);
2016 }
else if(
name ==
"total_exp") {
2017 auto ptr = make_element_by_type<budget_expenditure_projection_text>(
state,
id);
2018 ptr->expense =
true;
2020 }
else if(
name ==
"balance") {
2021 return make_element_by_type<budget_balance_projection_text>(
state,
id);
2022 }
else if(
name ==
"tax_0_slider") {
2023 return make_element_by_type<budget_poor_tax_slider>(
state,
id);
2024 }
else if(
name ==
"tax_1_slider") {
2025 return make_element_by_type<budget_middle_tax_slider>(
state,
id);
2026 }
else if(
name ==
"tax_2_slider") {
2027 return make_element_by_type<budget_rich_tax_slider>(
state,
id);
2028 }
else if(
name ==
"land_stockpile_slider") {
2029 return make_element_by_type<budget_army_stockpile_slider>(
state,
id);
2030 }
else if(
name ==
"naval_stockpile_slider") {
2031 return make_element_by_type<budget_navy_stockpile_slider>(
state,
id);
2032 }
else if(
name ==
"projects_stockpile_slider") {
2033 return make_element_by_type<budget_construction_stockpile_slider>(
state,
id);
2034 }
else if(
name ==
"exp_0_slider") {
2035 return make_element_by_type<budget_education_slider>(
state,
id);
2036 }
else if(
name ==
"exp_1_slider") {
2037 return make_element_by_type<budget_administration_slider>(
state,
id);
2038 }
else if(
name ==
"exp_2_slider") {
2039 return make_element_by_type<budget_social_spending_slider>(
state,
id);
2040 }
else if(
name ==
"exp_3_slider") {
2041 return make_element_by_type<budget_military_spending_slider>(
state,
id);
2042 }
else if(
name ==
"tariff_slider") {
2043 return make_element_by_type<budget_tariff_slider>(
state,
id);
2044 }
else if(
name ==
"take_loan") {
2045 return make_element_by_type<budget_take_loan_button>(
state,
id);
2046 }
else if(
name ==
"repay_loan") {
2047 return make_element_by_type<budget_repay_loan_button>(
state,
id);
2048 }
else if(
name ==
"tax_0_pops") {
2049 return make_element_by_type<budget_pop_tax_list<culture::pop_strata::poor>>(
state, id);
2050 }
else if(
name ==
"tax_1_pops") {
2051 return make_element_by_type<budget_pop_tax_list<culture::pop_strata::middle>>(
state, id);
2052 }
else if(
name ==
"tax_2_pops") {
2053 return make_element_by_type<budget_pop_tax_list<culture::pop_strata::rich>>(
state, id);
2054 }
else if(
name ==
"exp_0_pops") {
2055 return make_element_by_type<budget_small_pop_income_list<culture::income_type::education>>(
state, id);
2056 }
else if(
name ==
"exp_1_pops") {
2057 return make_element_by_type<budget_small_pop_income_list<culture::income_type::administration>>(
state, id);
2060 }
else if(
name ==
"exp_3_pops") {
2061 return make_element_by_type<budget_pop_income_list<culture::income_type::military>>(
state, id);
2068 if(payload.holds_type<dcon::nation_id>()) {
2069 payload.emplace<dcon::nation_id>(
state.local_player_nation);
2074 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_update(sys::state &state) noexcept final
void on_create(sys::state &state) noexcept final
virtual int32_t get_true_value(sys::state &state) noexcept
void on_value_change(sys::state &state, int32_t v) noexcept final
void on_drag_finish(sys::state &state) noexcept override
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_tariff_income(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)
constexpr dcon::commodity_id money(0)
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 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 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
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