Skip to content

stop infs popping from zero province_get_labor_price#2228

Open
SneakBug8 wants to merge 1 commit intoschombert:mainfrom
SneakBug8:bugfixes3
Open

stop infs popping from zero province_get_labor_price#2228
SneakBug8 wants to merge 1 commit intoschombert:mainfrom
SneakBug8:bugfixes3

Conversation

@SneakBug8
Copy link
Contributor

No description provided.

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true, but is there a sufficiently small value that would work as a temporary fix?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

@SneakBug8 SneakBug8 Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the only place where we assume non-zero labour prices?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every single usage of prices assumes that they are non-zero

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants