Skip to content

Commit

Permalink
Merge pull request #1862 from ineveraskedforthis/main
Browse files Browse the repository at this point in the history
Porting a few hotfixes.
  • Loading branch information
schombert authored Jan 16, 2025
2 parents b0e2650 + 2b30c9f commit 74ddb81
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions src/economy/economy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ void initialize_needs_weights(sys::state& state, dcon::market_id n) {
}

float need_weight(sys::state& state, dcon::market_id n, dcon::commodity_id c) {
return std::min(1.f, 1000.0f / std::max(price(state, n, c), 0.0001f));
return std::min(1.f, 100000.0f / std::max(price(state, n, c), 0.0001f));
}

void rebalance_needs_weights(sys::state& state, dcon::market_id n) {
Expand Down Expand Up @@ -1262,7 +1262,7 @@ ve::fp_vector base_artisan_profit(
}
}

auto output_total = state.world.commodity_get_artisan_output_amount(c) * ve_price(state, markets, c);
auto output_total = state.world.commodity_get_artisan_output_amount(c) * ve_price(state, markets, c) * state.world.market_get_supply_sold_ratio(markets, c);;

auto input_multiplier = artisan_input_multiplier(state, nations);
auto output_multiplier = artisan_output_multiplier(state, nations);
Expand All @@ -1288,7 +1288,7 @@ float base_artisan_profit(
}
}

auto output_total = state.world.commodity_get_artisan_output_amount(c) * price(state, market, c);
auto output_total = state.world.commodity_get_artisan_output_amount(c) * price(state, market, c) * state.world.market_get_supply_sold_ratio(market, c);;

auto input_multiplier = artisan_input_multiplier<dcon::nation_id>(state, nid);
auto output_multiplier = artisan_output_multiplier<dcon::nation_id>(state, nid);
Expand Down Expand Up @@ -3014,7 +3014,7 @@ void update_artisan_consumption(
);

auto base_profit =
output_total * output_multiplier
output_total * output_multiplier * state.world.market_get_supply_sold_ratio(markets, cid)
- input_multiplier * input_total;

total_profit = total_profit
Expand All @@ -3023,7 +3023,7 @@ void update_artisan_consumption(
* throughput_multiplier
* max_production_scale
* min_available
) * state.world.market_get_supply_sold_ratio(markets, cid);
);
}

state.world.market_set_artisan_profit(markets, total_profit);
Expand Down Expand Up @@ -5645,9 +5645,9 @@ void daily_update(sys::state& state, bool presimulation, float presimulation_sta
auto none_is_profiable = (current_profit_A_to_B <= 0.f) && (current_profit_B_to_A <= 0.f);

auto max_change = 0.1f + absolute_volume * 0.1f;
auto change = ve::select(current_profit_A_to_B > 0.f, current_profit_A_to_B / price_A_export, 0.f);
change = ve::select(current_profit_B_to_A > 0.f, -current_profit_B_to_A / price_B_export, change);
change = ve::min(ve::max(change, -max_change), max_change);
auto change = ve::select(current_profit_A_to_B > 0.f, current_profit_A_to_B / price_B_import, 0.f);
change = ve::select(current_profit_B_to_A > 0.f, -current_profit_B_to_A / price_A_import, change);
change = ve::min(ve::max(100.f * change, -max_change), max_change);
change = ve::select(none_is_profiable, -current_volume, change);
change = ve::select(
at_war
Expand Down Expand Up @@ -7295,7 +7295,7 @@ void daily_update(sys::state& state, bool presimulation, float presimulation_sta
auto oversupply_factor = ve::max(supply / demand - 1.f, 0.f);
auto overdemand_factor = ve::max(demand / supply - 1.f, 0.f);
auto speed_modifer = (overdemand_factor - oversupply_factor);
auto price_speed = price_speed_mod * speed_modifer;
auto price_speed = ve::min(ve::max(price_speed_mod * speed_modifer, -0.025f), 0.025f);
price_speed = price_speed * current_price;
current_price = current_price + price_speed;

Expand Down
2 changes: 1 addition & 1 deletion src/economy/economy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ auto desired_needs_spending(sys::state const& state, T pop_indices) {
constexpr inline dcon::commodity_id money(0);

// move to defines later
inline constexpr float payouts_spending_multiplier = 200.f;
inline constexpr float payouts_spending_multiplier = 10.f;

// factories:
inline constexpr float secondary_employment_output_bonus = 3.f;
Expand Down
10 changes: 5 additions & 5 deletions src/parsing/defines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,16 +657,16 @@
LUA_DEFINES_LIST_ELEMENT(alice_full_reinforce, 1.000000) \
LUA_DEFINES_LIST_ELEMENT(alice_ai_offensive_strength_overestimate, 1.000000) \
LUA_DEFINES_LIST_ELEMENT(alice_military_score_leadership_factor, 1.000000) \
LUA_DEFINES_LIST_ELEMENT(alice_lf_needs_scale, 0.750000) \
LUA_DEFINES_LIST_ELEMENT(alice_ev_needs_scale, 1.750000) \
LUA_DEFINES_LIST_ELEMENT(alice_lx_needs_scale, 2.500000) \
LUA_DEFINES_LIST_ELEMENT(alice_lf_needs_scale, 0.050000) \
LUA_DEFINES_LIST_ELEMENT(alice_ev_needs_scale, 0.500000) \
LUA_DEFINES_LIST_ELEMENT(alice_lx_needs_scale, 1.500000) \
LUA_DEFINES_LIST_ELEMENT(alice_max_event_iterations, 8.000000) \
LUA_DEFINES_LIST_ELEMENT(alice_needs_scaling_factor, 400000.000000) \
LUA_DEFINES_LIST_ELEMENT(alice_factory_per_level_employment, 10000.0) \
LUA_DEFINES_LIST_ELEMENT(alice_domestic_investment_multiplier, 50.0) \
LUA_DEFINES_LIST_ELEMENT(alice_rgo_boost, 8.0) \
LUA_DEFINES_LIST_ELEMENT(alice_rgo_boost, 10.0) \
LUA_DEFINES_LIST_ELEMENT(alice_base_rgo_employment_bonus, 300000.0) \
LUA_DEFINES_LIST_ELEMENT(alice_base_rgo_efficiency_bonus, 1.95) \
LUA_DEFINES_LIST_ELEMENT(alice_base_rgo_efficiency_bonus, 3.00) \
LUA_DEFINES_LIST_ELEMENT(alice_inputs_base_factor_artisans, 1.04) \
LUA_DEFINES_LIST_ELEMENT(alice_output_base_factor_artisans, 0.96) \
LUA_DEFINES_LIST_ELEMENT(alice_inputs_base_factor, 1.0) \
Expand Down

0 comments on commit 74ddb81

Please sign in to comment.