diff --git a/MudEngine/Commands/CommandExit.cs b/MudEngine/Commands/CommandExit.cs index 1ea93cb..c9f875b 100644 --- a/MudEngine/Commands/CommandExit.cs +++ b/MudEngine/Commands/CommandExit.cs @@ -29,18 +29,18 @@ namespace MudEngine.Commands if (player.ActiveGame.IsMultiplayer) { //Let other players know that the user walked in. - for (Int32 i = 0; i != player.ActiveGame.PlayerCollection.Length; i++) + for (Int32 i = 0; i != player.ActiveGame.GetPlayerCollection().Length; i++) { - if (player.ActiveGame.PlayerCollection[i].Name == player.Name) + if (player.ActiveGame.GetPlayerCollection()[i].Name == player.Name) continue; - String room = player.ActiveGame.PlayerCollection[i].CurrentRoom.Name; - String realm = player.ActiveGame.PlayerCollection[i].CurrentRoom.Realm; - String zone = player.ActiveGame.PlayerCollection[i].CurrentRoom.Zone; + String room = player.ActiveGame.GetPlayerCollection()[i].CurrentRoom.Name; + String realm = player.ActiveGame.GetPlayerCollection()[i].CurrentRoom.Realm; + String zone = player.ActiveGame.GetPlayerCollection()[i].CurrentRoom.Zone; if ((room == player.CurrentRoom.Name) && (realm == player.CurrentRoom.Realm) && (zone == player.CurrentRoom.Zone)) { - player.ActiveGame.PlayerCollection[i].Send(player.Name + " has left."); + player.ActiveGame.GetPlayerCollection()[i].Send(player.Name + " has left."); } } diff --git a/MudEngine/Commands/CommandLogin.cs b/MudEngine/Commands/CommandLogin.cs index 41a21d7..56cc064 100644 --- a/MudEngine/Commands/CommandLogin.cs +++ b/MudEngine/Commands/CommandLogin.cs @@ -65,7 +65,6 @@ namespace MudEngine.Commands { if (Path.GetFileNameWithoutExtension(filename).ToLower() == playerName.ToLower()) { - //TODO: Ask for password. savedFile = filename; playerFound = true; break; @@ -78,11 +77,11 @@ namespace MudEngine.Commands { if (player.ActiveGame.IsMultiplayer) { - for (Int32 i = 0; i <= player.ActiveGame.PlayerCollection.Length - 1; i++) + for (Int32 i = 0; i <= player.ActiveGame.GetPlayerCollection().Length - 1; i++) { - if (player.ActiveGame.PlayerCollection[i].Name.ToLower() == playerName.ToLower()) + if (player.ActiveGame.GetPlayerCollection()[i].Name.ToLower() == playerName.ToLower()) { - player.ActiveGame.PlayerCollection[i].Disconnect(); + player.ActiveGame.GetPlayerCollection()[i].Disconnect(); } } } @@ -116,18 +115,18 @@ namespace MudEngine.Commands //Let other players know that the user walked in. if (player.ActiveGame.IsMultiplayer) { - for (Int32 i = 0; i != player.ActiveGame.PlayerCollection.Length; i++) + for (Int32 i = 0; i != player.ActiveGame.GetPlayerCollection().Length; i++) { - if (player.ActiveGame.PlayerCollection[i].Name == player.Name) + if (player.ActiveGame.GetPlayerCollection()[i].Name == player.Name) continue; - String room = player.ActiveGame.PlayerCollection[i].CurrentRoom.Name; - String realm = player.ActiveGame.PlayerCollection[i].CurrentRoom.Realm; - String zone = player.ActiveGame.PlayerCollection[i].CurrentRoom.Zone; + String room = player.ActiveGame.GetPlayerCollection()[i].CurrentRoom.Name; + String realm = player.ActiveGame.GetPlayerCollection()[i].CurrentRoom.Realm; + String zone = player.ActiveGame.GetPlayerCollection()[i].CurrentRoom.Zone; if ((room == player.CurrentRoom.Name) && (realm == player.CurrentRoom.Realm) && (zone == player.CurrentRoom.Zone)) { - player.ActiveGame.PlayerCollection[i].Send(player.Name + " arrived."); + player.ActiveGame.GetPlayerCollection()[i].Send(player.Name + " arrived."); } } } diff --git a/MudEngine/Commands/CommandRestart.cs b/MudEngine/Commands/CommandRestart.cs index d4dd017..5a23586 100644 --- a/MudEngine/Commands/CommandRestart.cs +++ b/MudEngine/Commands/CommandRestart.cs @@ -27,18 +27,18 @@ namespace MudEngine.Commands { String path = player.ActiveGame.DataPaths.Players; - for (Int32 i = 0; i < player.ActiveGame.PlayerCollection.Length; i++) + for (Int32 i = 0; i < player.ActiveGame.GetPlayerCollection().Length; i++) { - String filename = Path.Combine(path, player.ActiveGame.PlayerCollection[i].Filename); - player.ActiveGame.PlayerCollection[i].Save(filename); + String filename = Path.Combine(path, player.ActiveGame.GetPlayerCollection()[i].Filename); + player.ActiveGame.GetPlayerCollection()[i].Save(filename); } //player.ActiveGame.Server.EndServer(); //-Handled in Game.Shutdown() below. player.ActiveGame.Shutdown(); player.ActiveGame.Start(); - /* Game.Start() calls this, do we need a reference to the playercollection? + /* Game.Start() calls this, do we need a reference to the GetPlayerCollection()? * They should be unloaded anyway and re-loaded during game.start to force a clean restart of all objects. - player.ActiveGame.Server.Initialize(555, ref player.ActiveGame.PlayerCollection); + player.ActiveGame.Server.Initialize(555, ref player.ActiveGame.GetPlayerCollection()); */ Log.Write("Server Restart Completed."); diff --git a/MudEngine/GameManagement/Game.cs b/MudEngine/GameManagement/Game.cs index 80b3b39..ae6f30c 100644 --- a/MudEngine/GameManagement/Game.cs +++ b/MudEngine/GameManagement/Game.cs @@ -154,11 +154,10 @@ namespace MudEngine.GameManagement #endregion #region Networking - //TODO: This should be internal only; C# property using get; internal set; so only MudEngine.dll may edit this collection /// /// Collection of players currently running on the server. /// - public BaseCharacter[] PlayerCollection; + protected BaseCharacter[] PlayerCollection; /// /// Gets the current running Server object. @@ -279,7 +278,7 @@ namespace MudEngine.GameManagement /// /// Shuts down the Game and Server. /// - public void Shutdown() + public virtual void Shutdown() { Log.Write("Server shutdown requested..."); @@ -429,6 +428,11 @@ namespace MudEngine.GameManagement Log.Write("Game Restore complete."); } + public BaseCharacter[] GetPlayerCollection() + { + return PlayerCollection; + } + /// /// Starts the Server. /// diff --git a/MudEngine/GameObjects/Characters/BaseCharacter.cs b/MudEngine/GameObjects/Characters/BaseCharacter.cs index c0c6ac5..40ee6b0 100644 --- a/MudEngine/GameObjects/Characters/BaseCharacter.cs +++ b/MudEngine/GameObjects/Characters/BaseCharacter.cs @@ -175,18 +175,18 @@ } //Let other players know that the user walked out. - for (Int32 i = 0; i != ActiveGame.PlayerCollection.Length; i++) + for (Int32 i = 0; i != ActiveGame.GetPlayerCollection().Length; i++) { - if (ActiveGame.PlayerCollection[i].Name == Name) + if (ActiveGame.GetPlayerCollection()[i].Name == Name) continue; - String room = ActiveGame.PlayerCollection[i].CurrentRoom.Filename; - String realm = ActiveGame.PlayerCollection[i].CurrentRoom.Realm; - String zone = ActiveGame.PlayerCollection[i].CurrentRoom.Zone; + String room = ActiveGame.GetPlayerCollection()[i].CurrentRoom.Filename; + String realm = ActiveGame.GetPlayerCollection()[i].CurrentRoom.Realm; + String zone = ActiveGame.GetPlayerCollection()[i].CurrentRoom.Zone; if ((room == CurrentRoom.Filename) && (realm == CurrentRoom.Realm) && (zone == CurrentRoom.Zone)) { - ActiveGame.PlayerCollection[i].Send(Name + " walked out towards the " + travelDirection.ToString()); + ActiveGame.GetPlayerCollection()[i].Send(Name + " walked out towards the " + travelDirection.ToString()); } } @@ -202,18 +202,18 @@ { //TODO: Check the Room/Zone/Realm to see if anything needs to occure during travel. //Let other players know that the user walked in. - for (Int32 i = 0; i != ActiveGame.PlayerCollection.Length; i++) + for (Int32 i = 0; i != ActiveGame.GetPlayerCollection().Length; i++) { - if (ActiveGame.PlayerCollection[i].Name == Name) + if (ActiveGame.GetPlayerCollection()[i].Name == Name) continue; - String room = ActiveGame.PlayerCollection[i].CurrentRoom.Name; - String realm = ActiveGame.PlayerCollection[i].CurrentRoom.Realm; - String zone = ActiveGame.PlayerCollection[i].CurrentRoom.Zone; + String room = ActiveGame.GetPlayerCollection()[i].CurrentRoom.Name; + String realm = ActiveGame.GetPlayerCollection()[i].CurrentRoom.Realm; + String zone = ActiveGame.GetPlayerCollection()[i].CurrentRoom.Zone; if ((room == CurrentRoom.Name) && (realm == CurrentRoom.Realm) && (zone == CurrentRoom.Zone)) { - ActiveGame.PlayerCollection[i].Send(Name + " walked in from the " + TravelDirections.GetReverseDirection(travelDirection)); + ActiveGame.GetPlayerCollection()[i].Send(Name + " walked in from the " + TravelDirections.GetReverseDirection(travelDirection)); } } } diff --git a/MudGame/..svnbridge/.svnbridge b/MudGame/..svnbridge/.svnbridge index 25ee1ea..bc15627 100644 --- a/MudGame/..svnbridge/.svnbridge +++ b/MudGame/..svnbridge/.svnbridge @@ -1,2 +1,4 @@ svn:ignoreobj +svn:ignoreobj +Settings.ini \ No newline at end of file diff --git a/MudGame/Program.cs b/MudGame/Program.cs index 487dfa4..26d9ea4 100644 --- a/MudGame/Program.cs +++ b/MudGame/Program.cs @@ -104,7 +104,7 @@ namespace MudGame //scripts might miss this, so we check for it. if (!game.IsMultiplayer) { - if ((game.PlayerCollection[0] == null) || (game.PlayerCollection[0].Name == "New BaseCharacter")) + if ((game.GetPlayerCollection()[0] == null) || (game.GetPlayerCollection()[0].Name == "New BaseCharacter")) { Log.Write("Error! No player available for creation!", true); return; diff --git a/MudGame/Scripts/CommandSay.cs b/MudGame/Scripts/CommandSay.cs index 5938aa2..5429a21 100644 --- a/MudGame/Scripts/CommandSay.cs +++ b/MudGame/Scripts/CommandSay.cs @@ -12,7 +12,7 @@ public class CommandSay : IGameCommand String message = command.Substring("Say ".Length); - foreach (BaseCharacter p in player.ActiveGame.PlayerCollection) + foreach (BaseCharacter p in player.ActiveGame.GetPlayerCollection()) { if ((p.CurrentRoom.Realm == player.CurrentRoom.Realm) && (p.CurrentRoom.Zone == player.CurrentRoom.Zone) && (p.CurrentRoom.Filename == player.CurrentRoom.Filename)) { diff --git a/MudGame/bin/Debug/..svnbridge/.svnbridge b/MudGame/bin/Debug/..svnbridge/.svnbridge index 81fb272..2fe5fb0 100644 --- a/MudGame/bin/Debug/..svnbridge/.svnbridge +++ b/MudGame/bin/Debug/..svnbridge/.svnbridge @@ -29,4 +29,18 @@ temp Realms Mud Designer Example Game.ini World +svn:ignoreLog.txt +MudEngine.dll +MudEngine.pdb +MudGame.exe +MudGame.pdb +MudGame.vshost.exe +MudGame.vshost.exe.manifest +Player +temp +Realms +Mud Designer Example Game.ini +World +Planet Earth MUD.ini +Saved \ No newline at end of file diff --git a/MudGame/bin/Debug/Scripts/..svnbridge/.svnbridge b/MudGame/bin/Debug/Scripts/..svnbridge/.svnbridge index 5c1933d..2a60136 100644 --- a/MudGame/bin/Debug/Scripts/..svnbridge/.svnbridge +++ b/MudGame/bin/Debug/Scripts/..svnbridge/.svnbridge @@ -2,4 +2,9 @@ CommandCreate.cs CommandSay.cs EarthGame.cs +svn:ignoreCommandClear.cs +CommandCreate.cs +CommandSay.cs +EarthGame.cs +CommandHelp.cs \ No newline at end of file diff --git a/MudGame/bin/Release/..svnbridge/.svnbridge b/MudGame/bin/Release/..svnbridge/.svnbridge index 25d09e9..87c2dd4 100644 --- a/MudGame/bin/Release/..svnbridge/.svnbridge +++ b/MudGame/bin/Release/..svnbridge/.svnbridge @@ -7,4 +7,11 @@ MudEngine.pdb MudGame.exe MudGame.pdb Scripts +svn:ignoreMudEngine.dll +MudEngine.pdb +MudGame.exe +MudGame.pdb +Scripts +Commands +Settings.ini \ No newline at end of file