6 auto rgo_good =
state.world.province_get_rgo(prov_id);
7 auto nat_id =
state.world.province_get_nation_from_province_ownership(prov_id);
9 state.world.for_each_commodity([&](dcon::commodity_id c) {
11 auto profit =
state.world.province_get_rgo_profit_per_good(prov_id, c);
13 if(production < 0.0001f) {
18 auto name_box = base_box;
20 auto production_box = base_box;
21 production_box.x_position += 90.f;
23 auto profit_box = base_box;
24 profit_box.x_position += 180.f;
59 bool const is_mine =
state.world.commodity_get_is_mine(rgo_good);
60 auto const efficiency = 1.0f +
61 state.world.province_get_modifier_values(prov_id,
62 is_mine ? sys::provincial_mod_offsets::mine_rgo_eff : sys::provincial_mod_offsets::farm_rgo_eff) +
63 state.world.nation_get_modifier_values(nat_id,
64 is_mine ? sys::national_mod_offsets::mine_rgo_eff : sys::national_mod_offsets::farm_rgo_eff);
74 auto const throughput =
state.world.province_get_rgo_employment(prov_id);
85 province_window->nf_win->
set_visible(
state, !province_window->nf_win->is_visible());
89 auto current_volume =
state.world.trade_route_get_volume(route, c);
90 auto A =
state.world.trade_route_get_connected_markets(route, 0);
91 auto B =
state.world.trade_route_get_connected_markets(route, 1);
93 auto absolute_volume = std::abs(current_volume);
96 auto s_A =
state.world.market_get_zone_from_local_market(A);
97 auto s_B =
state.world.market_get_zone_from_local_market(
B);
103 auto n_A =
state.world.state_instance_get_nation_from_state_ownership(s_A);
104 auto n_B =
state.world.state_instance_get_nation_from_state_ownership(s_B);
108 auto capital_A =
state.world.state_instance_get_capital(s_A);
109 auto capital_B =
state.world.state_instance_get_capital(s_B);
114 auto controller_capital_A =
state.world.province_get_nation_from_province_control(capital_A);
115 auto controller_capital_B =
state.world.province_get_nation_from_province_control(capital_B);
117 auto controller_port_A =
state.world.province_get_nation_from_province_control(port_A);
118 auto controller_port_B =
state.world.province_get_nation_from_province_control(port_B);
120 auto sphere_A =
state.world.nation_get_in_sphere_of(controller_capital_A);
121 auto sphere_B =
state.world.nation_get_in_sphere_of(controller_capital_B);
123 auto overlord_A =
state.world.overlord_get_ruler(
124 state.world.nation_get_overlord_as_subject(controller_capital_A)
126 auto overlord_B =
state.world.overlord_get_ruler(
127 state.world.nation_get_overlord_as_subject(controller_capital_B)
130 auto A_is_open_to_B = sphere_A == controller_capital_B || overlord_A == controller_capital_B;
131 auto B_is_open_to_A = sphere_B == controller_capital_A || overlord_B == controller_capital_A;
138 auto is_sea_route =
state.world.trade_route_get_is_sea_route(route);
139 auto is_land_route =
state.world.trade_route_get_is_land_route(route);
142 if(
state.world.province_get_is_blockaded(port_A)) {
143 is_sea_route =
false;
145 if(
state.world.province_get_is_blockaded(port_B)) {
146 is_sea_route =
false;
150 if(!(is_sea_route || is_land_route)) {
156 if(controller_capital_A == controller_capital_B) {
157 import_tariff_A = 0.f;
158 export_tariff_A = 0.f;
159 import_tariff_B = 0.f;
160 export_tariff_B = 0.f;
164 import_tariff_A = 0.f;
165 export_tariff_A = 0.f;
168 import_tariff_B = 0.f;
169 export_tariff_B = 0.f;
172 auto distance = 999999.f;
175 distance = std::min(distance,
state.world.trade_route_get_land_distance(route));
178 distance = std::min(distance,
state.world.trade_route_get_sea_distance(route));
181 auto trade_good_loss_mult = std::max(0.f, 1.f - 0.0001f * distance);
183 auto transport_cost = distance * 0.0075f;
186 auto effect_of_scale = std::max(0.1f, 1.f - absolute_volume * 0.0005f);
192 auto price_A_import =
economy::price(
state, A, c) * (1.f - import_tariff_A) * trade_good_loss_mult;
193 auto price_B_import =
economy::price(
state,
B, c) * (1.f - import_tariff_B) * trade_good_loss_mult;
195 auto current_profit_A_to_B = price_B_import - price_A_export * merchant_cut - transport_cost * effect_of_scale;
196 auto current_profit_B_to_A = price_A_import - price_B_export * merchant_cut - transport_cost * effect_of_scale;
198 return std::max(0.f, std::max(current_profit_A_to_B / price_A_export, current_profit_B_to_A / price_B_export));
void set_visible(sys::state &state, bool vis)
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
constexpr float merchant_cut_foreign
constexpr float merchant_cut_domestic
float price(sys::state const &state, dcon::state_instance_id s, dcon::commodity_id c)
float rgo_effective_size(sys::state const &state, dcon::nation_id n, dcon::province_id p, dcon::commodity_id c)
float effective_tariff_import_rate(sys::state &state, dcon::nation_id n)
float effective_tariff_export_rate(sys::state &state, dcon::nation_id n)
bool are_at_war(sys::state const &state, dcon::nation_id a, dcon::nation_id b)
dcon::province_id state_get_coastal_capital(sys::state &state, dcon::state_instance_id s)
float rgo_production_quantity(sys::state &state, dcon::province_id id, dcon::commodity_id c)
void add_to_layout_box(sys::state &state, layout_base &dest, layout_box &box, embedded_flag ico)
std::string format_money(float num)
std::string get_name_as_string(sys::state &state, T t)
layout_box open_layout_box(layout_base &dest, int32_t indent)
void localised_format_box(sys::state &state, layout_base &dest, layout_box &box, std::string_view key, text::substitution_map const &sub)
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
void close_layout_box(columnar_layout &dest, layout_box &box)
float trade_route_profit(sys::state &state, dcon::trade_route_id route, dcon::commodity_id c)
void province_owner_rgo_draw_tooltip(sys::state &state, text::columnar_layout &contents, dcon::province_id prov_id) noexcept
Holds important data about the game world, state, and other data regarding windowing,...
element_base * province_window