stop infs popping from zero province_get_labor_price#2228
stop infs popping from zero province_get_labor_price#2228SneakBug8 wants to merge 1 commit intoschombert:mainfrom
Conversation
| auto nmod = state.world.nation_get_modifier_values(owner, sys::national_mod_offsets::education_efficiency_modifier) + 1.0f; | ||
|
|
||
| auto cost_of_input = state.world.province_get_labor_price(pids, def.throughput_labour_type); | ||
| auto cost_of_input = state.world.province_get_labor_price(pids, def.throughput_labour_type) + 0.001f; |
There was a problem hiding this comment.
This value is extremely big relatively to vanilla wages. Would be better to figure out why it happens and which provinces have zero price of labor in your case and prevent it.
There was a problem hiding this comment.
That's true, but is there a sufficiently small value that would work as a temporary fix?
There was a problem hiding this comment.
The issue is that changing value there would have cascading effects. Game would generate less demand on labor due to higher price but then unsatisfied demand is refunded with the original price. Better alternative in this case is to take max with min labor price, I suppose. After all, if this max is actually doing some work, it means that something had went wrong and if it's idle, then it works the same way. Ideally, there could be an assert against zero price, but then Sneakbug would have to eliminate the source of zeros in his case and I suppose that this value was added to avoid spending time on it in the first place.
There was a problem hiding this comment.
As far as I get it, zero labour price appears when the province doesn't have any supply of the labour type in question.
Thus, having the price as zero seems reasonable to the case.
There was a problem hiding this comment.
In all land provinces price is set to not zero from the very start and every update is supposed to maintain this invariant in land provinces.
There was a problem hiding this comment.
Is this the only place where we assume non-zero labour prices?
There was a problem hiding this comment.
Every single usage of prices assumes that they are non-zero
No description provided.