diff options
| author | Aren <[email protected]> | 2017-02-08 18:22:33 +0100 |
|---|---|---|
| committer | Aren <[email protected]> | 2017-02-08 18:22:33 +0100 |
| commit | f66cf31e5d590cfcd82c849f18986003b47f7976 (patch) | |
| tree | 070a9b0e5218d01cfdee60d10ece3a511d23cc1c /ShiftOS_TheReturn | |
| parent | b6dff54e9509b3348997a4da9652b152a3033cdd (diff) | |
| parent | f5cbbaf892df078364e70dc26e575abf2291a7d7 (diff) | |
| download | shiftos_thereturn-f66cf31e5d590cfcd82c849f18986003b47f7976.tar.gz shiftos_thereturn-f66cf31e5d590cfcd82c849f18986003b47f7976.tar.bz2 shiftos_thereturn-f66cf31e5d590cfcd82c849f18986003b47f7976.zip | |
Merge branch 'master' of https://github.com/shiftos-game/shiftos
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; } |
