#include "StdAfx.h"
#include "Block.h"

#include "Bomb.h"


Block::Block(void)
{
	setBomb = NULL;
	bombTriggered = false;
}


Block::~Block(void)
{
	if(setBomb)
		delete setBomb;
}

void 
Block::getCoords(int *x_, int *y_)
{
	*x_ = x;
	*y_ = y;
}

void 
Block::fireBomb()
{
	if(setBomb)
		setBomb->explode();
}

Bomb *
Block::getBomb()
{
	return setBomb;
}

void 
Block::addBomb(Bomb *a)
{
	setBomb = a;
}

void 
Block::drawBomb(OGLrendrer *ogl)
{
	if(setBomb)
		setBomb->draw(ogl);
}

void 
Block::removeBomb()
{
	setBomb = NULL;
	bombTriggered = false;
}

void 
Block::trigger()
{
	if(setBomb)
		bombTriggered = true;
}

void 
Block::leaveSquare()
{
	if(bombTriggered)
	{
		fireBomb();
	}
}