#include "UnitActionManager.h"

#include "MemoryManager/debugNew.h"

using namespace std;

UnitActionManager * UnitActionManager::instance = NULL;

UnitActionManager::UnitActionManager(void){
}

UnitActionManager::~UnitActionManager(void){
	freeActions();
}

UnitActionManager& UnitActionManager::getInstance(){
	if (instance == NULL){
		instance = new UnitActionManager();
	}
	return *instance;
}
void UnitActionManager::destroy(){
	delete instance;
	instance = NULL;
}

void UnitActionManager::dispose(UnitAction* action){
	disposedActions.push_back(action);
}

void UnitActionManager::freeActions(){
	for (vector<UnitAction*>::iterator it = disposedActions.begin(); it != disposedActions.end(); ++it){
		delete *it;
	}
	disposedActions.clear();
}

