#ifndef _BITFLAGMAP
#define _BITFLAGMAP


template<unsigned short W, unsigned short H>
class BitFlagMap
{
	public:
	Uint8 Map [H][W/8];

	BitFlagMap()
	{
		this->clear();
	}

	bool Poke(Sint16 x, Sint16 y)
	{
		if (x < 0) return false;
		if (y < 0) return false;
		if (x > W) return false;
		if (y > H) return false;
		Uint8 bitFlag = 1 << (x%8);
		Uint8 octFlag = this->Map[y][x/8];
		if (0 == (octFlag & bitFlag)) return false;
		this->Map[y][x/8] = octFlag | bitFlag;
		return true;
	}

	void Clear()
	{
		for (Uint16 y = 0; y < H; y++)
		for (Uint16 x = 0; x < W/8; x++)
		this->Map[y][x] = 0;
	}
};




#endif
