1.6 to main #1
@@ -243,10 +243,11 @@ public sealed class Buildings : ClassWithFishPrepatches
|
|||||||
private static void UpdateCacheOnAdd(ListerBuildings __instance, Building b, ThingDef def)
|
private static void UpdateCacheOnAdd(ListerBuildings __instance, Building b, ThingDef def)
|
||||||
{
|
{
|
||||||
var cache = __instance.Cache();
|
var cache = __instance.Cache();
|
||||||
|
|
||||||
if (b.Faction == Faction.OfPlayer)
|
if (b.Faction == Faction.OfPlayer)
|
||||||
{
|
{
|
||||||
cache.ColonistBuildingsByDef.GetOrAdd(def).Add(b);
|
if (!cache.ColonistBuildingsByDef.GetOrAdd(def).TryAdd(b))
|
||||||
|
return;
|
||||||
if (b is Building_ResearchBench researchBench)
|
if (b is Building_ResearchBench researchBench)
|
||||||
cache.ColonistResearchBenches.Add(researchBench);
|
cache.ColonistResearchBenches.Add(researchBench);
|
||||||
|
|
||||||
@@ -266,7 +267,7 @@ public sealed class Buildings : ClassWithFishPrepatches
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cache.NonColonistBuildingsByDef.GetOrAdd(def).Add(b);
|
cache.NonColonistBuildingsByDef.GetOrAdd(def).TryAdd(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user