diff --git a/MudEngine/WinPC_Engine/Core/CommandSystem.cs b/MudEngine/WinPC_Engine/Core/CommandSystem.cs index aa54c18..57e2f04 100644 --- a/MudEngine/WinPC_Engine/Core/CommandSystem.cs +++ b/MudEngine/WinPC_Engine/Core/CommandSystem.cs @@ -105,13 +105,13 @@ namespace MudEngine.Core string key = command.Insert(0, "Command"); //Loop through each Key in the Commands collection - foreach (string k in CommandSystem.Commands.Keys) + foreach (string k in this.CommandCollection.Keys) { //Check to see if the Key (Command Name) matches the Command we are looking for. if (key.ToLower().Contains(k.ToLower())) { //Grab a reference to the Command - ICommand cmd = CommandSystem.Commands[k]; + ICommand cmd = this.CommandCollection[k]; try { //Execute the command @@ -120,7 +120,6 @@ namespace MudEngine.Core catch (Exception ex) { Logger.WriteLine("Error: " + ex.Message); - Console.WriteLine("Error: " + ex.Message); } } } diff --git a/MudEngine/WinPC_Engine/Game/Characters/StandardCharacter.cs b/MudEngine/WinPC_Engine/Game/Characters/StandardCharacter.cs index d4f94a6..2ff7030 100644 --- a/MudEngine/WinPC_Engine/Game/Characters/StandardCharacter.cs +++ b/MudEngine/WinPC_Engine/Game/Characters/StandardCharacter.cs @@ -164,7 +164,9 @@ namespace MudEngine.Game.Characters { base.Load(filename); - this.Immovable = Convert.ToBoolean(this.SaveData.GetData("Immovable")); + try { this.Immovable = Convert.ToBoolean(this.SaveData.GetData("Immovable")); } + catch { this.LoadFailedMessage("Immovable"); } + this.Password = this.SaveData.GetData("Password"); String role = this.SaveData.GetData("Role"); diff --git a/MudEngine/WinPC_Engine/Game/Environment/Environment.cs b/MudEngine/WinPC_Engine/Game/Environment/Environment.cs index dd734e8..1162004 100644 --- a/MudEngine/WinPC_Engine/Game/Environment/Environment.cs +++ b/MudEngine/WinPC_Engine/Game/Environment/Environment.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using MudEngine.Core; using MudEngine.Core.Interfaces; using MudEngine.Game.Characters; using MudEngine.Game; @@ -70,7 +71,9 @@ namespace MudEngine.Game.Environment { base.Load(filename); - this.Filename = this.SaveData.GetData("Filename"); + try { this.Filename = this.SaveData.GetData("Filename"); } + catch { LoadFailedMessage("Filename"); } + this.Enabled = Convert.ToBoolean(this.SaveData.GetData("Enabled")); String role = this.SaveData.GetData("RequiredRole"); diff --git a/MudEngine/WinPC_Engine/GameScripts/BaseScript.cs b/MudEngine/WinPC_Engine/GameScripts/BaseScript.cs index 38c7071..1eb5b28 100644 --- a/MudEngine/WinPC_Engine/GameScripts/BaseScript.cs +++ b/MudEngine/WinPC_Engine/GameScripts/BaseScript.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text; using System.Xml.Linq; using System.IO; +using System.Diagnostics; using MudEngine.Game; using MudEngine.DAL; @@ -84,6 +85,13 @@ namespace MudEngine.GameScripts return; } + public void LoadFailedMessage(String property) + { + StackTrace trace = new StackTrace(); + String callingType = trace.GetFrame(1).GetMethod().ReflectedType.Name; + Logger.WriteLine("Load failed for " + callingType + "." + property); + } + public override string ToString() { if (String.IsNullOrEmpty(this.Name))