848
848
gameOver(Game->MaxTileNum,cheatsUsed);
850
850
// else if no more moves are possible, display the sour grapes dialog
851
else if( ! Game->findMove( TimerPos1, TimerPos2 ) )
853
KMessageBox::information(this, i18n("Game over: You have no moves left."));
853
validMovesAvailable();
869
//-----------------------------------------------------------
870
KGameCanvasItem* BoardWidget::itemAt(const QPoint& point) const {
871
// Get the shadows...
872
// theTiles.width() == The whole tile width including offset and shadow.
873
// theTiles.qWidth() == Half of the width of the tile face (without the offset and the shadow).
874
// theTiles.levelOffsetX() == The level of the tile (the perspective height of the tile)
875
int shadowWidth = theTiles.width() - (theTiles.qWidth() * 2 + theTiles.levelOffsetX());
876
int shadowHeight = theTiles.height() - (theTiles.qHeight() * 2 + theTiles.levelOffsetY());
878
for (int i = m_items.size() - 1; i >= 0; i--) {
879
KGameCanvasItem *canvasItem = m_items[i];
881
// Cause of the shadow, that is not really a part of a tile. Correct the rect positions
882
// related to the angle. Actually we just correct the rect of the canvas item cause of the
883
// shadow, that is not part of the clickable tile.
884
QRect oldRect = canvasItem->rect();
885
QRect rectCorrection = oldRect;
887
// Correct the positions related to the angle we had set.
890
rectCorrection.setRect(oldRect.x() + shadowWidth, oldRect.y(),
891
oldRect.width() - shadowWidth, oldRect.height() - shadowHeight);
894
rectCorrection.setRect(oldRect.x(), oldRect.y(), oldRect.width() - shadowWidth,
895
oldRect.height() - shadowHeight);
898
rectCorrection.setRect(oldRect.x() + shadowWidth, oldRect.y() + shadowHeight,
899
oldRect.width() - shadowWidth, oldRect.height() - shadowHeight);
902
rectCorrection.setRect(oldRect.x(), oldRect.y() + shadowHeight,
903
oldRect.width() - shadowWidth, oldRect.height() - shadowHeight);
907
// if the canvas is visible and we click inside the corrected rect of the canvas item, we
908
// can return the actual canvas item.
909
if (canvasItem->visible() && rectCorrection.contains(point))
870
916
// ----------------------------------------------------------
1108
1154
// 300 points per use
1109
1155
cheatsUsed += 15;
1110
1156
drawTileNumber();
1158
// Test if any moves are available
1159
validMovesAvailable();
1162
bool BoardWidget::validMovesAvailable()
1164
if(!Game->findMove(TimerPos1, TimerPos2))
1166
KMessageBox::information(this, i18n("Game over: You have no moves left."));
1113
1173
QString BoardWidget::getLayoutName() {