mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Switch deadeggs to a HashSet
This commit is contained in:
parent
310c03a193
commit
f7e3d6c1c4
1 changed files with 4 additions and 12 deletions
|
@ -1364,7 +1364,7 @@ namespace RJW_Menstruation
|
||||||
{
|
{
|
||||||
if (eggs.NullOrEmpty()) return false;
|
if (eggs.NullOrEmpty()) return false;
|
||||||
|
|
||||||
List<Egg> deadeggs = new List<Egg>();
|
HashSet<Egg> deadeggs = new HashSet<Egg>();
|
||||||
bool pregnant = false;
|
bool pregnant = false;
|
||||||
foreach (Egg egg in eggs)
|
foreach (Egg egg in eggs)
|
||||||
{
|
{
|
||||||
|
@ -1474,12 +1474,7 @@ namespace RJW_Menstruation
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
eggs.RemoveAll(egg => deadeggs.Contains(egg));
|
||||||
foreach (Egg egg in deadeggs)
|
|
||||||
{
|
|
||||||
eggs.Remove(egg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return pregnant;
|
return pregnant;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1549,7 +1544,7 @@ namespace RJW_Menstruation
|
||||||
|
|
||||||
protected void EggDecay()
|
protected void EggDecay()
|
||||||
{
|
{
|
||||||
List<Egg> deadeggs = new List<Egg>();
|
HashSet<Egg> deadeggs = new HashSet<Egg>();
|
||||||
foreach (Egg egg in eggs)
|
foreach (Egg egg in eggs)
|
||||||
{
|
{
|
||||||
egg.position += Configurations.CycleAcceleration;
|
egg.position += Configurations.CycleAcceleration;
|
||||||
|
@ -1560,10 +1555,7 @@ namespace RJW_Menstruation
|
||||||
if (egg.lifespanhrs < 0) deadeggs.Add(egg);
|
if (egg.lifespanhrs < 0) deadeggs.Add(egg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (Egg egg in deadeggs)
|
eggs.RemoveAll(egg => deadeggs.Contains(egg));
|
||||||
{
|
|
||||||
eggs.Remove(egg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void AddCrampPain()
|
protected void AddCrampPain()
|
||||||
|
|
Loading…
Reference in a new issue