// remove all stored tiles void GameField::removeTiles(const ScoredTile& tile) { // delete in column if ( tile.isUp() ) { // std::cout << "GameField::removeTiles() delete col: " // << tile.getPos().x() << " " // << tile.getPos().y() << " till " // << tile.getPos().x() << " " // << tile.getPos().y()+tile.getLength()-1 // << std::endl; for ( unsigned int j = 0; j < tile.getLength(); j++ ) { m_field[tile.getPos().x()][tile.getPos().y()+j].setEmpty(); } } else if ( tile.isRight() ) { // std::cout << "GameField::removeTiles() delete row: " // << tile.getPos().x() << " " // << tile.getPos().y() << " till " // << tile.getPos().x()+tile.getLength()-1 << " " // << tile.getPos().y() // << std::endl; for ( unsigned int i = 0; i < tile.getLength(); i++ ) { m_field[tile.getPos().x()+i][tile.getPos().y()].setEmpty(); } } else { std::cout << "GameField::removeSameTiles() error: unknown direction" << std::endl; } }
// add points from removed tile void Player::addPoints(const ScoredTile& tile) { if ( tile.getTile().isBomb() ) { // direct damage from bomb for opponent m_bombDamage += tile.getBombValue(); #ifdef DEBUG std::cout << "Player::addPoints() info: " << "add " << tile.getBombValue() << " bomb damage" << std::endl; #endif } else { switch ( tile.getTile().getType() ) { case Tile::TILE_RED: m_redPoints += tile.getLength(); #ifdef DEBUG std::cout << "Player::addPoints() info: " << "add " << tile.getLength() << " red points" << std::endl; #endif break; case Tile::TILE_GREEN: m_greenPoints += tile.getLength(); #ifdef DEBUG std::cout << "Player::addPoints() info: " << "add " << tile.getLength() << " green points" << std::endl; #endif break; case Tile::TILE_YELLOW: m_yellowPoints += tile.getLength(); #ifdef DEBUG std::cout << "Player::addPoints() info: " << "add " << tile.getLength() << " yellow points" << std::endl; #endif break; case Tile::TILE_LILAC: m_lilacPoints += tile.getLength(); #ifdef DEBUG std::cout << "Player::addPoints() info: " << "add " << tile.getLength() << " lilac points" << std::endl; #endif break; case Tile::TILE_SHIELD: addShield(tile.getLength()); #ifdef DEBUG std::cout << "Player::addPoints() info: " << "add " << tile.getLength() << " shield" << std::endl; #endif break; default: break; } } }