diff options
| author | Michael <[email protected]> | 2017-02-08 11:58:16 -0500 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-02-08 11:58:16 -0500 |
| commit | f5cbbaf892df078364e70dc26e575abf2291a7d7 (patch) | |
| tree | 69a61b051339530d424e640d29140a88d11fbf26 /ShiftOS_TheReturn | |
| parent | 512a02ba88678cb7ddd65f32245135c8cf2ba1c3 (diff) | |
| download | shiftos_thereturn-f5cbbaf892df078364e70dc26e575abf2291a7d7.tar.gz shiftos_thereturn-f5cbbaf892df078364e70dc26e575abf2291a7d7.tar.bz2 shiftos_thereturn-f5cbbaf892df078364e70dc26e575abf2291a7d7.zip | |
Fix Shiftorium init bugs.
Diffstat (limited to 'ShiftOS_TheReturn')
| -rw-r--r-- | ShiftOS_TheReturn/Shiftorium.cs | 19 |
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; } |
