aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn/Shiftorium.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-02-08 11:58:16 -0500
committerMichael <[email protected]>2017-02-08 11:58:16 -0500
commitf5cbbaf892df078364e70dc26e575abf2291a7d7 (patch)
tree69a61b051339530d424e640d29140a88d11fbf26 /ShiftOS_TheReturn/Shiftorium.cs
parent512a02ba88678cb7ddd65f32245135c8cf2ba1c3 (diff)
downloadshiftos_thereturn-f5cbbaf892df078364e70dc26e575abf2291a7d7.tar.gz
shiftos_thereturn-f5cbbaf892df078364e70dc26e575abf2291a7d7.tar.bz2
shiftos_thereturn-f5cbbaf892df078364e70dc26e575abf2291a7d7.zip
Fix Shiftorium init bugs.
Diffstat (limited to 'ShiftOS_TheReturn/Shiftorium.cs')
-rw-r--r--ShiftOS_TheReturn/Shiftorium.cs19
1 files changed, 14 insertions, 5 deletions
diff --git a/ShiftOS_TheReturn/Shiftorium.cs b/ShiftOS_TheReturn/Shiftorium.cs
index 06a189f..4e31427 100644
--- a/ShiftOS_TheReturn/Shiftorium.cs
+++ b/ShiftOS_TheReturn/Shiftorium.cs
@@ -191,19 +191,18 @@ namespace ShiftOS.Engine
{
if (SaveSystem.CurrentSave != null)
{
- if (SaveSystem.CurrentSave.Upgrades == null)
+ if (!IsInitiated)
Init();
}
try
{
return SaveSystem.CurrentSave.Upgrades[id];
}
- catch (Exception ex)
+ catch
{
- if(LogOrphanedUpgrades == true)
- Console.WriteLine($"WHOA, Developers! Upgrade ID '{id}' is unaccounted for in the Shiftorium.txt resource!");
- return false;
+ throw new ShiftoriumUpgradeLookupException(id);
}
+
}
//LEAVE THIS AS FALSE. The game will set it when the save is loaded.
@@ -238,6 +237,16 @@ namespace ShiftOS.Engine
List<ShiftoriumUpgrade> GetDefaults();
}
+ public class ShiftoriumUpgradeLookupException : Exception
+ {
+ public ShiftoriumUpgradeLookupException(string id) : base("A shiftorium upgrade of ID \"" + id + "\" was not found in the system.")
+ {
+ ID = id;
+ }
+
+ public string ID { get; private set; }
+ }
+
public class ShiftoriumUpgrade
{
public string Name { get; set; }