Fixed the bug where the simulation would simply restart automatically
This commit is contained in:
@@ -113,6 +113,7 @@ namespace PropagationRemasteredBeta
|
|||||||
this.btnRandomName.Name = "btnRandomName";
|
this.btnRandomName.Name = "btnRandomName";
|
||||||
this.btnRandomName.Size = new System.Drawing.Size(34, 34);
|
this.btnRandomName.Size = new System.Drawing.Size(34, 34);
|
||||||
this.btnRandomName.TabIndex = 18;
|
this.btnRandomName.TabIndex = 18;
|
||||||
|
this.btnRandomName.Text = "#";
|
||||||
this.btnRandomName.UseVisualStyleBackColor = true;
|
this.btnRandomName.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// label10
|
// label10
|
||||||
@@ -207,6 +208,7 @@ namespace PropagationRemasteredBeta
|
|||||||
this.btnRandomizeStats.Name = "btnRandomizeStats";
|
this.btnRandomizeStats.Name = "btnRandomizeStats";
|
||||||
this.btnRandomizeStats.Size = new System.Drawing.Size(34, 34);
|
this.btnRandomizeStats.Size = new System.Drawing.Size(34, 34);
|
||||||
this.btnRandomizeStats.TabIndex = 20;
|
this.btnRandomizeStats.TabIndex = 20;
|
||||||
|
this.btnRandomizeStats.Text = "#";
|
||||||
this.btnRandomizeStats.UseVisualStyleBackColor = true;
|
this.btnRandomizeStats.UseVisualStyleBackColor = true;
|
||||||
this.btnRandomizeStats.Click += new System.EventHandler(this.btnRandomizeStats_Click);
|
this.btnRandomizeStats.Click += new System.EventHandler(this.btnRandomizeStats_Click);
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -110,6 +110,8 @@ namespace PropagationRemasteredBeta
|
|||||||
if (infecteds > 0)
|
if (infecteds > 0)
|
||||||
{
|
{
|
||||||
t.Refresh();
|
t.Refresh();
|
||||||
|
//Stopping and restarting timer makes sure that the processing of the image is finished before an other call is made
|
||||||
|
tmrTick.Start();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -122,7 +124,8 @@ namespace PropagationRemasteredBeta
|
|||||||
|
|
||||||
BufferImage = t.Display();
|
BufferImage = t.Display();
|
||||||
|
|
||||||
tmrTick.Start();
|
|
||||||
|
|
||||||
if (needToSave)
|
if (needToSave)
|
||||||
{
|
{
|
||||||
Save(BufferImage, frameCount);
|
Save(BufferImage, frameCount);
|
||||||
@@ -138,10 +141,15 @@ 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();
|
|
||||||
//lblImmunes.Text = t.ImmuneCount[t.ImmuneCount.Count() - 1].ToString();
|
if(t.InfectedCount.Count > 0)
|
||||||
//lblSain.Text = t.SainCount[t.SainCount.Count() - 1].ToString();
|
lblInfected.Text = t.InfectedCount[t.InfectedCount.Count() - 1].ToString();
|
||||||
//lblDeaths.Text = t.DeadCount[t.DeadCount.Count() - 1].ToString();
|
if (t.ImmuneCount.Count > 0)
|
||||||
|
lblImmunes.Text = t.ImmuneCount[t.ImmuneCount.Count() - 1].ToString();
|
||||||
|
if (t.SainCount.Count > 0)
|
||||||
|
lblSain.Text = t.SainCount[t.SainCount.Count() - 1].ToString();
|
||||||
|
if(t.DeadCount.Count > 0)
|
||||||
|
lblDeaths.Text = t.DeadCount[t.DeadCount.Count() - 1].ToString();
|
||||||
}
|
}
|
||||||
private void Save(Bitmap imageToSave, int frameNumber)
|
private void Save(Bitmap imageToSave, int frameNumber)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -169,27 +169,17 @@ namespace PropagationRemasteredBeta
|
|||||||
{
|
{
|
||||||
//we also send the random so if one day we want to add a seed feature it will also affect the transmission
|
//we also send the random so if one day we want to add a seed feature it will also affect the transmission
|
||||||
switch (Population[width, height].State)
|
switch (Population[width, height].State)
|
||||||
{
|
|
||||||
case Human.INFECTED:
|
|
||||||
Population[width, height].Propagate(this);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
//nothing to do for now
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//only for stats purposes
|
|
||||||
switch (Population[width, height].State)
|
|
||||||
{
|
{
|
||||||
case Human.SAIN:
|
case Human.SAIN:
|
||||||
SainCount[SimulationDuration] += 1;
|
SainCount[SimulationDuration] += 1;
|
||||||
break;
|
break;
|
||||||
|
case Human.INFECTED:
|
||||||
|
Population[width, height].Propagate(this);
|
||||||
|
InfectedCount[SimulationDuration] += 1;
|
||||||
|
break;
|
||||||
case Human.IMMUNE:
|
case Human.IMMUNE:
|
||||||
ImmuneCount[SimulationDuration] += 1;
|
ImmuneCount[SimulationDuration] += 1;
|
||||||
break;
|
break;
|
||||||
case Human.INFECTED:
|
|
||||||
InfectedCount[SimulationDuration] += 1;
|
|
||||||
break;
|
|
||||||
case Human.DEAD:
|
case Human.DEAD:
|
||||||
DeadCount[SimulationDuration] += 1;
|
DeadCount[SimulationDuration] += 1;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user