Change removecums to a HashSet

This commit is contained in:
lutepickle 2023-03-19 22:52:39 -07:00
parent f7e3d6c1c4
commit cb8a001cdf
1 changed files with 6 additions and 15 deletions

View File

@ -1037,7 +1037,7 @@ namespace RJW_Menstruation
if (TotalCum > Props.maxCumCapacity * Pawn.BodySize) leakfactor = Math.Min(1 + (TotalCum - Props.maxCumCapacity * Pawn.BodySize) / 10, 2f); if (TotalCum > Props.maxCumCapacity * Pawn.BodySize) leakfactor = Math.Min(1 + (TotalCum - Props.maxCumCapacity * Pawn.BodySize) / 10, 2f);
if (absorber != null && absorber.dirty && !absorber.LeakAfterDirty) leakfactor = 0f; if (absorber != null && absorber.dirty && !absorber.LeakAfterDirty) leakfactor = 0f;
if (Pawn.CurJobDef == xxx.knotted) leakfactor = 0f; if (Pawn.CurJobDef == xxx.knotted) leakfactor = 0f;
List<Cum> removecums = new List<Cum>(); HashSet<Cum> removecums = new HashSet<Cum>();
foreach (Cum cum in cums) foreach (Cum cum in cums)
{ {
cum.CumEffects(Pawn); cum.CumEffects(Pawn);
@ -1050,10 +1050,7 @@ namespace RJW_Menstruation
} }
if (cums.Count > 1) MakeCumFilthMixture(totalleak, filthlabels); if (cums.Count > 1) MakeCumFilthMixture(totalleak, filthlabels);
else if (cums.Count == 1) MakeCumFilth(cums.First(), totalleak); else if (cums.Count == 1) MakeCumFilth(cums.First(), totalleak);
foreach (Cum cum in removecums) cums.RemoveAll(cum => removecums.Contains(cum));
{
cums.Remove(cum);
}
cumd = TotalCumPercent - cumd; cumd = TotalCumPercent - cumd;
if (totalleak >= 1.0f) AfterCumOut(); if (totalleak >= 1.0f) AfterCumOut();
AfterFluidOut(cumd); AfterFluidOut(cumd);
@ -1073,7 +1070,7 @@ namespace RJW_Menstruation
List<string> filthlabels = new List<string>(); List<string> filthlabels = new List<string>();
float outcum = 0; float outcum = 0;
float cumd = TotalCumPercent; float cumd = TotalCumPercent;
List<Cum> removecums = new List<Cum>(); HashSet<Cum> removecums = new HashSet<Cum>();
foreach (Cum cum in cums) foreach (Cum cum in cums)
{ {
float vd = cum.DismishForce(portion); float vd = cum.DismishForce(portion);
@ -1086,10 +1083,7 @@ namespace RJW_Menstruation
} }
if (cums.Count > 1) MakeCumFilthMixture(totalleak, filthlabels); if (cums.Count > 1) MakeCumFilthMixture(totalleak, filthlabels);
else if (cums.Count == 1) MakeCumFilth(cums.First(), totalleak); else if (cums.Count == 1) MakeCumFilth(cums.First(), totalleak);
foreach (Cum cum in removecums) cums.RemoveAll(cum => removecums.Contains(cum));
{
cums.Remove(cum);
}
cumd = TotalCumPercent - cumd; cumd = TotalCumPercent - cumd;
AfterFluidOut(cumd); AfterFluidOut(cumd);
return outcum; return outcum;
@ -1107,7 +1101,7 @@ namespace RJW_Menstruation
Color color = GetCumMixtureColor; Color color = GetCumMixtureColor;
float totalleak = 0; float totalleak = 0;
List<string> cumlabels = new List<string>(); List<string> cumlabels = new List<string>();
List<Cum> removecums = new List<Cum>(); HashSet<Cum> removecums = new HashSet<Cum>();
bool pure = true; bool pure = true;
foreach (Cum cum in cums) foreach (Cum cum in cums)
{ {
@ -1118,10 +1112,7 @@ namespace RJW_Menstruation
if (cum.ShouldRemove()) removecums.Add(cum); if (cum.ShouldRemove()) removecums.Add(cum);
if (cum.notcum) pure = false; if (cum.notcum) pure = false;
} }
foreach (Cum cum in removecums) cums.RemoveAll(cum => removecums.Contains(cum));
{
cums.Remove(cum);
}
return new CumMixture(Pawn, totalleak, cumlabels, color, mixtureDef, pure); return new CumMixture(Pawn, totalleak, cumlabels, color, mixtureDef, pure);
} }