Skip to content

Commit

Permalink
Fix devide by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
LokiVKlokeNaAndoke committed Oct 29, 2022
1 parent 91c2a5a commit eaba70a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
Binary file modified 1.4/Assemblies/AutoPriorities.dll
Binary file not shown.
Binary file modified ConditionalAssemblies/1.4/FluffyWorktabPatch.dll
Binary file not shown.
5 changes: 4 additions & 1 deletion Source/AutoPriorities/AutoPriorities/PawnsData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,13 @@ public double PercentValue(TablePercent tablePercent,
IWorkTypeWrapper workTypeWrapper,
Priority currentPriority)
{
var numberColonists = NumberColonists(workTypeWrapper);
return tablePercent.Variant switch
{
PercentVariant.Percent => tablePercent.PercentValue,
PercentVariant.Number => (double)tablePercent.NumberCount / NumberColonists(workTypeWrapper),
PercentVariant.Number => numberColonists > 0
? (double)tablePercent.NumberCount / numberColonists
: 0,
PercentVariant.PercentRemaining => PercentColonistsAvailable(workTypeWrapper, currentPriority).percent,
_ => throw new ArgumentOutOfRangeException()
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ private void DrawWorkListForPriority(WorkTableEntry pr, Rect slidersRect)
if (Math.Abs(currSliderVal - prevSliderVal) > 0.001)
{
_logger.Info(
$"slider: available {available}; newSliderValue {prevSliderVal}; currSliderVal {currSliderVal}");
$"slider: available {available}; prevSliderVal {prevSliderVal}; currSliderVal {currSliderVal}");
isCallInteresting = true;
}
#endif
Expand Down

0 comments on commit eaba70a

Please sign in to comment.