
#ifndef _GAMEWORLD_H_
#define _GAMEWORLD_H_

#include "tnl.h"
#include "tnlNetBase.h"
#include "tnlGhostConnection.h"
#include "tnlNetInterface.h"
#include "tnlNetObject.h"
#include "tnlLog.h"
#include "tnlRPC.h"
#include "tnlString.h"
#include "tnlAsymmetricKey.h"

#include "Position.h"

using namespace TNL;

namespace DinastyOnline {
	namespace Network {

		class GameObject;
		class GameNetInterface;
		class GameConnection;
	
		class GameWorld {
			
		protected:
			GameNetInterface *theNetInterface; ///< network interface for this game
			TNL::U32 lastTime; ///< last time that tick() was called
			
			Vector<GameObject *> mGameObjects;
			Vector<SafePtr<GameObject> > mScopeAlwaysList;
			
		public:
			
			~GameWorld();
			
			const Vector<GameObject *> getGameObjects() { return mGameObjects; }
			void addToGameObjectList(GameObject *theObject);
			void removeFromGameObjectList(GameObject *theObject);
			GameNetInterface *getNetInterface() { return theNetInterface; };
			const Vector<SafePtr<GameObject> > &getScopeAlwaysList() { return mScopeAlwaysList; }
			void setScopeAlwaysObject(GameObject *theObject);
			
			/// Called periodically by the platform windowing code, tick will update
			/// all the players in the simulation as well as idle() the game's
			/// network interface.
			void idle();
			
			virtual bool isServer() {return false;};
	
		};
	}
}

#endif
