aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-06-28 20:04:18 -0400
committerMichael <[email protected]>2017-06-28 20:04:18 -0400
commita15fc8c28a0f5fa36c0e38602730701fb108325a (patch)
tree3038bbd25fb749c1574ea1eb0c86cd296eae0ded /ShiftOS_TheReturn
parent27264a559d7fd40a0c2bc393a5e150c17da1539d (diff)
downloadshiftos_thereturn-a15fc8c28a0f5fa36c0e38602730701fb108325a.tar.gz
shiftos_thereturn-a15fc8c28a0f5fa36c0e38602730701fb108325a.tar.bz2
shiftos_thereturn-a15fc8c28a0f5fa36c0e38602730701fb108325a.zip
Fix virus manager init bug
Diffstat (limited to 'ShiftOS_TheReturn')
-rw-r--r--ShiftOS_TheReturn/VirusManager.cs36
1 files changed, 18 insertions, 18 deletions
diff --git a/ShiftOS_TheReturn/VirusManager.cs b/ShiftOS_TheReturn/VirusManager.cs
index 74d0e80..56767e6 100644
--- a/ShiftOS_TheReturn/VirusManager.cs
+++ b/ShiftOS_TheReturn/VirusManager.cs
@@ -13,24 +13,27 @@ namespace ShiftOS.Engine
public static void Init()
{
- ActiveInfections = new List<IVirus>();
- if (SaveSystem.CurrentSave.ViralInfections == null)
- SaveSystem.CurrentSave.ViralInfections = new List<ViralInfection>();
- foreach(var virusdata in SaveSystem.CurrentSave.ViralInfections)
+ Desktop.InvokeOnWorkerThread(() =>
{
- var virus = CreateVirus(virusdata.ID, virusdata.ThreatLevel);
- var existing = ActiveInfections.FirstOrDefault(x => x.GetType() == virus.GetType());
- if(existing != null)
+ ActiveInfections = new List<IVirus>();
+ if (SaveSystem.CurrentSave.ViralInfections == null)
+ SaveSystem.CurrentSave.ViralInfections = new List<ViralInfection>();
+ foreach (var virusdata in SaveSystem.CurrentSave.ViralInfections)
{
- var eIndex = ActiveInfections.IndexOf(existing);
- ActiveInfections[eIndex] = virus;
- existing.Disinfect();
- }
- else
- {
- ActiveInfections.Add(virus);
+ var virus = CreateVirus(virusdata.ID, virusdata.ThreatLevel);
+ var existing = ActiveInfections.FirstOrDefault(x => x.GetType() == virus.GetType());
+ if (existing != null)
+ {
+ var eIndex = ActiveInfections.IndexOf(existing);
+ ActiveInfections[eIndex] = virus;
+ existing.Disinfect();
+ }
+ else
+ {
+ ActiveInfections.Add(virus);
+ }
}
- }
+ });
}
public static void Infect(string id, int threatlevel)
@@ -90,9 +93,6 @@ namespace ShiftOS.Engine
}
}
}
- {
-
- }
throw new Exception("Cannot create virus.");
}