//spread the octopuses
- QList<Octopus*> octopuses;
+ QList <Octopus*> octopusList;
for (int i=0; i < octopuses; i++)
{
movingItems_.append(pOctopus);
connect(this,SIGNAL(pauseOn()),pOctopus,SLOT(stopMoving()));
connect(this,SIGNAL(pauseOff()),pOctopus,SLOT(startMoving()));
- octopuses.append(pOctopus);
+ octopusList.append(pOctopus);
delete pPosition;
}
movingItems_.append(pShip);
connect(this,SIGNAL(pauseOn()),pShip,SLOT(stopMoving()));
connect(this,SIGNAL(pauseOff()),pShip,SLOT(startMoving()));
- foreach (Octopus* pOctopus, octopuses)
+ foreach (Octopus* pOctopus, octopusList)
{
connect(pOctopus,SIGNAL(droppingGhosts()),pShip,SLOT(dropAllGhosts()));
}
if (type == "rock" || type == "octopus")
{
// drop all ghosts when hitting an obstacle
- emit droppingGhosts(ghostsAboard_);
- ghostsAboard_ = 0;
- updateShipImage();
+
+ dropAllGhosts();
+
+ //go back to old position
return false;
}
}
}
+
+
+ return true; //execution can never reach here, this is just to stop the compiler from complaining
}
void Ship::updateShipImage()
void Ship::dropAllGhosts()
{
-//TODO
+
+ emit droppingGhosts(ghostsAboard_);
+ ghostsAboard_ = 0;
+ updateShipImage();
}
#include <QGraphicsPixmapItem>
#include <QTimer>
-class TimerControlledGraphisPixmapObject : public QObject, public QGraphicsPixmapItem
+class TimerControlledGraphicsPixmapObject : public QObject, public QGraphicsPixmapItem
{
Q_OBJECT
public: