Skip to content

Commit

Permalink
add min-value-safe abs function
Browse files Browse the repository at this point in the history
  • Loading branch information
FluffierThanThou committed Mar 7, 2020
1 parent 2112a87 commit 2074e64
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ rw-chaos: German translation (update)
Marcos Villar: Portuguese (Brazilian) translation (update)
CrapoFR: French translation update
maarxx: Fix for settings persistance bug, add unassign training option, add restrict wool/milkable option
rimpy-custom: Fix for Russian translation

<size=24>Version</size>
This is version 4.25.600, for RimWorld 1.1.2566.
Expand Down
Binary file modified Assemblies/Fluffy_ColonyManager.dll
Binary file not shown.
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ In theory there is no real limit to the number of manager jobs that can be creat
- Marcos Villar: Portuguese (Brazilian) translation (update)
- CrapoFR: French translation update
- maarxx: Fix for settings persistance bug, add unassign training option, add restrict wool/milkable option
- rimpy-custom: Fix for Russian translation

# Think you found a bug?
Please read [this guide](http://steamcommunity.com/sharedfiles/filedetails/?id=725234314) before creating a bug report,
Expand Down
9 changes: 8 additions & 1 deletion Source/ManagerTabs/ManagerTab_Power.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,18 @@ public override void Tick()
// update the history tracker.
var trade = GetCurrentTrade();
tradingHistory.Update( trade );
overallHistory.Update( trade.Where( i => i > 0 ).Sum(), trade.Where( i => i < 0 ).Sum( Math.Abs ),
overallHistory.Update( trade.Where( i => i > 0 ).Sum(), trade.Where( i => i < 0 ).Sum( SafeAbs ),
GetCurrentBatteries().Sum() );
}
}

private static int SafeAbs( int value )
{
if ( value >= 0 ) return value;
if ( value == int.MinValue ) return int.MaxValue;
return -value;
}

private void DrawConsumption( Rect canvas )
{
// setup rects
Expand Down

0 comments on commit 2074e64

Please sign in to comment.