- else
- throw std::runtime_error("wrong bullet type.");
- add_object(new_bullet);
-
- sound_manager->play_sound(sounds[SND_SHOOT]);
-
- return true;
-}
-
-/* Break a brick: */
-bool
-Sector::trybreakbrick(const Vector& pos, bool small)
-{
- Tile* tile = solids->get_tile_at(pos);
- if (!tile)
- {
- char errmsg[64];
- sprintf(errmsg, "Invalid tile at %i,%i", (int)((pos.x+1)/32*32), (int)((pos.y+1)/32*32));
- throw SuperTuxException(errmsg, __FILE__, __LINE__);
- }
-
- if (tile->attributes & Tile::BRICK)
- {
- if (tile->data > 0)
- {
- /* Get a distro from it: */
- add_bouncy_distro(
- Vector(((int)(pos.x + 1) / 32) * 32, (int)(pos.y / 32) * 32));
-
- // TODO: don't handle this in a global way but per-tile...
- if (!counting_distros)
- {
- counting_distros = true;
- distro_counter = 5;
- }
- else
- {
- distro_counter--;
- }
-
- if (distro_counter <= 0)
- {
- counting_distros = false;
- solids->change_at(pos, tile->next_tile);
- }
-
- sound_manager->play_sound(sounds[SND_DISTRO]);
- player_status.score = player_status.score + SCORE_DISTRO;
- player_status.distros++;
- return true;
- }
- else if (!small)
- {
- /* Get rid of it: */
- solids->change_at(pos, tile->next_tile);
-
- /* Replace it with broken bits: */
- add_broken_brick(Vector(
- ((int)(pos.x + 1) / 32) * 32,
- (int)(pos.y / 32) * 32), tile);
-
- /* Get some score: */
- sound_manager->play_sound(sounds[SND_BRICK]);
- player_status.score = player_status.score + SCORE_BRICK;
-
- return true;
- }
- }
-
- return false;
-}
-
-/* Empty a box: */
-void
-Sector::tryemptybox(const Vector& pos, Direction col_side)
-{
- Tile* tile = solids->get_tile_at(pos);
- if (!tile)
- {
- char errmsg[64];
- sprintf(errmsg, "Invalid tile at %i,%i", (int)((pos.x+1)/32*32), (int)((pos.y+1)/32*32));
- throw SuperTuxException(errmsg, __FILE__, __LINE__);