the humans in the borders are now also processed

This commit is contained in:
M.Rohmer
2022-03-07 12:08:15 +01:00
parent 0ca5b842ff
commit beb4658c95
2 changed files with 123 additions and 11 deletions
+116 -5
View File
@@ -119,17 +119,128 @@ namespace PropagationRemasteredBeta
//check bottom right //check bottom right
peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y - 1)); peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y - 1));
}
else
{
//now we have te peoples that are in sides or corners
foreach (Point p in peopleToCheckLocations) if (Position.Y == 0)
{ {
target = T.Population[p.X, p.Y]; if (Position.X == 0)
if (target.State == Human.SAIN)
{ {
T.PeopleToCheck.Add(target); //top left corner
// @#
// ##
peopleToCheckLocations.Add(new Point(Position.X + 1,Position.Y));
peopleToCheckLocations.Add(new Point(Position.X, Position.Y + 1));
peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y + 1));
}
else if (Position.X >= T.TerrainSize.Width -1)
{
//top right corner
// #@
// ##
peopleToCheckLocations.Add(new Point(Position.X - 1, Position.Y + 1));
peopleToCheckLocations.Add(new Point(Position.X - 1, Position.Y));
peopleToCheckLocations.Add(new Point(Position.X, Position.Y + 1));
}
else
{
//on the top side
// #@#
// ###
peopleToCheckLocations.Add(new Point(Position.X - 1, Position.Y + 1));
peopleToCheckLocations.Add(new Point(Position.X - 1, Position.Y));
peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y));
peopleToCheckLocations.Add(new Point(Position.X, Position.Y + 1));
peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y + 1));
} }
} }
T.InfectedsToCheck.Add(this); else
{
if (Position.Y >= T.TerrainSize.Height - 1)
{
if (Position.X == 0)
{
//bottom left corner
// ##
// @#
peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y));
peopleToCheckLocations.Add(new Point(Position.X, Position.Y - 1));
peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y - 1));
}
else if (Position.X >= T.TerrainSize.Width - 1)
{
//Bottom right corner
// ##
// #@
peopleToCheckLocations.Add(new Point(Position.X - 1, Position.Y - 1));
peopleToCheckLocations.Add(new Point(Position.X - 1, Position.Y));
peopleToCheckLocations.Add(new Point(Position.X, Position.Y - 1));
}
else
{
//on the bottom side
// ###
// #@#
peopleToCheckLocations.Add(new Point(Position.X - 1, Position.Y - 1));
peopleToCheckLocations.Add(new Point(Position.X - 1, Position.Y));
peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y));
peopleToCheckLocations.Add(new Point(Position.X, Position.Y - 1));
peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y - 1));
}
}
else
{
//on the left side
if (Position.X >= T.TerrainSize.Width -1)
{
// ##
// #@
// ##
peopleToCheckLocations.Add(new Point(Position.X,Position.Y));
peopleToCheckLocations.Add(new Point(Position.X -1, Position.Y -1));
peopleToCheckLocations.Add(new Point(Position.X, Position.Y -1));
peopleToCheckLocations.Add(new Point(Position.X -1, Position.Y));
peopleToCheckLocations.Add(new Point(Position.X - 1, Position.Y +1));
peopleToCheckLocations.Add(new Point(Position.X, Position.Y +1));
}
else
{
//on the right side
// ##
// @#
// ##
peopleToCheckLocations.Add(new Point(Position.X, Position.Y));
peopleToCheckLocations.Add(new Point(Position.X, Position.Y -1));
peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y -1));
peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y));
peopleToCheckLocations.Add(new Point(Position.X, Position.Y + 1));
peopleToCheckLocations.Add(new Point(Position.X + 1, Position.Y + 1));
}
}
}
} }
foreach (Point p in peopleToCheckLocations)
{
target = T.Population[p.X, p.Y];
if (target.State == Human.SAIN)
{
T.PeopleToCheck.Add(target);
}
}
T.InfectedsToCheck.Add(this);
return this; return this;
} }
public Human CheckInfection(int infectiosity, Random rnd) public Human CheckInfection(int infectiosity, Random rnd)
@@ -126,6 +126,9 @@ namespace PropagationRemasteredBeta
//this.Invalidate(); //this.Invalidate();
BufferImage = t.Display(); BufferImage = t.Display();
tmrTick.Start();
pbxTerrain.Image = BufferImage; pbxTerrain.Image = BufferImage;
stopwatch.Stop(); stopwatch.Stop();
totalTime = stopwatch.ElapsedMilliseconds; totalTime = stopwatch.ElapsedMilliseconds;
@@ -137,12 +140,10 @@ namespace PropagationRemasteredBeta
//refresh all the stats //refresh all the stats
lblMemory.Text = GetMemoryUsage().ToString() + " Mb"; lblMemory.Text = GetMemoryUsage().ToString() + " Mb";
lblelementsCounter.Text = t.DRAWED_ELEMENTS.ToString(); lblelementsCounter.Text = t.DRAWED_ELEMENTS.ToString();
lblInfected.Text = t.InfectedCount[t.InfectedCount.Count() - 1].ToString(); //lblInfected.Text = t.InfectedCount[t.InfectedCount.Count() - 1].ToString();
lblImmunes.Text = t.ImmuneCount[t.ImmuneCount.Count() - 1].ToString(); //lblImmunes.Text = t.ImmuneCount[t.ImmuneCount.Count() - 1].ToString();
lblSain.Text = t.SainCount[t.SainCount.Count() - 1].ToString(); //lblSain.Text = t.SainCount[t.SainCount.Count() - 1].ToString();
lblDeaths.Text = t.DeadCount[t.DeadCount.Count() - 1].ToString(); //lblDeaths.Text = t.DeadCount[t.DeadCount.Count() - 1].ToString();
tmrTick.Start();
} }
private double GetMemoryUsage() private double GetMemoryUsage()