Skip to content

Commit

Permalink
Consider corner case in production cost calculation algorithm.
Browse files Browse the repository at this point in the history
  • Loading branch information
klei1984 committed Mar 10, 2024
1 parent 2404fe6 commit 4f7a01f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/buildmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,10 @@ int32_t BuildMenu_GetMaxPossibleBuildRate(ResourceID unit_type, int32_t build_ti
cost += const_change_4x;

} else {
if (turns_2x > 0 and turns_1x == 1 and cost - rate_2x - rate_1x + rate_4x <= storage) {
++turns_4x;
}

break;
}
}
Expand Down

0 comments on commit 4f7a01f

Please sign in to comment.