
#include "GameWorld.h"
#include "GameWorldServer.h"
#include "Player.h"
#include "GameNetInterface.h"
#include "GameConnection.h"

using namespace TNL;
using namespace DinastyOnline::Network;

namespace DinastyOnline {
	namespace Network {

		GameWorldServer::GameWorldServer(const TNL::Address &interfaceAddr) {
			theNetInterface = new GameNetInterface(this, interfaceAddr);
			theNetInterface->setAllowsConnections(true);
	
			TNL::AsymmetricKey *theKey = new TNL::AsymmetricKey(32);
			theNetInterface->setPrivateKey(theKey);
			theNetInterface->setRequiresKeyExchange(true);
	
			TNL::logprintf("Created a server...");
		}
		
		GameWorldServer::~GameWorldServer() {
			delete theNetInterface;
			for(TNL::S32 i = 0; i < mGameObjects.size(); i++) {
				delete mGameObjects[i];
			}
	
			TNL::logprintf("Destroyed a server...");
		}

	}

}
