Bug fix. Better poisoning cause tracking. Optimizations. Etc.#1
Open
Doomster14 wants to merge 2 commits intobinchware:mainfrom
Open
Bug fix. Better poisoning cause tracking. Optimizations. Etc.#1Doomster14 wants to merge 2 commits intobinchware:mainfrom
Doomster14 wants to merge 2 commits intobinchware:mainfrom
Conversation
…checks... - Fix: When a stack containing poisoned items was moved/merged, the number of poisoned items could change somewhat. And if it was increased, the food could be tagged as having unknown poisoning cause. - Overall, more accurate tracking of poisoning cause. - Added debug output to the in-game debug log window when built in Debug configuration. - Refactoring: A class for hypergeometric distribution generation is created, with tests performed in Debug configuration. - Performance improvements. - Added more sanity checks, the mod does nothing with stacks having invalid parameters. - Debug symbols are disabled in Release configuration build, so build machine paths are not exposed. - Multiple minor improvements.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Greetings.
Please, accept my pull request. I optimized your Poisoned Food Stack Fix mod, and while testing it, I also found a RimWorld oddity that led to a bug you tried to fix. Fixed now. Described in commit message and commented in the code.
The committed assembly is built in Visual Studio 16. You may wish to rebuild.
Also, your last edit to About.xml was not copied to Steam Workshop:
(C) the mod significantly reduces the risk of food poisoning for large-volume foods such as pemmican, and (D)
Here is a debug log showing the fixed bug in action. To reproduce it, the 1st return operator in SplitFoodPoisonablePostfix method should be commented out, reintroducing the bug. A stack of 3 items is ordered to be merged with a stack of 8 items. One extra poisoned item appears in a carried stack, and the cause is set to Unknown.
==================== Splitting ====================
Preliminary: MealSimple98779 of 1 pcs at 33.33334% (IncompetentCook) and MealSimple110204 of 2 pcs at 33.33334% (IncompetentCook)
Poisoned: 1/3 in total
Split: 0/1 pcs at 0% (Unknown) and 1/2 pcs at 50% (IncompetentCook)
==================== Splitting ====================
Odd: MealSimple110204 of 2 pcs at 50% (IncompetentCook) is split to self
Preliminary: MealSimple110204 of 2 pcs at 50% (IncompetentCook) and MealSimple110204 of 2 pcs at 50% (IncompetentCook)
Poisoned: 2/4 in total
Split: 2/2 pcs at 100% (Unknown) and 0/2 pcs at 100% (Unknown)
==================== Absorbing prefix ====================
Stack MealSimple69933 of 8 pcs at 25% (IncompetentCook)
==================== Absorbing postfix ====================
Preliminary: MealSimple69933 of 8(10) pcs at 40% (Unknown) after absorbing 2 pcs from MealSimple110204 of 2 pcs at 100% (Unknown)