Little cleanups and removal of unnecessary checks

This commit is contained in:
lutepickle 2022-08-27 22:01:39 -07:00
parent 66e2b3494b
commit 84d5ffa8b7
5 changed files with 11 additions and 37 deletions

View file

@ -148,14 +148,10 @@ namespace RJW_Menstruation
if (o.IsNull) removeList.Add(o); if (o.IsNull) removeList.Add(o);
if (o.DefName == def.defName) return true; if (o.DefName == def.defName) return true;
} }
if (!removeList.NullOrEmpty())
{
foreach (HybridInformations o in removeList) foreach (HybridInformations o in removeList)
{ {
HybridOverride.Remove(o); HybridOverride.Remove(o);
} }
}
removeList.Clear();
return false; return false;
} }

View file

@ -224,12 +224,8 @@ namespace RJW_Menstruation
{ {
if (notcum || DNA == null || volume < 1.0f) return; if (notcum || DNA == null || volume < 1.0f) return;
List<IngestionOutcomeDoer> doers = DNA.ingestionOutcomeDoers; foreach (IngestionOutcomeDoer doer in DNA.ingestionOutcomeDoers)
doer.DoIngestionOutcome(pawn, CumThing);
if (!doers.NullOrEmpty()) for (int i = 0; i < doers.Count; i++)
{
doers[i].DoIngestionOutcome(pawn, CumThing);
}
} }
protected void CutMinor() protected void CutMinor()
@ -238,7 +234,7 @@ namespace RJW_Menstruation
} }
} }
public class CumMixture : Cum, IDisposable public class CumMixture : Cum
{ {
protected List<string> cums; protected List<string> cums;
public bool ispurecum = true; public bool ispurecum = true;
@ -260,12 +256,6 @@ namespace RJW_Menstruation
ispurecum = pure; ispurecum = pure;
} }
public void Dispose()
{
cums.Clear();
}
public override void ExposeData() public override void ExposeData()
{ {
base.ExposeData(); base.ExposeData();

View file

@ -845,7 +845,6 @@ namespace RJW_Menstruation
{ {
cums.Remove(cum); cums.Remove(cum);
} }
removecums.Clear();
cumd = TotalCumPercent - cumd; cumd = TotalCumPercent - cumd;
if (totalleak >= 1.0f) AfterCumOut(); if (totalleak >= 1.0f) AfterCumOut();
AfterFluidOut(cumd); AfterFluidOut(cumd);
@ -882,7 +881,6 @@ namespace RJW_Menstruation
{ {
cums.Remove(cum); cums.Remove(cum);
} }
removecums.Clear();
cumd = TotalCumPercent - cumd; cumd = TotalCumPercent - cumd;
AfterFluidOut(cumd); AfterFluidOut(cumd);
return outcum; return outcum;
@ -915,7 +913,6 @@ namespace RJW_Menstruation
{ {
cums.Remove(cum); cums.Remove(cum);
} }
removecums.Clear();
return new CumMixture(Pawn, totalleak, cumlabels, color, mixtureDef, pure); return new CumMixture(Pawn, totalleak, cumlabels, color, mixtureDef, pure);
} }
@ -1244,16 +1241,14 @@ namespace RJW_Menstruation
if (pregnant && (!Configurations.UseMultiplePregnancy || !Configurations.EnableHeteroOvularTwins)) if (pregnant && (!Configurations.UseMultiplePregnancy || !Configurations.EnableHeteroOvularTwins))
{ {
eggs.Clear(); eggs.Clear();
deadeggs.Clear();
return true; return true;
} }
else if (!deadeggs.NullOrEmpty()) else
{ {
foreach (Egg egg in deadeggs) foreach (Egg egg in deadeggs)
{ {
eggs.Remove(egg); eggs.Remove(egg);
} }
deadeggs.Clear();
} }
return pregnant; return pregnant;
} }
@ -1335,14 +1330,10 @@ namespace RJW_Menstruation
if (egg.lifespanhrs < 0) deadeggs.Add(egg); if (egg.lifespanhrs < 0) deadeggs.Add(egg);
} }
} }
if (!deadeggs.NullOrEmpty())
{
foreach (Egg egg in deadeggs) foreach (Egg egg in deadeggs)
{ {
eggs.Remove(egg); eggs.Remove(egg);
} }
deadeggs.Clear();
}
} }
protected void AddCrampPain() protected void AddCrampPain()

View file

@ -404,10 +404,8 @@ namespace RJW_Menstruation
DoSubRow(sublist.GetRect(rowH), key, extension, removeelements); DoSubRow(sublist.GetRect(rowH), key, extension, removeelements);
} }
} }
if (!removeelements.NullOrEmpty()) foreach (string key in removeelements) foreach (string key in removeelements)
{
extension.hybridInfo.Remove(key); extension.hybridInfo.Remove(key);
}
sublist.End(); sublist.End();
Widgets.DrawHighlightIfMouseover(rect); Widgets.DrawHighlightIfMouseover(rect);

View file

@ -81,8 +81,7 @@ namespace RJW_Menstruation
if (allvaginas != null) return allvaginas; if (allvaginas != null) return allvaginas;
allvaginas = new HashSet<HediffDef>(); allvaginas = new HashSet<HediffDef>();
List<HediffDef> allHediffs = DefDatabase<HediffDef>.AllDefsListForReading; foreach(HediffDef hediffDef in DefDatabase<HediffDef>.AllDefsListForReading)
foreach(HediffDef hediffDef in allHediffs)
{ {
if (hediffDef.comps.NullOrEmpty()) continue; if (hediffDef.comps.NullOrEmpty()) continue;
foreach (HediffCompProperties comp in hediffDef.comps) foreach (HediffCompProperties comp in hediffDef.comps)