예제 #1
0
void StoneHandler::removeDeadMarks()
{
	Q3IntDictIterator<Stone> it(*stones);
	Stone *s;
	
	while (it.current())
	{
		s = it.current();
		CHECK_PTR(s);
		if (s->isDead() || s->isSeki())
		{
			s->setDead(false);
			s->setSeki(false);
			s->togglePixmap(boardHandler->board->getImageHandler()->getStonePixmaps(),
					true);
		}
		++it;
	}
}
예제 #2
0
bool StoneHandler::markSekiGroup(int x, int y, int &caps, StoneColor &col, bool &seki)
{
	if (hasStone(x, y) != 1)
		return false;
	
	Stone *s = getStoneAt(x, y);
	CHECK_PTR(s);
	col = s->getColor();
	
	if (!s->isSeki())
		seki = true;
	
	Group *g = assembleGroup(s, NULL);        //SL added eb 8
	CHECK_PTR(g);
	
	// Mark stones of this group as seki
	QListIterator<Stone *> it(*g);
	while (it.hasNext())
	{
		Stone *s = it.next();
		CHECK_PTR(s);
		if (seki && s->isDead())
			caps ++;
		s->setSeki(seki);
		if (seki)
		{
			s->togglePixmap(boardHandler->board->getImageHandler()->getGhostPixmaps(),
					false);
		}	
		else
		{
			s->togglePixmap(boardHandler->board->getImageHandler()->getStonePixmaps(),
					true);
		}
	}
	
	delete g;
	return true;
}
예제 #3
0
파일: stonehandler.cpp 프로젝트: rd8/qGo
bool StoneHandler::markSekiGroup(int x, int y, int &caps, StoneColor &col, bool &seki)
{
	if (hasStone(x, y) != 1)
		return false;
	
	Stone *s = getStoneAt(x, y);
	CHECK_PTR(s);
	col = s->getColor();
	
	if (!s->isSeki())
		seki = true;
	
	Group *g = assembleGroup(s, NULL);        //SL added eb 8
	CHECK_PTR(g);
	
	// Mark stones of this group as seki
	QListIterator<Stone> it(*g);
	for (; it.current(); ++it)
	{
		s = it.current();
		CHECK_PTR(s);
		if (seki && s->isDead())
			caps ++;
		s->setSeki(seki);
		if (seki)
		{
			s->setSequence(boardHandler->board->getImageHandler()->getGhostPixmaps());
			s->shadow->hide();
		}	
		else
		{
			s->setSequence(boardHandler->board->getImageHandler()->getStonePixmaps());
			s->shadow->show();
		}
	}
	
	delete g;
	return true;
}