#include "Organism.h"
#include "Human.h"
#include "Zombie.h"
using namespace std;


Organism::Organism() {}

//CREATION!!!
Organism::Organism(City *city, int width, int height)
{
	this->city = city;
	this->width = width;
	this->height = height;
}//end Organism(parameters)

 //DESTRUCTION!!
Organism::~Organism() {}

//Getters and Setters
void Organism::setPosition(int x, int y) { 
	
	this->x = x; this->y = y; 

}

void Organism::setHasMoved(bool hasMoved) { 
	
	this->hasMoved = hasMoved; 

}

bool Organism::getHasMoved() { 
	
	return this->hasMoved; 

}

void Organism::setHasSpawned(bool hasSpawned) { 
	
	this->hasSpawned = hasSpawned; 

}

bool Organism::getHasSpawned() { 
	
	return this->hasSpawned; 

}

void Organism::setSpawnCount(int spawnCount) { 
	
	this->spawnCount = spawnCount;

}

int Organism::getSpawnCount() { 
	
	return this->spawnCount; 

}

														
ostream& operator<<(ostream &output, Organism *organism)
{
	//handler for changing to colour of the text in consol
	HANDLE  color = GetStdHandle(STD_OUTPUT_HANDLE); 

	//if human in space print 'O'												 
	if (dynamic_cast<Human*>(organism) != NULL){

		SetConsoleTextAttribute(color, 34);
		output << "O";
		SetConsoleTextAttribute(color, BOARD_COLOR);

	}

	//else if zombie print 'X'
	else if (dynamic_cast<Zombie*>(organism) != NULL) {

		SetConsoleTextAttribute(color, 204);
		output << "X";
		SetConsoleTextAttribute(color, BOARD_COLOR);

	}

	//or if nothing sprint space
	else {
		output << " ";
	}

	return output;
}