pShip->setData(0,"ship");
pShip->setPos(*pPosition);
addItem(pShip);
+ connect(pShip,SIGNAL(pickingGhost(QGraphicsItem*)),this, SLOT(removeGhost(QGraphicsItem*)) );
pShip->startMoving();
delete pPosition;
}
return new QPointF (freeTiles_.takeAt(index));
}
+
+void SeaScene::removeGhost(QGraphicsItem *pGhost)
+{
+ removeItem(pGhost); //remove the item from scene
+ freeTiles_.append(pGhost->scenePos()); //add the item's position to free slots
+ delete pGhost;
+}