32 if(
state.cheat_data.show_province_id_tooltip) {
52 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
93 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
109 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
125 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
167 std::vector<float> datapoints(
size_t(32));
168 for(
size_t i = 0; i <
state.player_data_cache.treasury_record.size(); ++i)
169 datapoints[i] =
state.player_data_cache.treasury_record[(
state.ui_date.value + 1 + i) % 32] -
state.player_data_cache.treasury_record[(
state.ui_date.value + 0 + i) % 32];
170 datapoints[datapoints.size() - 1] =
state.player_data_cache.treasury_record[(
state.ui_date.value + 1 + 31) % 32] -
state.player_data_cache.treasury_record[(
state.ui_date.value + 0 + 31) % 32];
171 datapoints[0] = datapoints[1];
196 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
227 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
249 auto pop_amount =
state.player_data_cache.population_record[
state.ui_date.value % 32];
250 auto pop_change =
state.ui_date.value <= 32
251 ? (
state.ui_date.value <= 2 ? 0.0f : pop_amount -
state.player_data_cache.population_record[2])
252 : (pop_amount -
state.player_data_cache.population_record[(
state.ui_date.value - 30) % 32]);
275 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
277 auto pop_amount =
state.player_data_cache.population_record[
state.ui_date.value % 32];
278 auto pop_change =
state.ui_date.value <= 30 ? 0.0f : (pop_amount -
state.player_data_cache.population_record[(
state.ui_date.value - 30) % 32]);
301 auto current_day_record =
state.player_data_cache.treasury_record[
state.ui_date.value % 32];
302 auto previous_day_record =
state.player_data_cache.treasury_record[(
state.ui_date.value + 31) % 32];
303 auto change = current_day_record - previous_day_record;
415 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
419 if(in_use < available) {
427 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
430 float relevant_pop =
state.world.nation_get_demographics(nation_id,
432 for(
auto ac :
state.world.in_culture) {
433 if(
state.world.nation_get_accepted_cultures(nation_id, ac)) {
438 auto fPoints = relevant_pop /
state.defines.national_focus_divider;
449 nation_fat_id.for_each_state_ownership([&](dcon::state_ownership_id so) {
451 if(fat_state_id.is_valid()) {
452 auto staat = fat_state_id.get_state();
453 if(staat.is_valid()) {
454 auto natl_fat_id = staat.get_owner_focus();
455 if(natl_fat_id.is_valid()) {
480 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
491 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
524 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
531 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
569 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
603 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
624 int32_t num_ships = 0;
625 for(
auto nv :
state.world.nation_get_navy_control(n)) {
626 num_ships += int32_t(nv.get_navy().get_navy_membership().end() - nv.get_navy().get_navy_membership().begin());
634 for(
const auto nv :
state.world.nation_get_navy_control_as_controller(n)) {
636 for(
const auto memb : nv.get_navy().get_navy_membership()) {
637 total +=
state.military_definitions.unit_base_definitions[memb.get_ship().get_type()].supply_consumption_score;
661 int32_t possible_sum = 0;
662 int32_t raised_sum = 0;
664 for(
auto prov_own : fat_id.get_province_ownership_as_nation()) {
665 auto prov = prov_own.get_province();
668 for(
auto prov_own : fat_id.get_province_ownership_as_nation()) {
669 auto prov = prov_own.get_province();
694 float getResearchPointsFromPop(
sys::state&
state, dcon::pop_type_id pop, dcon::nation_id n) {
704 state.world.pop_type_get_research_optimum(
state.culture_definitions.officers));
719 state.world.pop_type_get_name(
state.culture_definitions.officers));
753 auto const override_and_show_tab = [&]() {
762 override_and_show_tab();
765 override_and_show_tab();
840 auto const override_and_show_tab = [&]() {
854 override_and_show_tab();
857 override_and_show_tab();
884 if(
state.actual_game_speed <= 0) {
891 if(
state.actual_game_speed <= 0) {
895 state.actual_game_speed = 0;
906 disabled =
state.internally_paused ||
state.ui_pause.load(std::memory_order::acquire);
922 auto ymd =
state.current_date.to_ymd(
state.start_date);
929 float nh_temp = 15.f;
930 std::string nh_season;
931 if(ymd.month == 12 || ymd.month <= 2) {
933 }
else if(ymd.month >= 3 && ymd.month <= 5) {
935 }
else if(ymd.month >= 6 && ymd.month <= 8) {
937 }
else if(ymd.month >= 9 && ymd.month <= 11) {
942 std::string sh_season;
943 if(ymd.month >= 6 && ymd.month <= 8) {
945 }
else if(ymd.month >= 9 && ymd.month <= 11) {
947 }
else if(ymd.month == 12 || ymd.month <= 2) {
949 }
else if(ymd.month >= 3 && ymd.month <= 5) {
970 if(
state.actual_game_speed > 0) {
971 state.actual_game_speed = std::min(5,
state.actual_game_speed.load() + 1);
1000 if(
state.actual_game_speed > 0) {
1001 state.actual_game_speed = std::max(1,
state.actual_game_speed.load() - 1);
1025 if(
state.internally_paused ||
state.ui_pause.load(std::memory_order::acquire)) {
1041 state.world.nation_get_rank(nation_id) > uint16_t(
state.defines.great_nations_count)));
1051 }
else if(
state.world.nation_get_rank(
state.local_player_nation) > uint16_t(
state.defines.great_nations_count)) {
1056 for(
const auto gp :
state.great_nations) {
1057 if(gp.nation ==
state.local_player_nation) {
1064 }
else if(
state.world.nation_get_rank(
state.local_player_nation) <= uint16_t(
state.defines.great_nations_count)) {
1091 auto nation_id = any_cast<dcon::nation_id>(payload);
1099 nation_fat_id.for_each_state_building_construction([&](dcon::state_building_construction_id building_slim_id) {
1101 auto stateName = building_fat_id.get_state().get_definition().get_name();
1102 auto factoryType = building_fat_id.get_type().get_name();
1129 auto nation_id = any_cast<dcon::nation_id>(payload);
1138 for(
auto staat_owner : nation_fat.get_state_ownership()) {
1139 auto staat = staat_owner.get_state().get_definition();
1140 bool new_staat =
true;
1141 for(
auto abstract : staat.get_abstract_state_membership()) {
1142 auto prov = abstract.get_province();
1143 for(
auto factloc : prov.get_factory_location()) {
1144 auto scale = factloc.get_factory().get_production_scale();
1170 visible = (
state.world.nation_get_spending_level(
state.local_player_nation) < 1.0f);
1190 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
1191 bool has_unemployed =
false;
1193 std::array<dcon::pop_type_id, 2> factory_workers{
1194 state.culture_definitions.primary_factory_worker,
1195 state.culture_definitions.secondary_factory_worker
1197 for(
auto pt : factory_workers) {
1198 for(
auto si :
state.world.nation_get_state_ownership(nation_id)) {
1199 auto state_instance = si.get_state();
1202 if(unemployed >= 1.0f) {
1203 has_unemployed =
true;
1210 frame = has_unemployed ? 0 : 1;
1218 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
1219 bool header =
false;
1220 std::array<dcon::pop_type_id, 2> factory_workers{
1221 state.culture_definitions.primary_factory_worker,
1222 state.culture_definitions.secondary_factory_worker
1224 for(
auto pt : factory_workers) {
1225 for(
auto si :
state.world.nation_get_state_ownership(nation_id)) {
1226 auto state_instance = si.get_state();
1229 if(unemployed >= 1.f) {
1246 std::array<dcon::pop_type_id, 2> rgo_workers{
1247 state.culture_definitions.farmers,
1248 state.culture_definitions.laborers
1250 for(
auto pt : rgo_workers) {
1251 for(
auto si :
state.world.nation_get_state_ownership(nation_id)) {
1252 auto state_instance = si.get_state();
1255 if(unemployed >= 1.f) {
1289 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
1299 auto last_date =
state.world.nation_get_last_issue_or_reform_change(nation_id);
1300 if(
bool(last_date) && (last_date + int32_t(
state.defines.min_delay_between_reforms * 30.0f)) >
state.current_date) {
1304 if(
state.world.nation_get_is_civilized(nation_id)) {
1305 for(
auto i :
state.culture_definitions.political_issues) {
1306 for(
auto o :
state.world.issue_get_options(i)) {
1317 for(
auto i :
state.culture_definitions.social_issues) {
1318 for(
auto o :
state.world.issue_get_options(i)) {
1332 for(
auto i :
state.culture_definitions.military_issues) {
1333 for(
auto o :
state.world.reform_get_options(i)) {
1344 for(
auto i :
state.culture_definitions.economic_issues) {
1345 for(
auto o :
state.world.reform_get_options(i)) {
1361 auto const override_and_show_tab = [&]() {
1375 override_and_show_tab();
1377 override_and_show_tab();
1394 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
1403 state.world.for_each_decision([&](dcon::decision_id di) {
1404 if(nation_id !=
state.local_player_nation || !
state.world.decision_get_hide_notification(di)) {
1405 auto lim = state.world.decision_get_potential(di);
1406 if(!lim || trigger::evaluate(state, lim, trigger::to_generic(nation_id), trigger::to_generic(nation_id), 0)) {
1407 auto allow = state.world.decision_get_allow(di);
1408 if(!allow || trigger::evaluate(state, allow, trigger::to_generic(nation_id), trigger::to_generic(nation_id), 0)) {
1409 auto fat_id = dcon::fatten(state.world, di);
1410 auto box = text::open_layout_box(contents);
1411 text::add_to_layout_box(state, contents, box, fat_id.get_name(), m);
1412 text::close_layout_box(contents, box);
1421 auto const override_and_show_tab = [&]() {
1435 override_and_show_tab();
1437 override_and_show_tab();
1450 return tooltip_behavior::variable_tooltip;
1454 auto nation_id = retrieve<dcon::nation_id>(
state, parent);
1475 for(
auto rf :
state.world.nation_get_rebellion_within(
state.local_player_nation)) {
1476 auto org = rf.get_rebels().get_organization();
1486 return tooltip_behavior::variable_tooltip;
1490 bool showed_title =
false;
1492 for(
auto rf :
state.world.nation_get_rebellion_within(
state.local_player_nation)) {
1493 auto org = rf.get_rebels().get_organization();
1498 showed_title =
true;
1501 auto rebelsize = rf.get_rebels().get_possible_regiments();
1512 auto const override_and_show_tab = [&]() {
1516 Cyto::Any defs = Cyto::make_any<politics_window_tab>(politics_window_tab::movements);
1526 override_and_show_tab();
1528 override_and_show_tab();
1537 dcon::province_id get_state_def_province(
sys::state&
state, dcon::state_definition_id sdef)
noexcept {
1538 for(
auto const p :
state.world.state_definition_get_abstract_state_membership(sdef)) {
1539 if(!p.get_province().get_nation_from_province_ownership()) {
1540 return p.get_province();
1543 return dcon::province_id{};
1547 std::vector<dcon::province_id>
provinces;
1548 auto nation_id = retrieve<dcon::nation_id>(
state, parent);
1550 for(
auto si :
state.world.nation_get_state_ownership(nation_id)) {
1552 provinces.push_back(si.get_state().get_capital());
1556 state.world.for_each_state_definition([&](dcon::state_definition_id sdef) {
1559 for(
auto p :
state.world.state_definition_get_abstract_state_membership(sdef)) {
1560 if(!p.get_province().get_nation_from_province_ownership()) {
1561 province = p.get_province().id;
1571 nation_fat_id.for_each_colonization([&](dcon::colonization_id colony) {
1572 auto sdef =
state.world.colonization_get_state(colony);
1573 if(
state.world.state_definition_get_colonization_stage(sdef) == 3) {
1574 provinces.push_back(get_state_def_province(state, sdef));
1576 provinces.push_back(get_state_def_province(state, sdef));
1578 auto lvl = state.world.colonization_get_level(colony);
1579 for(auto cols : state.world.state_definition_get_colonization(sdef)) {
1580 if(lvl < cols.get_level()) {
1581 provinces.push_back(get_state_def_province(state, sdef));
1592 if(
auto prov = provinces[index];
prov &&
prov.value <
state.province_definitions.first_sea_province.value) {
1594 state.map_state.set_selected_province(prov);
1598 state.map_state.center_map_on_province(state, prov);
1604 bool any_integratable =
false;
1605 for(
auto si :
state.world.nation_get_state_ownership(nation_id)) {
1607 any_integratable =
true;
1611 state.world.for_each_state_definition([&](dcon::state_definition_id sdef) {
1613 any_integratable =
true;
1628 return tooltip_behavior::variable_tooltip;
1632 auto nation_id = retrieve<dcon::nation_id>(
state, parent);
1635 bool is_empty =
true;
1637 for(
auto si :
state.world.nation_get_state_ownership(nation_id)) {
1644 state.world.for_each_state_definition([&](dcon::state_definition_id sdef) {
1651 nation_fat_id.for_each_colonization([&](dcon::colonization_id colony) {
1652 auto sdef =
state.world.colonization_get_state(colony);
1653 if(
state.world.state_definition_get_colonization_stage(sdef) == 3) {
1660 auto lvl =
state.world.colonization_get_level(colony);
1661 for(
auto cols :
state.world.state_definition_get_colonization(sdef)) {
1662 if(lvl < cols.get_level()) {
1680 }
else if(
state.crisis_temperature > 0.8f) {
1688 return tooltip_behavior::variable_tooltip;
1716 for(
const auto par :
state.crisis_participants) {
1717 if(!par.merely_interested && par.supports_attacker) {
1723 for(
const auto par :
state.crisis_participants) {
1724 if(!par.merely_interested && !par.supports_attacker) {
1730 for(
const auto par :
state.crisis_participants) {
1731 if(par.merely_interested) {
1736 if(
state.last_crisis_end_date) {
1757 return tooltip_behavior::variable_tooltip;
1761 auto n = retrieve<dcon::nation_id>(
state, parent);
1766 bool added_increase_header =
false;
1768 for(
auto it :
state.world.nation_get_gp_relationship_as_great_power(n)) {
1770 if(it.get_influence() >=
state.defines.increaseopinion_influence_cost
1774 if(!added_increase_header)
1776 added_increase_header =
true;
1778 }
else if(!(it.get_influence_target().get_in_sphere_of()) &&
1779 it.get_influence() >=
state.defines.addtosphere_influence_cost) {
1780 if(!added_increase_header)
1782 added_increase_header =
true;
1784 }
else if(it.get_influence_target().get_in_sphere_of()
1786 it.get_influence() >=
state.defines.removefromsphere_influence_cost) {
1787 if(!added_increase_header)
1789 added_increase_header =
true;
1794 bool added_reb_header =
false;
1795 for(
auto m :
state.world.in_nation) {
1796 if(
state.world.nation_get_in_sphere_of(m) == n) {
1798 for(
auto fac :
state.world.nation_get_rebellion_within(m)) {
1800 if(!added_reb_header)
1802 added_reb_header =
true;
1811 if(!added_increase_header && !added_reb_header)
1820 return tooltip_behavior::variable_tooltip;
1826 expanded_hitbox_text::on_create(
state);
1835 auto nation_id = retrieve<dcon::nation_id>(
state, parent);
1841 for(
auto pt :
state.world.in_pop_type) {
1842 auto rp =
state.world.pop_type_get_research_points(pt);
1865 if(!
bool(tech_id)) {
1878 dcon::commodity_id commodity_id{};
1882 return tooltip_behavior::variable_tooltip;
1898 dcon::nation_id current_nation{};
1899 std::vector<topbar_commodity_xport_icon*> import_icons;
1900 std::vector<topbar_commodity_xport_icon*> export_icons;
1901 std::vector<topbar_commodity_xport_icon*> produced_icons;
1906 window_element_base::on_create(
state);
1907 base_data.position.y += 1;
1909 auto bg_pic = make_element_by_type<background_image>(
state,
"bg_main_menus");
1910 background_pic = bg_pic.get();
1911 background_pic->base_data.position.y -= 1;
1912 add_child_to_back(std::move(bg_pic));
1914 auto dpi_win = make_element_by_type<ui::diplomatic_message_topbar_listbox>(
state,
"alice_diplomessageicons_window");
1916 add_child_to_front(std::move(dpi_win));
1923 if(
name ==
"topbar_bg") {
1924 return partially_transparent_image::make_element_by_type_alias(
state,
id);
1925 }
else if(
name ==
"topbar_paper") {
1926 return partially_transparent_image::make_element_by_type_alias(
state,
id);
1927 }
else if(
name ==
"topbarbutton_production") {
1928 auto btn = make_element_by_type<topbar_production_tab_button>(
state,
id);
1930 auto tab = make_element_by_type<production_window>(
state,
"country_production");
1932 state.ui_state.
root->add_child_to_back(std::move(tab));
1934 }
else if(
name ==
"topbarbutton_budget") {
1935 auto btn = make_element_by_type<topbar_budget_tab_button>(
state,
id);
1937 auto tab = make_element_by_type<budget_window>(
state,
"country_budget");
1938 btn->topbar_subwindow = tab.get();
1939 state.ui_state.
root->add_child_to_back(std::move(tab));
1941 }
else if(
name ==
"topbarbutton_tech") {
1942 auto btn = make_element_by_type<topbar_technology_tab_button>(
state,
id);
1944 auto tab = make_element_by_type<technology_window>(
state,
"country_technology");
1945 btn->topbar_subwindow = tab.get();
1948 state.ui_state.
root->add_child_to_back(std::move(tab));
1950 }
else if(
name ==
"topbarbutton_politics") {
1951 auto btn = make_element_by_type<topbar_politics_tab_button>(
state,
id);
1952 auto tab = make_element_by_type<politics_window>(
state,
"country_politics");
1953 btn->topbar_subwindow = tab.get();
1956 state.ui_state.
root->add_child_to_back(std::move(tab));
1958 }
else if(
name ==
"topbarbutton_pops") {
1959 auto btn = make_element_by_type<topbar_population_view_button>(
state,
id);
1960 auto tab = make_element_by_type<population_window>(
state,
"country_pop");
1961 btn->topbar_subwindow = tab.get();
1964 state.ui_state.
root->add_child_to_back(std::move(tab));
1966 }
else if(
name ==
"topbarbutton_trade") {
1967 auto btn = make_element_by_type<topbar_trade_tab_button>(
state,
id);
1969 auto tab = make_element_by_type<trade_window>(
state,
"alice_country_trade");
1970 btn->topbar_subwindow = tab.get();
1973 state.ui_state.
root->add_child_to_back(std::move(tab));
1975 }
else if(
name ==
"topbarbutton_diplomacy") {
1976 auto btn = make_element_by_type<topbar_diplomacy_tab_button>(
state,
id);
1978 auto tab = make_element_by_type<diplomacy_window>(
state,
"country_diplomacy");
1979 btn->topbar_subwindow = tab.get();
1980 state.ui_state.
root->add_child_to_back(std::move(tab));
1982 }
else if(
name ==
"topbarbutton_military") {
1983 auto btn = make_element_by_type<topbar_military_tab_button>(
state,
id);
1985 auto tab = make_element_by_type<military_window>(
state,
"country_military");
1986 btn->topbar_subwindow = tab.get();
1987 state.ui_state.
root->add_child_to_back(std::move(tab));
1989 }
else if(
name ==
"button_speedup") {
1990 return make_element_by_type<topbar_speedup_button>(
state,
id);
1991 }
else if(
name ==
"button_speeddown") {
1992 return make_element_by_type<topbar_speeddown_button>(
state,
id);
1993 }
else if(
name ==
"pause_bg") {
1994 return make_element_by_type<topbar_pause_button>(
state,
id);
1995 }
else if(
name ==
"speed_indicator") {
1996 return make_element_by_type<topbar_speed_indicator>(
state,
id);
1997 }
else if(
name ==
"datetext") {
1998 return make_element_by_type<topbar_date_text>(
state,
id);
1999 }
else if(
name ==
"countryname") {
2000 return make_element_by_type<topbar_nation_name>(
state,
id);
2001 }
else if(
name ==
"player_flag") {
2002 return make_element_by_type<flag_button>(
state,
id);
2003 }
else if(
name ==
"country_prestige") {
2004 return make_element_by_type<topbar_nation_prestige_text>(
state,
id);
2005 }
else if(
name ==
"country_economic") {
2006 return make_element_by_type<topbar_nation_industry_score_text>(
state,
id);
2007 }
else if(
name ==
"country_military") {
2008 return make_element_by_type<topbar_nation_military_score_text>(
state,
id);
2009 }
else if(
name ==
"country_total") {
2010 return make_element_by_type<nation_total_score_text>(
state,
id);
2011 }
else if(
name ==
"country_colonial_power") {
2012 return make_element_by_type<topbar_nation_colonial_power_text>(
state,
id);
2013 }
else if(
name ==
"selected_prestige_rank") {
2014 return make_element_by_type<nation_prestige_rank_text>(
state,
id);
2015 }
else if(
name ==
"selected_industry_rank") {
2016 return make_element_by_type<nation_industry_rank_text>(
state,
id);
2017 }
else if(
name ==
"selected_military_rank") {
2018 return make_element_by_type<nation_military_rank_text>(
state,
id);
2019 }
else if(
name ==
"nation_totalrank") {
2020 return make_element_by_type<nation_rank_text>(
state,
id);
2021 }
else if(
name ==
"topbar_flag_overlay") {
2022 return make_element_by_type<nation_flag_frame>(
state,
id);
2023 }
else if(
name ==
"alert_building_factories") {
2024 return make_element_by_type<topbar_building_factories_icon>(
state,
id);
2025 }
else if(
name ==
"alert_closed_factories") {
2026 return make_element_by_type<topbar_closed_factories_icon>(
state,
id);
2027 }
else if(
name ==
"alert_unemployed_workers") {
2028 return make_element_by_type<topbar_unemployment_icon>(
state,
id);
2029 }
else if(
name ==
"budget_linechart") {
2030 return make_element_by_type<topbar_budget_line_graph>(
state,
id);
2031 }
else if(
name ==
"alice_budget_warning") {
2032 return make_element_by_type<topbar_budget_warning>(
state,
id);
2033 }
else if(
name ==
"budget_funds") {
2034 return make_element_by_type<topbar_treasury_text>(
state,
id);
2035 }
else if(
name ==
"topbar_tech_progress") {
2036 return make_element_by_type<nation_technology_research_progress>(
state,
id);
2037 }
else if(
name ==
"tech_current_research") {
2038 return make_element_by_type<nation_current_research_text>(
state,
id);
2039 }
else if(
name ==
"topbar_researchpoints_value") {
2040 return make_element_by_type<topbar_nation_daily_research_points_text>(
state,
id);
2041 }
else if(
name ==
"tech_literacy_value") {
2042 return make_element_by_type<topbar_nation_literacy_text>(
state,
id);
2043 }
else if(
name ==
"politics_party_icon") {
2044 return make_element_by_type<nation_ruling_party_ideology_plupp>(
state,
id);
2045 }
else if(
name ==
"politics_ruling_party") {
2046 return make_element_by_type<nation_ruling_party_text>(
state,
id);
2047 }
else if(
name ==
"politics_supressionpoints_value") {
2048 return make_element_by_type<nation_suppression_points_text>(
state,
id);
2049 }
else if(
name ==
"politics_infamy_value") {
2050 return make_element_by_type<topbar_nation_infamy_text>(
state,
id);
2051 }
else if(
name ==
"alert_can_do_reforms") {
2052 return make_element_by_type<topbar_available_reforms_icon>(
state,
id);
2053 }
else if(
name ==
"alert_can_do_decisions") {
2054 return make_element_by_type<topbar_available_decisions_icon>(
state,
id);
2055 }
else if(
name ==
"alert_is_in_election") {
2056 return make_element_by_type<topbar_ongoing_election_icon>(
state,
id);
2057 }
else if(
name ==
"alert_have_rebels") {
2058 return make_element_by_type<topbar_rebels_icon>(
state,
id);
2059 }
else if(
name ==
"population_total_value") {
2060 return make_element_by_type<topbar_nation_population_text>(
state,
id);
2061 }
else if(
name ==
"topbar_focus_value") {
2062 return make_element_by_type<topbar_nation_focus_allocation_text>(
state,
id);
2063 }
else if(
name ==
"population_avg_mil_value") {
2064 return make_element_by_type<topbar_nation_militancy_text>(
state,
id);
2065 }
else if(
name ==
"population_avg_con_value") {
2066 return make_element_by_type<topbar_nation_consciousness_text>(
state,
id);
2067 }
else if(
name ==
"diplomacy_status") {
2068 auto ptr = make_element_by_type<topbar_at_peace_text>(
state,
id);
2069 atpeacetext = ptr.
get();
2071 }
else if(
name ==
"diplomacy_at_war") {
2072 auto ptr = make_element_by_type<overlapping_enemy_flags>(
state,
id);
2073 ptr->base_data.position.y -= ptr->base_data.position.y / 4;
2074 ptr->base_data.size.x /= 2;
2076 }
else if(
name ==
"diplomacy_diplopoints_value") {
2077 return make_element_by_type<topbar_nation_diplomatic_points_text>(
state,
id);
2078 }
else if(
name ==
"alert_colony") {
2079 return make_element_by_type<topbar_colony_icon>(
state,
id);
2080 }
else if(
name ==
"alert_crisis") {
2081 return make_element_by_type<topbar_crisis_icon>(
state,
id);
2082 }
else if(
name ==
"alert_can_increase_opinion") {
2083 return make_element_by_type<topbar_sphere_icon>(
state,
id);
2084 }
else if(
name ==
"alert_loosing_gp") {
2085 return make_element_by_type<topbar_losing_gp_status_icon>(
state,
id);
2086 }
else if(
name ==
"military_army_value") {
2087 return make_element_by_type<topbar_nation_brigade_allocation_text>(
state,
id);
2088 }
else if(
name ==
"military_navy_value") {
2089 return make_element_by_type<topbar_nation_navy_allocation_text>(
state,
id);
2090 }
else if(
name ==
"military_manpower_value") {
2091 return make_element_by_type<topbar_nation_mobilization_size_text>(
state,
id);
2092 }
else if(
name ==
"military_leadership_value") {
2093 return make_element_by_type<topbar_nation_leadership_points_text>(
state,
id);
2094 }
else if(
name ==
"topbar_outlinerbutton" ||
name ==
"topbar_outlinerbutton_bg") {
2096 return make_element_by_type<invisible_element>(
state,
id);
2097 }
else if(
name.substr(0, 13) ==
"topbar_import") {
2098 auto ptr = make_element_by_type<topbar_commodity_xport_icon>(
state,
id);
2099 std::string var = std::string{
name.substr(13)};
2100 var.empty() ? ptr->slot =
uint8_t(0) : ptr->slot =
uint8_t(std::stoi(var));
2101 import_icons.push_back(ptr.get());
2103 }
else if(
name.substr(0, 13) ==
"topbar_export") {
2104 auto ptr = make_element_by_type<topbar_commodity_xport_icon>(
state,
id);
2105 std::string var = std::string{
name.substr(13)};
2106 var.empty() ? ptr->slot =
uint8_t(0) : ptr->slot =
uint8_t(std::stoi(var));
2107 export_icons.push_back(ptr.get());
2109 }
else if(
name.substr(0, 15) ==
"topbar_produced") {
2110 auto ptr = make_element_by_type<topbar_commodity_xport_icon>(
state,
id);
2111 std::string var = std::string{
name.substr(15)};
2112 var.empty() ? ptr->slot =
uint8_t(0) : ptr->slot =
uint8_t(std::stoi(var));
2113 produced_icons.push_back(ptr.get());
2115 }
else if (
name ==
"selected_military_icon") {
2116 return make_element_by_type<military_score_icon>(
state,
id);
2124 if(
state.local_player_nation != current_nation) {
2125 current_nation =
state.local_player_nation;
2127 impl_set(
state, payload);
2130 for(
auto& e : export_icons)
2131 e->set_visible(
state,
false);
2132 for(
auto& e : import_icons)
2133 e->set_visible(
state,
false);
2134 for(
auto& e : produced_icons)
2135 e->set_visible(
state,
false);
2138 std::map<float, int32_t> v;
2139 for(dcon::commodity_id cid :
state.world.in_commodity) {
2146 float produced =
state.world.nation_get_domestic_market_pool(
state.local_player_nation, cid);
2147 float consumed =
state.world.nation_get_real_demand(
state.local_player_nation, cid) *
2148 state.world.nation_get_demand_satisfaction(
state.local_player_nation, cid);
2149 v.insert({produced -
consumed, cid.index()});
2153 for(
auto it = std::rbegin(v); it != std::rend(v); it++) {
2154 for(
auto const& e : export_icons)
2155 if(e->slot == slot) {
2156 dcon::commodity_id cid = dcon::commodity_id(dcon::commodity_id::value_base_t(it->second));
2157 e->frame =
state.world.commodity_get_icon(cid);
2158 e->commodity_id = cid;
2159 e->amount = it->first;
2160 e->set_visible(
state,
true);
2165 for(
auto it = v.begin(); it != v.end(); it++) {
2166 for(
auto const& e : import_icons)
2167 if(e->slot == slot) {
2168 dcon::commodity_id cid = dcon::commodity_id(dcon::commodity_id::value_base_t(it->second));
2169 e->frame =
state.world.commodity_get_icon(cid);
2170 e->commodity_id = cid;
2171 e->amount = it->first;
2172 e->set_visible(
state,
true);
2179 std::map<float, int32_t> v;
2180 for(dcon::commodity_id cid :
state.world.in_commodity) {
2187 v.insert({
state.world.nation_get_domestic_market_pool(
state.local_player_nation, cid), cid.index()});
2191 for(
auto it = std::rbegin(v); it != std::rend(v); it++) {
2192 for(
auto const& e : produced_icons)
2193 if(e->slot == slot) {
2194 dcon::commodity_id cid = dcon::commodity_id(dcon::commodity_id::value_base_t(it->second));
2195 e->frame =
state.world.commodity_get_icon(cid);
2196 e->commodity_id = cid;
2197 e->amount = it->first;
2198 e->set_visible(
state,
true);
2207 background_pic->set_visible(
state,
true);
2209 background_pic->set_visible(
state,
false);
2211 window_element_base::render(
state, x, y);
2215 if(payload.holds_type<dcon::nation_id>()) {
2216 payload.emplace<dcon::nation_id>(
state.local_player_nation);
2217 return message_result::consumed;
2219 return message_result::unseen;
void render(sys::state &state, int32_t x, int32_t y) 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 impl_on_update(sys::state &state) noexcept
message_result impl_get(sys::state &state, Cyto::Any &payload) noexcept
void set_visible(sys::state &state, bool vis)
ui::xy_pair bottom_right_extension
void on_create(sys::state &state) noexcept override
ui::xy_pair top_left_extension
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
void set_data_points(sys::state &state, std::vector< float > const &datapoints) noexcept
text::layout internal_layout
void set_text(sys::state &state, std::string const &new_text)
std::string get_text(sys::state &state, dcon::nation_id nation_id) noexcept override
void button_action(sys::state &state) noexcept override
int32_t get_icon_frame(sys::state &state, dcon::nation_id nation_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
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
topbar_budget_line_graph()
void render(sys::state &state, int32_t x, int32_t y) 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
int32_t get_icon_frame(sys::state &state, dcon::nation_id nation_id) 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, dcon::nation_id nation_id) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
int32_t get_icon_frame(sys::state &state, dcon::nation_id nation_id) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void button_action(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 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
int32_t get_icon_frame(sys::state &state, dcon::nation_id nation_id) noexcept override
void on_update(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
int32_t get_icon_frame(sys::state &state, dcon::nation_id nation_id) 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 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 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_create(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
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 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_create(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 on_create(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 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 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
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
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
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
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
tooltip_behavior has_tooltip(sys::state &state) noexcept override
int32_t get_icon_frame(sys::state &state, dcon::nation_id nation_id) 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 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
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, dcon::nation_id nation_id) 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
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
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 render(sys::state &state, int32_t x, int32_t y) noexcept 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 get(sys::state &state, Cyto::Any &payload) noexcept override
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
float get_estimated_literacy_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_mil_change(sys::state &state, dcon::pop_id ids)
constexpr dcon::demographics_key consciousness(3)
float get_estimated_con_change(sys::state &state, dcon::pop_id ids)
dcon::demographics_key to_employment_key(sys::state const &state, dcon::pop_type_id v)
constexpr dcon::demographics_key literacy(5)
constexpr dcon::demographics_key militancy(4)
bool nation_is_constructing_factories(sys::state &state, dcon::nation_id n)
bool nation_has_closed_factories(sys::state &state, dcon::nation_id n)
constexpr float zoom_very_close
int32_t naval_supply_points_used(sys::state &state, dcon::nation_id n)
int32_t mobilized_regiments_created_from_province(sys::state &state, dcon::province_id p)
int32_t mobilized_regiments_possible_from_province(sys::state &state, dcon::province_id p)
int32_t naval_supply_points(sys::state &state, dcon::nation_id n)
constexpr uint8_t is_banned
constexpr uint8_t level_friendly
constexpr uint8_t level_in_sphere
constexpr uint8_t level_mask
float colonial_points_from_naval_bases(sys::state &state, dcon::nation_id n)
status get_status(sys::state &state, dcon::nation_id n)
bool is_great_power(sys::state const &state, dcon::nation_id id)
int32_t free_colonial_points(sys::state &state, dcon::nation_id n)
bool is_losing_colonial_race(sys::state &state, dcon::nation_id n)
float used_colonial_points(sys::state &state, dcon::nation_id n)
bool can_expand_colony(sys::state &state, dcon::nation_id n)
float diplomatic_points(sys::state const &state, dcon::nation_id n)
float prestige_score(sys::state const &state, dcon::nation_id n)
float colonial_points_from_technology(sys::state &state, dcon::nation_id n)
float monthly_diplomatic_points(sys::state const &state, dcon::nation_id n)
float daily_research_points(sys::state &state, dcon::nation_id n)
bool has_decision_available(sys::state &state, dcon::nation_id n)
int64_t get_monthly_pop_increase_of_nation(sys::state &state, dcon::nation_id n)
bool sphereing_progress_is_possible(sys::state &state, dcon::nation_id n)
int32_t national_focuses_in_use(sys::state &state, dcon::nation_id n)
bool has_reform_available(sys::state &state, dcon::nation_id n)
dcon::technology_id current_research(sys::state const &state, dcon::nation_id n)
int32_t max_national_focuses(sys::state &state, dcon::nation_id n)
float get_treasury(sys::state &state, dcon::nation_id n)
float colonial_points_from_ships(sys::state &state, dcon::nation_id n)
bool can_enact_social_reform(sys::state &state, dcon::nation_id n, dcon::issue_option_id o)
bool can_enact_political_reform(sys::state &state, dcon::nation_id nation, dcon::issue_option_id issue_option)
dcon::issue_id get_issue_by_name(sys::state &state, std::string_view name)
bool can_enact_military_reform(sys::state &state, dcon::nation_id n, dcon::reform_option_id o)
bool has_elections(sys::state &state, dcon::nation_id nation)
bool is_election_ongoing(sys::state &state, dcon::nation_id nation)
bool can_enact_economic_reform(sys::state &state, dcon::nation_id n, dcon::reform_option_id o)
bool can_integrate_colony(sys::state &state, dcon::state_instance_id id)
bool can_start_colony(sys::state &state, dcon::nation_id n, dcon::state_definition_id d)
bool can_invest_in_colony(sys::state &state, dcon::nation_id n, dcon::state_definition_id d)
int32_t get_faction_brigades_active(sys::state &state, dcon::rebel_faction_id r)
bool sphere_member_has_ongoing_revolt(sys::state &state, dcon::nation_id n)
std::string rebel_name(sys::state &state, dcon::rebel_faction_id reb)
audio_instance & get_tab_population_sound(sys::state &state)
audio_instance & get_tab_production_sound(sys::state &state)
audio_instance & get_tab_budget_sound(sys::state &state)
audio_instance & get_tab_technology_sound(sys::state &state)
audio_instance & get_unpause_sound(sys::state &state)
audio_instance & get_tab_politics_sound(sys::state &state)
audio_instance & get_pause_sound(sys::state &state)
void play_interface_sound(sys::state &state, audio_instance &s, float volume)
audio_instance & get_tab_diplomacy_sound(sys::state &state)
audio_instance & get_click_sound(sys::state &state)
audio_instance & get_tab_military_sound(sys::state &state)
bool is_leap_year(int32_t year)
@ industrial_and_consumer_goods
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_ratio(int32_t left, int32_t right)
layout_box open_layout_box(layout_base &dest, int32_t indent)
std::string date_to_string(sys::state &state, sys::date date)
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)
endless_layout create_endless_layout(sys::state &state, layout &dest, layout_parameters const ¶ms)
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)
std::string get_dynamic_state_name(sys::state &state, dcon::state_instance_id state_id)
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)
void add_space_to_layout_box(sys::state &state, layout_base &dest, layout_box &box)
void nation_name_and_flag(sys::state &state, dcon::nation_id n, layout_base &dest, int32_t indent)
std::string prettify_currency(float num)
void close_layout_box(columnar_layout &dest, layout_box &box)
int32_t ui_height(sys::state const &state)
int32_t ui_width(sys::state const &state)
void produce_decision_substitutions(sys::state &state, text::substitution_map &m, dcon::nation_id n)
std::variant< std::monostate, dcon::nation_id, dcon::state_instance_id, dcon::province_id > pop_list_filter
bool events_pause_test(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)
union ui::element_data::internal_data data
element_base * technology_subwindow
element_base * trade_subwindow
element_base * topbar_window
element_base * topbar_subwindow
std::unique_ptr< element_base > root
element_base * request_topbar_listbox
element_base * population_subwindow
element_base * politics_subwindow
element_base * production_subwindow