MudEngine:

- Reverted Server code back to using player arrays rather than List<> so that the server will actually start and run again.
This commit is contained in:
Scionwest_cp 2010-07-29 19:07:09 -07:00
parent 9b023a2092
commit 2152a139b0
5 changed files with 10 additions and 15 deletions

View file

@ -180,7 +180,7 @@ namespace MudEngine.GameManagement
CurrencyList = new List<Currency>();
scriptEngine = new Scripting.ScriptEngine(this);
RealmCollection = new List<Realm>();
PlayerCollection = new List<BaseCharacter>();
//PlayerCollection = new List<BaseCharacter>();
GameTitle = "New Game";
_Filename = "Game.xml";
@ -236,9 +236,6 @@ namespace MudEngine.GameManagement
//Start the Telnet server
if (IsMultiplayer)
this.StartServer();
else
//TODO: Need to load a previously saved character or allow for creation of one by user.
//PlayerCollection.Add(new BaseCharacter(this)); //If this is single player, then add a new character to the game.
IsRunning = true;
@ -313,8 +310,8 @@ namespace MudEngine.GameManagement
}
//TODO: This should be internal only; C# property using get; internal set; so only MudEngine.dll may edit this collection
public List<BaseCharacter> PlayerCollection;
//public BaseCharacter[] PlayerCollection;
//public List<BaseCharacter> PlayerCollection;
public BaseCharacter[] PlayerCollection;
public MudEngine.Networking.Server Server { get; internal set; }
public ProtocolType ServerType = ProtocolType.Tcp;
@ -327,7 +324,9 @@ namespace MudEngine.GameManagement
{
//This is handled by the Game() Constructor
//PlayerCollection = new List<BaseCharacter>(MaximumPlayers);
PlayerCollection.Add(new BaseCharacter(this));
PlayerCollection = new BaseCharacter[MaximumPlayers];
for (int i = 0; i < MaximumPlayers; i++)
PlayerCollection[i] = new BaseCharacter(this);
Server = new Networking.Server();
Server.Initialize(ServerPort, ref PlayerCollection);
Server.Start();