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();
1169 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
1170 bool has_unemployed =
false;
1172 std::array<dcon::pop_type_id, 2> factory_workers{
1173 state.culture_definitions.primary_factory_worker,
1174 state.culture_definitions.secondary_factory_worker
1176 for(
auto pt : factory_workers) {
1177 for(
auto si :
state.world.nation_get_state_ownership(nation_id)) {
1178 auto state_instance = si.get_state();
1181 if(unemployed >= 1.0f) {
1182 has_unemployed =
true;
1189 frame = has_unemployed ? 0 : 1;
1197 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
1198 bool header =
false;
1199 std::array<dcon::pop_type_id, 2> factory_workers{
1200 state.culture_definitions.primary_factory_worker,
1201 state.culture_definitions.secondary_factory_worker
1203 for(
auto pt : factory_workers) {
1204 for(
auto si :
state.world.nation_get_state_ownership(nation_id)) {
1205 auto state_instance = si.get_state();
1208 if(unemployed >= 1.f) {
1225 std::array<dcon::pop_type_id, 2> rgo_workers{
1226 state.culture_definitions.farmers,
1227 state.culture_definitions.laborers
1229 for(
auto pt : rgo_workers) {
1230 for(
auto si :
state.world.nation_get_state_ownership(nation_id)) {
1231 auto state_instance = si.get_state();
1234 if(unemployed >= 1.f) {
1268 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
1278 auto last_date =
state.world.nation_get_last_issue_or_reform_change(nation_id);
1279 if(
bool(last_date) && (last_date + int32_t(
state.defines.min_delay_between_reforms * 30.0f)) >
state.current_date) {
1283 if(
state.world.nation_get_is_civilized(nation_id)) {
1284 for(
auto i :
state.culture_definitions.political_issues) {
1285 for(
auto o :
state.world.issue_get_options(i)) {
1296 for(
auto i :
state.culture_definitions.social_issues) {
1297 for(
auto o :
state.world.issue_get_options(i)) {
1311 for(
auto i :
state.culture_definitions.military_issues) {
1312 for(
auto o :
state.world.reform_get_options(i)) {
1323 for(
auto i :
state.culture_definitions.economic_issues) {
1324 for(
auto o :
state.world.reform_get_options(i)) {
1340 auto const override_and_show_tab = [&]() {
1354 override_and_show_tab();
1356 override_and_show_tab();
1373 auto nation_id = retrieve<dcon::nation_id>(
state,
parent);
1382 state.world.for_each_decision([&](dcon::decision_id di) {
1383 if(nation_id !=
state.local_player_nation || !
state.world.decision_get_hide_notification(di)) {
1384 auto lim = state.world.decision_get_potential(di);
1385 if(!lim || trigger::evaluate(state, lim, trigger::to_generic(nation_id), trigger::to_generic(nation_id), 0)) {
1386 auto allow = state.world.decision_get_allow(di);
1387 if(!allow || trigger::evaluate(state, allow, trigger::to_generic(nation_id), trigger::to_generic(nation_id), 0)) {
1388 auto fat_id = dcon::fatten(state.world, di);
1389 auto box = text::open_layout_box(contents);
1390 text::add_to_layout_box(state, contents, box, fat_id.get_name(), m);
1391 text::close_layout_box(contents, box);
1400 auto const override_and_show_tab = [&]() {
1414 override_and_show_tab();
1416 override_and_show_tab();
1429 return tooltip_behavior::variable_tooltip;
1433 auto nation_id = retrieve<dcon::nation_id>(
state, parent);
1454 for(
auto rf :
state.world.nation_get_rebellion_within(
state.local_player_nation)) {
1455 auto org = rf.get_rebels().get_organization();
1465 return tooltip_behavior::variable_tooltip;
1469 bool showed_title =
false;
1471 for(
auto rf :
state.world.nation_get_rebellion_within(
state.local_player_nation)) {
1472 auto org = rf.get_rebels().get_organization();
1477 showed_title =
true;
1480 auto rebelsize = rf.get_rebels().get_possible_regiments();
1491 auto const override_and_show_tab = [&]() {
1495 Cyto::Any defs = Cyto::make_any<politics_window_tab>(politics_window_tab::movements);
1505 override_and_show_tab();
1507 override_and_show_tab();
1516 dcon::province_id get_state_def_province(
sys::state&
state, dcon::state_definition_id sdef)
noexcept {
1517 for(
auto const p :
state.world.state_definition_get_abstract_state_membership(sdef)) {
1518 if(!p.get_province().get_nation_from_province_ownership()) {
1519 return p.get_province();
1522 return dcon::province_id{};
1526 std::vector<dcon::province_id>
provinces;
1527 auto nation_id = retrieve<dcon::nation_id>(
state, parent);
1529 for(
auto si :
state.world.nation_get_state_ownership(nation_id)) {
1531 provinces.push_back(si.get_state().get_capital());
1535 state.world.for_each_state_definition([&](dcon::state_definition_id sdef) {
1538 for(
auto p :
state.world.state_definition_get_abstract_state_membership(sdef)) {
1539 if(!p.get_province().get_nation_from_province_ownership()) {
1540 province = p.get_province().id;
1550 nation_fat_id.for_each_colonization([&](dcon::colonization_id colony) {
1551 auto sdef =
state.world.colonization_get_state(colony);
1552 if(
state.world.state_definition_get_colonization_stage(sdef) == 3) {
1553 provinces.push_back(get_state_def_province(state, sdef));
1555 provinces.push_back(get_state_def_province(state, sdef));
1557 auto lvl = state.world.colonization_get_level(colony);
1558 for(auto cols : state.world.state_definition_get_colonization(sdef)) {
1559 if(lvl < cols.get_level()) {
1560 provinces.push_back(get_state_def_province(state, sdef));
1571 if(
auto prov = provinces[index];
prov &&
prov.value <
state.province_definitions.first_sea_province.value) {
1573 state.map_state.set_selected_province(prov);
1577 state.map_state.center_map_on_province(state, prov);
1583 bool any_integratable =
false;
1584 for(
auto si :
state.world.nation_get_state_ownership(nation_id)) {
1586 any_integratable =
true;
1590 state.world.for_each_state_definition([&](dcon::state_definition_id sdef) {
1592 any_integratable =
true;
1607 return tooltip_behavior::variable_tooltip;
1611 auto nation_id = retrieve<dcon::nation_id>(
state, parent);
1614 bool is_empty =
true;
1616 for(
auto si :
state.world.nation_get_state_ownership(nation_id)) {
1623 state.world.for_each_state_definition([&](dcon::state_definition_id sdef) {
1630 nation_fat_id.for_each_colonization([&](dcon::colonization_id colony) {
1631 auto sdef =
state.world.colonization_get_state(colony);
1632 if(
state.world.state_definition_get_colonization_stage(sdef) == 3) {
1639 auto lvl =
state.world.colonization_get_level(colony);
1640 for(
auto cols :
state.world.state_definition_get_colonization(sdef)) {
1641 if(lvl < cols.get_level()) {
1659 }
else if(
state.crisis_temperature > 0.8f) {
1667 return tooltip_behavior::variable_tooltip;
1695 for(
const auto par :
state.crisis_participants) {
1696 if(!par.merely_interested && par.supports_attacker) {
1702 for(
const auto par :
state.crisis_participants) {
1703 if(!par.merely_interested && !par.supports_attacker) {
1709 for(
const auto par :
state.crisis_participants) {
1710 if(par.merely_interested) {
1715 if(
state.last_crisis_end_date) {
1736 return tooltip_behavior::variable_tooltip;
1740 auto n = retrieve<dcon::nation_id>(
state, parent);
1745 bool added_increase_header =
false;
1747 for(
auto it :
state.world.nation_get_gp_relationship_as_great_power(n)) {
1749 if(it.get_influence() >=
state.defines.increaseopinion_influence_cost
1753 if(!added_increase_header)
1755 added_increase_header =
true;
1757 }
else if(!(it.get_influence_target().get_in_sphere_of()) &&
1758 it.get_influence() >=
state.defines.addtosphere_influence_cost) {
1759 if(!added_increase_header)
1761 added_increase_header =
true;
1763 }
else if(it.get_influence_target().get_in_sphere_of()
1765 it.get_influence() >=
state.defines.removefromsphere_influence_cost) {
1766 if(!added_increase_header)
1768 added_increase_header =
true;
1773 bool added_reb_header =
false;
1774 for(
auto m :
state.world.in_nation) {
1775 if(
state.world.nation_get_in_sphere_of(m) == n) {
1777 for(
auto fac :
state.world.nation_get_rebellion_within(m)) {
1779 if(!added_reb_header)
1781 added_reb_header =
true;
1790 if(!added_increase_header && !added_reb_header)
1799 return tooltip_behavior::variable_tooltip;
1805 expanded_hitbox_text::on_create(
state);
1814 auto nation_id = retrieve<dcon::nation_id>(
state, parent);
1820 for(
auto pt :
state.world.in_pop_type) {
1821 auto rp =
state.world.pop_type_get_research_points(pt);
1844 if(!
bool(tech_id)) {
1857 dcon::commodity_id commodity_id{};
1861 return tooltip_behavior::variable_tooltip;
1877 dcon::nation_id current_nation{};
1878 std::vector<topbar_commodity_xport_icon*> import_icons;
1879 std::vector<topbar_commodity_xport_icon*> export_icons;
1880 std::vector<topbar_commodity_xport_icon*> produced_icons;
1885 window_element_base::on_create(
state);
1886 base_data.position.y += 1;
1888 auto bg_pic = make_element_by_type<background_image>(
state,
"bg_main_menus");
1889 background_pic = bg_pic.get();
1890 background_pic->base_data.position.y -= 1;
1891 add_child_to_back(std::move(bg_pic));
1893 auto dpi_win = make_element_by_type<ui::diplomatic_message_topbar_listbox>(
state,
"alice_diplomessageicons_window");
1895 add_child_to_front(std::move(dpi_win));
1902 if(
name ==
"topbar_bg") {
1903 return partially_transparent_image::make_element_by_type_alias(
state,
id);
1904 }
else if(
name ==
"topbar_paper") {
1905 return partially_transparent_image::make_element_by_type_alias(
state,
id);
1906 }
else if(
name ==
"topbarbutton_production") {
1907 auto btn = make_element_by_type<topbar_production_tab_button>(
state,
id);
1909 auto tab = make_element_by_type<production_window>(
state,
"country_production");
1911 state.ui_state.
root->add_child_to_back(std::move(tab));
1913 }
else if(
name ==
"topbarbutton_budget") {
1914 auto btn = make_element_by_type<topbar_budget_tab_button>(
state,
id);
1916 auto tab = make_element_by_type<budget_window>(
state,
"country_budget");
1917 btn->topbar_subwindow = tab.get();
1918 state.ui_state.
root->add_child_to_back(std::move(tab));
1920 }
else if(
name ==
"topbarbutton_tech") {
1921 auto btn = make_element_by_type<topbar_technology_tab_button>(
state,
id);
1923 auto tab = make_element_by_type<technology_window>(
state,
"country_technology");
1924 btn->topbar_subwindow = tab.get();
1927 state.ui_state.
root->add_child_to_back(std::move(tab));
1929 }
else if(
name ==
"topbarbutton_politics") {
1930 auto btn = make_element_by_type<topbar_politics_tab_button>(
state,
id);
1931 auto tab = make_element_by_type<politics_window>(
state,
"country_politics");
1932 btn->topbar_subwindow = tab.get();
1935 state.ui_state.
root->add_child_to_back(std::move(tab));
1937 }
else if(
name ==
"topbarbutton_pops") {
1938 auto btn = make_element_by_type<topbar_population_view_button>(
state,
id);
1939 auto tab = make_element_by_type<population_window>(
state,
"country_pop");
1940 btn->topbar_subwindow = tab.get();
1943 state.ui_state.
root->add_child_to_back(std::move(tab));
1945 }
else if(
name ==
"topbarbutton_trade") {
1946 auto btn = make_element_by_type<topbar_trade_tab_button>(
state,
id);
1948 auto tab = make_element_by_type<trade_window>(
state,
"alice_country_trade");
1949 btn->topbar_subwindow = tab.get();
1952 state.ui_state.
root->add_child_to_back(std::move(tab));
1954 }
else if(
name ==
"topbarbutton_diplomacy") {
1955 auto btn = make_element_by_type<topbar_diplomacy_tab_button>(
state,
id);
1957 auto tab = make_element_by_type<diplomacy_window>(
state,
"country_diplomacy");
1958 btn->topbar_subwindow = tab.get();
1959 state.ui_state.
root->add_child_to_back(std::move(tab));
1961 }
else if(
name ==
"topbarbutton_military") {
1962 auto btn = make_element_by_type<topbar_military_tab_button>(
state,
id);
1964 auto tab = make_element_by_type<military_window>(
state,
"country_military");
1965 btn->topbar_subwindow = tab.get();
1966 state.ui_state.
root->add_child_to_back(std::move(tab));
1968 }
else if(
name ==
"button_speedup") {
1969 return make_element_by_type<topbar_speedup_button>(
state,
id);
1970 }
else if(
name ==
"button_speeddown") {
1971 return make_element_by_type<topbar_speeddown_button>(
state,
id);
1972 }
else if(
name ==
"pause_bg") {
1973 return make_element_by_type<topbar_pause_button>(
state,
id);
1974 }
else if(
name ==
"speed_indicator") {
1975 return make_element_by_type<topbar_speed_indicator>(
state,
id);
1976 }
else if(
name ==
"datetext") {
1977 return make_element_by_type<topbar_date_text>(
state,
id);
1978 }
else if(
name ==
"countryname") {
1979 return make_element_by_type<topbar_nation_name>(
state,
id);
1980 }
else if(
name ==
"player_flag") {
1981 return make_element_by_type<flag_button>(
state,
id);
1982 }
else if(
name ==
"country_prestige") {
1983 return make_element_by_type<topbar_nation_prestige_text>(
state,
id);
1984 }
else if(
name ==
"country_economic") {
1985 return make_element_by_type<topbar_nation_industry_score_text>(
state,
id);
1986 }
else if(
name ==
"country_military") {
1987 return make_element_by_type<topbar_nation_military_score_text>(
state,
id);
1988 }
else if(
name ==
"country_total") {
1989 return make_element_by_type<nation_total_score_text>(
state,
id);
1990 }
else if(
name ==
"country_colonial_power") {
1991 return make_element_by_type<topbar_nation_colonial_power_text>(
state,
id);
1992 }
else if(
name ==
"selected_prestige_rank") {
1993 return make_element_by_type<nation_prestige_rank_text>(
state,
id);
1994 }
else if(
name ==
"selected_industry_rank") {
1995 return make_element_by_type<nation_industry_rank_text>(
state,
id);
1996 }
else if(
name ==
"selected_military_rank") {
1997 return make_element_by_type<nation_military_rank_text>(
state,
id);
1998 }
else if(
name ==
"nation_totalrank") {
1999 return make_element_by_type<nation_rank_text>(
state,
id);
2000 }
else if(
name ==
"topbar_flag_overlay") {
2001 return make_element_by_type<nation_flag_frame>(
state,
id);
2002 }
else if(
name ==
"alert_building_factories") {
2003 return make_element_by_type<topbar_building_factories_icon>(
state,
id);
2004 }
else if(
name ==
"alert_closed_factories") {
2005 return make_element_by_type<topbar_closed_factories_icon>(
state,
id);
2006 }
else if(
name ==
"alert_unemployed_workers") {
2007 return make_element_by_type<topbar_unemployment_icon>(
state,
id);
2008 }
else if(
name ==
"budget_linechart") {
2009 return make_element_by_type<topbar_budget_line_graph>(
state,
id);
2010 }
else if(
name ==
"budget_funds") {
2011 return make_element_by_type<topbar_treasury_text>(
state,
id);
2012 }
else if(
name ==
"topbar_tech_progress") {
2013 return make_element_by_type<nation_technology_research_progress>(
state,
id);
2014 }
else if(
name ==
"tech_current_research") {
2015 return make_element_by_type<nation_current_research_text>(
state,
id);
2016 }
else if(
name ==
"topbar_researchpoints_value") {
2017 return make_element_by_type<topbar_nation_daily_research_points_text>(
state,
id);
2018 }
else if(
name ==
"tech_literacy_value") {
2019 return make_element_by_type<topbar_nation_literacy_text>(
state,
id);
2020 }
else if(
name ==
"politics_party_icon") {
2021 return make_element_by_type<nation_ruling_party_ideology_plupp>(
state,
id);
2022 }
else if(
name ==
"politics_ruling_party") {
2023 return make_element_by_type<nation_ruling_party_text>(
state,
id);
2024 }
else if(
name ==
"politics_supressionpoints_value") {
2025 return make_element_by_type<nation_suppression_points_text>(
state,
id);
2026 }
else if(
name ==
"politics_infamy_value") {
2027 return make_element_by_type<topbar_nation_infamy_text>(
state,
id);
2028 }
else if(
name ==
"alert_can_do_reforms") {
2029 return make_element_by_type<topbar_available_reforms_icon>(
state,
id);
2030 }
else if(
name ==
"alert_can_do_decisions") {
2031 return make_element_by_type<topbar_available_decisions_icon>(
state,
id);
2032 }
else if(
name ==
"alert_is_in_election") {
2033 return make_element_by_type<topbar_ongoing_election_icon>(
state,
id);
2034 }
else if(
name ==
"alert_have_rebels") {
2035 return make_element_by_type<topbar_rebels_icon>(
state,
id);
2036 }
else if(
name ==
"population_total_value") {
2037 return make_element_by_type<topbar_nation_population_text>(
state,
id);
2038 }
else if(
name ==
"topbar_focus_value") {
2039 return make_element_by_type<topbar_nation_focus_allocation_text>(
state,
id);
2040 }
else if(
name ==
"population_avg_mil_value") {
2041 return make_element_by_type<topbar_nation_militancy_text>(
state,
id);
2042 }
else if(
name ==
"population_avg_con_value") {
2043 return make_element_by_type<topbar_nation_consciousness_text>(
state,
id);
2044 }
else if(
name ==
"diplomacy_status") {
2045 auto ptr = make_element_by_type<topbar_at_peace_text>(
state,
id);
2046 atpeacetext = ptr.
get();
2048 }
else if(
name ==
"diplomacy_at_war") {
2049 auto ptr = make_element_by_type<overlapping_enemy_flags>(
state,
id);
2050 ptr->base_data.position.y -= ptr->base_data.position.y / 4;
2051 ptr->base_data.size.x /= 2;
2053 }
else if(
name ==
"diplomacy_diplopoints_value") {
2054 return make_element_by_type<topbar_nation_diplomatic_points_text>(
state,
id);
2055 }
else if(
name ==
"alert_colony") {
2056 return make_element_by_type<topbar_colony_icon>(
state,
id);
2057 }
else if(
name ==
"alert_crisis") {
2058 return make_element_by_type<topbar_crisis_icon>(
state,
id);
2059 }
else if(
name ==
"alert_can_increase_opinion") {
2060 return make_element_by_type<topbar_sphere_icon>(
state,
id);
2061 }
else if(
name ==
"alert_loosing_gp") {
2062 return make_element_by_type<topbar_losing_gp_status_icon>(
state,
id);
2063 }
else if(
name ==
"military_army_value") {
2064 return make_element_by_type<topbar_nation_brigade_allocation_text>(
state,
id);
2065 }
else if(
name ==
"military_navy_value") {
2066 return make_element_by_type<topbar_nation_navy_allocation_text>(
state,
id);
2067 }
else if(
name ==
"military_manpower_value") {
2068 return make_element_by_type<topbar_nation_mobilization_size_text>(
state,
id);
2069 }
else if(
name ==
"military_leadership_value") {
2070 return make_element_by_type<topbar_nation_leadership_points_text>(
state,
id);
2071 }
else if(
name ==
"topbar_outlinerbutton" ||
name ==
"topbar_outlinerbutton_bg") {
2073 return make_element_by_type<invisible_element>(
state,
id);
2074 }
else if(
name.substr(0, 13) ==
"topbar_import") {
2075 auto ptr = make_element_by_type<topbar_commodity_xport_icon>(
state,
id);
2076 std::string var = std::string{
name.substr(13)};
2077 var.empty() ? ptr->slot =
uint8_t(0) : ptr->slot =
uint8_t(std::stoi(var));
2078 import_icons.push_back(ptr.get());
2080 }
else if(
name.substr(0, 13) ==
"topbar_export") {
2081 auto ptr = make_element_by_type<topbar_commodity_xport_icon>(
state,
id);
2082 std::string var = std::string{
name.substr(13)};
2083 var.empty() ? ptr->slot =
uint8_t(0) : ptr->slot =
uint8_t(std::stoi(var));
2084 export_icons.push_back(ptr.get());
2086 }
else if(
name.substr(0, 15) ==
"topbar_produced") {
2087 auto ptr = make_element_by_type<topbar_commodity_xport_icon>(
state,
id);
2088 std::string var = std::string{
name.substr(15)};
2089 var.empty() ? ptr->slot =
uint8_t(0) : ptr->slot =
uint8_t(std::stoi(var));
2090 produced_icons.push_back(ptr.get());
2092 }
else if (
name ==
"selected_military_icon") {
2093 return make_element_by_type<military_score_icon>(
state,
id);
2101 if(
state.local_player_nation != current_nation) {
2102 current_nation =
state.local_player_nation;
2104 impl_set(
state, payload);
2107 for(
auto& e : export_icons)
2108 e->set_visible(
state,
false);
2109 for(
auto& e : import_icons)
2110 e->set_visible(
state,
false);
2111 for(
auto& e : produced_icons)
2112 e->set_visible(
state,
false);
2115 std::map<float, int32_t> v;
2116 for(dcon::commodity_id cid :
state.world.in_commodity) {
2123 float produced =
state.world.nation_get_domestic_market_pool(
state.local_player_nation, cid);
2124 float consumed =
state.world.nation_get_real_demand(
state.local_player_nation, cid) *
2125 state.world.nation_get_demand_satisfaction(
state.local_player_nation, cid);
2126 v.insert({produced -
consumed, cid.index()});
2130 for(
auto it = std::rbegin(v); it != std::rend(v); it++) {
2131 for(
auto const& e : export_icons)
2132 if(e->slot == slot) {
2133 dcon::commodity_id cid = dcon::commodity_id(dcon::commodity_id::value_base_t(it->second));
2134 e->frame =
state.world.commodity_get_icon(cid);
2135 e->commodity_id = cid;
2136 e->amount = it->first;
2137 e->set_visible(
state,
true);
2142 for(
auto it = v.begin(); it != v.end(); it++) {
2143 for(
auto const& e : import_icons)
2144 if(e->slot == slot) {
2145 dcon::commodity_id cid = dcon::commodity_id(dcon::commodity_id::value_base_t(it->second));
2146 e->frame =
state.world.commodity_get_icon(cid);
2147 e->commodity_id = cid;
2148 e->amount = it->first;
2149 e->set_visible(
state,
true);
2156 std::map<float, int32_t> v;
2157 for(dcon::commodity_id cid :
state.world.in_commodity) {
2164 v.insert({
state.world.nation_get_domestic_market_pool(
state.local_player_nation, cid), cid.index()});
2168 for(
auto it = std::rbegin(v); it != std::rend(v); it++) {
2169 for(
auto const& e : produced_icons)
2170 if(e->slot == slot) {
2171 dcon::commodity_id cid = dcon::commodity_id(dcon::commodity_id::value_base_t(it->second));
2172 e->frame =
state.world.commodity_get_icon(cid);
2173 e->commodity_id = cid;
2174 e->amount = it->first;
2175 e->set_visible(
state,
true);
2184 background_pic->set_visible(
state,
true);
2186 background_pic->set_visible(
state,
false);
2188 window_element_base::render(
state, x, y);
2192 if(payload.holds_type<dcon::nation_id>()) {
2193 payload.emplace<dcon::nation_id>(
state.local_player_nation);
2194 return message_result::consumed;
2196 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 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()
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