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; }
bool StoneHandler::removeDeadGroup(int x, int y, int &caps, StoneColor &col, bool &dead) { if (hasStone(x, y) != 1) return false; Stone *s = getStoneAt(x, y); CHECK_PTR(s); col = s->getColor(); if (!s->isDead()) dead = true; Group *g = assembleGroup(s, NULL); //SL added eb 8 CHECK_PTR(g); caps = g->count(); // Mark stones of this group as dead or alive again QListIterator<Stone *> it(*g); while (it.hasNext()) { Stone *s = it.next(); CHECK_PTR(s); s->setDead(dead); if (dead) { s->togglePixmap(boardHandler->board->getImageHandler()->getGhostPixmaps(), false); } else { s->togglePixmap(boardHandler->board->getImageHandler()->getStonePixmaps(), true); } } delete g; return true; }
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; } }