Skip to content

Commit

Permalink
set prices on conquest of new states
Browse files Browse the repository at this point in the history
  • Loading branch information
ineveraskedforthis committed Jan 30, 2025
1 parent d872ac2 commit 0a364b9
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/provinces/province.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,27 @@ void change_province_owner(sys::state& state, dcon::province_id id, dcon::nation
auto new_market = state.world.create_market();

// set prices to something to avoid infinite demand:

state.world.for_each_commodity([&](auto cid){
state.world.market_set_price(new_market, cid, state.world.market_get_price(old_market, cid));
});
if(old_market) {
state.world.for_each_commodity([&](auto cid){
state.world.market_set_price(new_market, cid, state.world.market_get_price(old_market, cid));
});
for(auto index = 0; index < economy::labor::total; index++) {
state.world.market_set_labor_price(new_market, index, state.world.market_get_labor_price(old_market, index));
}
for(auto index = 0; index < economy::pop_labor::total; index++) {
state.world.market_set_pop_labor_distribution(new_market, index, state.world.market_get_pop_labor_distribution(old_market, index));
}
} else {
state.world.for_each_commodity([&](auto cid) {
state.world.market_set_price(new_market, cid, economy::median_price(state, cid));
});
for(auto index = 0; index < economy::labor::total; index++) {
state.world.market_set_labor_price(new_market, index, 1.f);
}
for(auto index = 0; index < economy::pop_labor::total; index++) {
state.world.market_set_pop_labor_distribution(new_market, index, 0.f);
}
}

auto new_local_market = state.world.force_create_local_market(new_market, new_si);

Expand Down

0 comments on commit 0a364b9

Please sign in to comment.