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;
|
||||
|
||||
List<Egg> deadeggs = new List<Egg>();
|
||||
HashSet<Egg> deadeggs = new HashSet<Egg>();
|
||||
bool pregnant = false;
|
||||
foreach (Egg egg in eggs)
|
||||
{
|
||||
|
@ -1474,12 +1474,7 @@ namespace RJW_Menstruation
|
|||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (Egg egg in deadeggs)
|
||||
{
|
||||
eggs.Remove(egg);
|
||||
}
|
||||
}
|
||||
eggs.RemoveAll(egg => deadeggs.Contains(egg));
|
||||
return pregnant;
|
||||
}
|
||||
|
||||
|
@ -1549,7 +1544,7 @@ namespace RJW_Menstruation
|
|||
|
||||
protected void EggDecay()
|
||||
{
|
||||
List<Egg> deadeggs = new List<Egg>();
|
||||
HashSet<Egg> deadeggs = new HashSet<Egg>();
|
||||
foreach (Egg egg in eggs)
|
||||
{
|
||||
egg.position += Configurations.CycleAcceleration;
|
||||
|
@ -1560,10 +1555,7 @@ namespace RJW_Menstruation
|
|||
if (egg.lifespanhrs < 0) deadeggs.Add(egg);
|
||||
}
|
||||
}
|
||||
foreach (Egg egg in deadeggs)
|
||||
{
|
||||
eggs.Remove(egg);
|
||||
}
|
||||
eggs.RemoveAll(egg => deadeggs.Contains(egg));
|
||||
}
|
||||
|
||||
protected void AddCrampPain()
|
||||
|
|
Loading…
Reference in a new issue