
//

//CObjectManager.h


/*******************************************************
//
//	Name: CObjectManager.h
//
//	Author: Dave Ratti
//
//	Date:6-10-01
//
//	Modified: 10-07-01
//
//	Notes: This class will manager all the objects in our game
//
//
//
//
//
*********************************************************/

#ifndef COBJECTMANAGER_H_
#define COBJECTMANAGER_H_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "stringc.h"
#include "Assert.h"
#include "CImage.h"
#include "CGameObject.h"
#include "Singleton.h"
#include "CAIMap.h"


#include <list>

using namespace std;

typedef list<CGameObject*> ObjectList;
typedef ObjectList::iterator ObjectListIterator;

typedef list<int> ObjectIDList;
typedef ObjectIDList::iterator ObjectIDListIterator;

///////////////////////////////////////////////

#define g_ObjectManager CObjectManager::GetSingleton()



class CObjectManager: public Singleton <CObjectManager>
{

public:

	CObjectManager(){ Clear(); }
	~CObjectManager(){  }

	void Clear();
	bool Init();
	void ShutDown();

	void drawObjects();
	void updateObjects();
	void collisionDetect();
		
	CGameObject* CreateObject(ObjectType typ);	
	CGameObject* GetObjectID(int ID);
	CGameObject* GetObjectType(ObjectType typ);	//will get first object of type typ. Only use when you are sure only 1 object exsists

	void DestroyObject(CGameObject* obj);

	void RemoveObjectSafe(int ID);		//This will safely remove an object from the list at the end of a frame
	void RemoveObjectsInQueue();

	CAIMap*	getAIMap();

	static int			getIntFromObjType(ObjectType o);
	static ObjectType	getObjTypeFromInt(int i);
	

protected:

	ObjectList			Objects;	//the big list of all game objects;	
	ObjectList			CollisionObjects;
	ObjectIDList		m_ObjectsToBeRemoved; 


	void insertObject(CGameObject* obj);	//this should just be temporary. 
	int TotalObjects;

};


#endif