passant linters a vore si trobe variables sense inicialitzar
This commit is contained in:
@@ -81,13 +81,13 @@ Game::Game(Player::Id player_id, int current_stage, bool demo)
|
||||
fade_in_->setColor(param.fade.color);
|
||||
fade_in_->setPreDuration(demo_.enabled ? 80 : 0);
|
||||
fade_in_->setPostDuration(0);
|
||||
fade_in_->setType(FadeType::RANDOM_SQUARE);
|
||||
fade_in_->setMode(FadeMode::IN);
|
||||
fade_in_->setType(Fade::Type::RANDOM_SQUARE);
|
||||
fade_in_->setMode(Fade::Mode::IN);
|
||||
fade_in_->activate();
|
||||
|
||||
fade_out_->setColor(param.fade.color);
|
||||
fade_out_->setPostDuration(param.fade.post_duration);
|
||||
fade_out_->setType(FadeType::VENETIAN);
|
||||
fade_out_->setType(Fade::Type::VENETIAN);
|
||||
|
||||
background_->setPos(param.game.play_area.rect);
|
||||
|
||||
@@ -230,7 +230,7 @@ void Game::updatePlayers() {
|
||||
handlePlayerCollision(player, balloon);
|
||||
|
||||
if (demo_.enabled && allPlayersAreNotPlaying()) {
|
||||
fade_out_->setType(FadeType::RANDOM_SQUARE);
|
||||
fade_out_->setType(Fade::Type::RANDOM_SQUARE);
|
||||
fade_out_->activate();
|
||||
}
|
||||
}
|
||||
@@ -549,7 +549,7 @@ void Game::checkBulletCollision() {
|
||||
}
|
||||
|
||||
// Maneja la colisión entre bala y Tabe
|
||||
auto Game::checkBulletTabeCollision(std::shared_ptr<Bullet> bullet) -> bool {
|
||||
auto Game::checkBulletTabeCollision(const std::shared_ptr<Bullet> &bullet) -> bool {
|
||||
if (!tabe_->isEnabled()) {
|
||||
return false;
|
||||
}
|
||||
@@ -581,7 +581,7 @@ void Game::handleTabeHitEffects() {
|
||||
}
|
||||
|
||||
// Maneja la colisión entre bala y globos
|
||||
auto Game::checkBulletBalloonCollision(std::shared_ptr<Bullet> bullet) -> bool {
|
||||
auto Game::checkBulletBalloonCollision(const std::shared_ptr<Bullet> &bullet) -> bool {
|
||||
for (auto &balloon : balloon_manager_->getBalloons()) {
|
||||
if (!balloon->isEnabled() || balloon->isInvulnerable()) {
|
||||
continue;
|
||||
@@ -598,7 +598,7 @@ auto Game::checkBulletBalloonCollision(std::shared_ptr<Bullet> bullet) -> bool {
|
||||
}
|
||||
|
||||
// Procesa el impacto en un globo
|
||||
void Game::processBalloonHit(std::shared_ptr<Bullet> bullet, std::shared_ptr<Balloon> balloon) {
|
||||
void Game::processBalloonHit(const std::shared_ptr<Bullet> &bullet, const std::shared_ptr<Balloon> &balloon) {
|
||||
auto player = getPlayer(bullet->getOwner());
|
||||
|
||||
handleItemDrop(balloon, player);
|
||||
@@ -608,7 +608,7 @@ void Game::processBalloonHit(std::shared_ptr<Bullet> bullet, std::shared_ptr<Bal
|
||||
}
|
||||
|
||||
// Maneja la caída de items cuando se destruye un globo
|
||||
void Game::handleItemDrop(std::shared_ptr<Balloon> balloon, std::shared_ptr<Player> player) {
|
||||
void Game::handleItemDrop(const std::shared_ptr<Balloon> &balloon, const std::shared_ptr<Player> &player) {
|
||||
const auto DROPPED_ITEM = dropItem();
|
||||
if (DROPPED_ITEM == ItemType::NONE || demo_.recording) {
|
||||
return;
|
||||
@@ -623,9 +623,9 @@ void Game::handleItemDrop(std::shared_ptr<Balloon> balloon, std::shared_ptr<Play
|
||||
}
|
||||
|
||||
// Maneja la destrucción del globo y puntuación
|
||||
void Game::handleBalloonDestruction(std::shared_ptr<Balloon> balloon, std::shared_ptr<Player> player) {
|
||||
void Game::handleBalloonDestruction(std::shared_ptr<Balloon> balloon, const std::shared_ptr<Player> &player) {
|
||||
if (player->isPlaying()) {
|
||||
auto const SCORE = balloon_manager_->popBalloon(balloon) * player->getScoreMultiplier() * difficulty_score_multiplier_;
|
||||
auto const SCORE = balloon_manager_->popBalloon(std::move(balloon)) * player->getScoreMultiplier() * difficulty_score_multiplier_;
|
||||
player->addScore(SCORE, Options::settings.hi_score_table.back().score);
|
||||
player->incScoreMultiplier();
|
||||
}
|
||||
@@ -758,7 +758,7 @@ void Game::freeItems() {
|
||||
}
|
||||
|
||||
// Crea un objeto PathSprite
|
||||
void Game::createItemText(int x, std::shared_ptr<Texture> texture) {
|
||||
void Game::createItemText(int x, const std::shared_ptr<Texture> &texture) {
|
||||
path_sprites_.emplace_back(std::make_unique<PathSprite>(texture));
|
||||
|
||||
const auto W = texture->getWidth();
|
||||
@@ -781,7 +781,7 @@ void Game::createItemText(int x, std::shared_ptr<Texture> texture) {
|
||||
}
|
||||
|
||||
// Crea un objeto PathSprite
|
||||
void Game::createMessage(const std::vector<Path> &paths, std::shared_ptr<Texture> texture) {
|
||||
void Game::createMessage(const std::vector<Path> &paths, const std::shared_ptr<Texture> &texture) {
|
||||
path_sprites_.emplace_back(std::make_unique<PathSprite>(texture));
|
||||
|
||||
// Inicializa
|
||||
@@ -1239,7 +1239,7 @@ void Game::checkInput() {
|
||||
// Verifica si alguno de los controladores ha solicitado una pausa y actualiza el estado de pausa del juego.
|
||||
void Game::checkPauseInput() {
|
||||
// Comprueba los mandos
|
||||
for (auto gamepad : input_->getGamepads()) {
|
||||
for (const auto &gamepad : input_->getGamepads()) {
|
||||
if (input_->checkAction(Input::Action::PAUSE, Input::DO_NOT_ALLOW_REPEAT, Input::DO_NOT_CHECK_KEYBOARD, gamepad)) {
|
||||
pause_manager_->togglePlayerPause();
|
||||
return;
|
||||
@@ -1616,7 +1616,7 @@ void Game::initPlayers(Player::Id player_id) {
|
||||
}
|
||||
|
||||
// Registra los jugadores en Options
|
||||
for (auto player : players_) {
|
||||
for (const auto &player : players_) {
|
||||
Options::keyboard.addPlayer(player);
|
||||
Options::gamepad_manager.addPlayer(player);
|
||||
}
|
||||
@@ -1660,7 +1660,7 @@ void Game::updateDemo() {
|
||||
|
||||
// Activa el fundido antes de acabar con los datos de la demo
|
||||
if (demo_.counter == TOTAL_DEMO_DATA - 200) {
|
||||
fade_out_->setType(FadeType::RANDOM_SQUARE);
|
||||
fade_out_->setType(Fade::Type::RANDOM_SQUARE);
|
||||
fade_out_->activate();
|
||||
}
|
||||
|
||||
@@ -1777,11 +1777,11 @@ void Game::updateMenace() {
|
||||
}
|
||||
|
||||
const auto &stage = current_stage.value();
|
||||
const double fraction = stage_manager_->getCurrentStageProgressFraction();
|
||||
const int difference = stage.getMaxMenace() - stage.getMinMenace();
|
||||
const double FRACTION = stage_manager_->getCurrentStageProgressFraction();
|
||||
const int DIFFERENCE = stage.getMaxMenace() - stage.getMinMenace();
|
||||
|
||||
// Aumenta el nivel de amenaza en función del progreso de la fase
|
||||
menace_threshold_ = stage.getMinMenace() + (difference * fraction);
|
||||
menace_threshold_ = stage.getMinMenace() + (DIFFERENCE * FRACTION);
|
||||
|
||||
if (menace_ < menace_threshold_) {
|
||||
balloon_manager_->deployRandomFormation(stage_manager_->getCurrentStageIndex());
|
||||
@@ -1940,14 +1940,14 @@ void Game::handleDebugEvents(const SDL_Event &event) {
|
||||
++formation_id_;
|
||||
balloon_manager_->destroyAllBalloons();
|
||||
balloon_manager_->deployFormation(formation_id_);
|
||||
std::cout << formation_id_ << std::endl;
|
||||
std::cout << formation_id_ << '\n';
|
||||
break;
|
||||
}
|
||||
case SDLK_KP_MINUS: {
|
||||
--formation_id_;
|
||||
balloon_manager_->destroyAllBalloons();
|
||||
balloon_manager_->deployFormation(formation_id_);
|
||||
std::cout << formation_id_ << std::endl;
|
||||
std::cout << formation_id_ << '\n';
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user