projects
/
colorflood
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
new game/toggle fullscreen buttons
[colorflood]
/
colorflood
/
src
/
field.cpp
diff --git
a/colorflood/src/field.cpp
b/colorflood/src/field.cpp
index
6348d8f
..
44e3259
100644
(file)
--- a/
colorflood/src/field.cpp
+++ b/
colorflood/src/field.cpp
@@
-189,12
+189,6
@@
void Field::floodNeighbours (quint8 brush, int x, int y)
tryFloodRecurse(brush, x, y + 1);
}
tryFloodRecurse(brush, x, y + 1);
}
-void Field::mousePressEvent (QMouseEvent *event)
-{
- if (event->button() == Qt::LeftButton)
- randomize();
-}
-
void Field::paintEvent (QPaintEvent *event)
{
QPainter painter;
void Field::paintEvent (QPaintEvent *event)
{
QPainter painter;
@@
-243,7
+237,7
@@
void Field::flood (int colorIndex)
}
}
}
}
- update();
+ repaint();
bool allFlooded = true;
bool allFlooded = true;
@@
-259,20
+253,26
@@
void Field::flood (int colorIndex)
}
}
}
}
+ QString msg;
+
if (allFlooded)
{
finished = true;
if (allFlooded)
{
finished = true;
-
- QMessageBox box;
- box.setText(tr("You won!"));
- box.exec();
+ /*: win message */
+ msg = tr("You won!");
}
else if (getNumTurnsOfSize(size) == turns)
{
finished = true;
}
else if (getNumTurnsOfSize(size) == turns)
{
finished = true;
+ /*: fail message */
+ msg = tr("You lost!");
+ }
+ if (finished)
+ {
QMessageBox box;
QMessageBox box;
- box.setText(tr("You lost!"));
+ box.setText(msg);
box.exec();
box.exec();
+ randomize();
}
}
}
}