Commit 763a4b5c authored by Frederik Schwarzer's avatar Frederik Schwarzer

Get rid of parameter as it serves no purpose.

parent 9186c005
......@@ -217,13 +217,13 @@ int Board::field(TilePos const & tilePos) const
return m_field.at(tilePos.y() * xTiles() + tilePos.x());
}
void Board::gravity(bool update)
void Board::gravity()
{
if (!m_gravityFlag) {
return;
}
for (int i = 0; i < xTiles(); ++i) {
if (gravity(i, update)) {
if (gravity(i)) {
if (Prefs::sounds()) {
m_soundFall.start();
}
......@@ -231,30 +231,26 @@ void Board::gravity(bool update)
}
}
bool Board::gravity(int column, bool update)
bool Board::gravity(int column)
{
bool isAffected = false;
if (m_gravityFlag) {
int rptr = yTiles() - 1;
int wptr = yTiles() - 1;
while (rptr >= 0) {
if (field(TilePos(column, wptr)) != EMPTY) {
--rptr;
int rptr = yTiles() - 1;
int wptr = yTiles() - 1;
while (rptr >= 0) {
if (field(TilePos(column, wptr)) != EMPTY) {
--rptr;
--wptr;
} else {
if (field(TilePos(column, rptr)) != EMPTY) {
setField(TilePos(column, wptr), field(TilePos(column, rptr)));
setField(TilePos(column, rptr), EMPTY);
updateField(TilePos(column, rptr));
updateField(TilePos(column, wptr));
--wptr;
--rptr;
isAffected = true;
} else {
if (field(TilePos(column, rptr)) != EMPTY) {
setField(TilePos(column, wptr), field(TilePos(column, rptr)));
setField(TilePos(column, rptr), EMPTY);
isAffected = true;
if (update) {
updateField(TilePos(column, rptr));
updateField(TilePos(column, wptr));
}
--wptr;
--rptr;
} else {
--rptr;
}
--rptr;
}
}
}
......@@ -1336,7 +1332,7 @@ void Board::undrawConnection()
emit tileCountChanged();
}
gravity(true); // why is this called here? (schwarzer)
gravity(); // why is this called here? (schwarzer)
// is already undrawn?
if (m_connection.empty()) {
......@@ -1663,7 +1659,7 @@ void Board::redo()
setField(TilePos(move->x2(), move->y2()), EMPTY);
updateField(TilePos(move->x1(), move->y1()));
updateField(TilePos(move->x2(), move->y2()));
gravity(true);
gravity();
m_undo.push_back(move);
emit changed();
}
......
......@@ -193,9 +193,9 @@ private slots:
/** Returns whether the given column is affected by gravity.
* @param column The column to check
* @param update FIXME: What is it for?
* @return If column was affected.
*/
bool gravity(int column, bool update);
bool gravity(int column);
protected:
virtual QSize sizeHint() const;
......@@ -268,10 +268,9 @@ private: // functions
void marked(TilePos const & tilePos);
void madeMove(TilePos const & tilePos1, TilePos const & tilePos2, Path slide = Path());
/** Checks all columns and populate the affected columns in m_gravCols.
* @param update FIXME: What is it for?
/** Applies gravity to all columns.
*/
void gravity(bool update);
void gravity();
/** Returns True if @p tilePos is a valid position on Board.
* @return Wether @p tiePos is valid.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment