Skip to content

Commit

Permalink
v4.4.4 fixes job errors introduced by 4.4.3 - sorry
Browse files Browse the repository at this point in the history
  • Loading branch information
pardeike committed Nov 18, 2023
1 parent f88b90d commit 06ce217
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<li>Multiplayer</li>
</incompatibleWith>
<packageId>brrainz.zombieland</packageId>
<modVersion>4.4.3.0</modVersion>
<modVersion>4.4.4.0</modVersion>
<steamAppId>928376710</steamAppId>
<description>Do you like The Walking Dead? Are you afraid of The Undead? Good. Because this mod will give you the Heebie-jeebies!

Expand Down
2 changes: 1 addition & 1 deletion About/Manifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>net.pardeike.rimworld.mod.zombieland</identifier>
<version>4.4.3.0</version>
<version>4.4.4.0</version>
<targetVersions>
<li>1.4.0</li>
</targetVersions>
Expand Down
Binary file modified Assemblies/ZombieLand.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ModName>ZombieLand</ModName>
<ModFileName>ZombieLand</ModFileName>
<Repository>https://github.com/pardeike/Zombieland</Repository>
<ModVersion>4.4.3.0</ModVersion>
<ModVersion>4.4.4.0</ModVersion>
<ProjectGuid>{34AA2AF2-8E82-4C5B-8ABA-9AC53DA7C110}</ProjectGuid>
</PropertyGroup>

Expand Down
13 changes: 10 additions & 3 deletions Source/ContaminationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,20 @@ public void Remove(Thing thing)
public float Equalize(LocalTargetInfo t1, LocalTargetInfo t2, float weight = 0.5f, bool includeHoldings1 = true, bool includeHoldings2 = true)
{
var map = (t1.Thing ?? t2.Thing).Map;

var _grid = (ContaminationGrid)null;
ContaminationGrid cachedGrid()
{
_grid ??= grounds[map.Index];
return _grid;
}

var isT1 = t1.thingInt != null;
var isT2 = t2.thingInt != null;
if (isT1 == false && isT2 == false)
throw new Exception($"cannot equalize cells only ({t1} to {t2}, weight {weight})");
var grid = grounds[map.Index];
var c1 = isT1 ? Get(t1.thingInt, includeHoldings1) : grid[t1.cellInt];
var c2 = isT2 ? Get(t2.thingInt, includeHoldings2) : grid[t2.cellInt];
var c1 = isT1 ? Get(t1.thingInt, includeHoldings1) : cachedGrid()[t1.cellInt];
var c2 = isT2 ? Get(t2.thingInt, includeHoldings2) : cachedGrid()[t2.cellInt];
if (c1 < c2)
(c1, c2, t1, t2) = (c2, c1, t2, t1);
var transfer = c1 * (1 - weight) + c2 * weight - c1;
Expand Down

0 comments on commit 06ce217

Please sign in to comment.