fix: el nom apareixia duplicat en la tabla de records
This commit is contained in:
@@ -24,8 +24,8 @@ Player::Player(const Config &config)
|
||||
: player_sprite_(std::make_unique<AnimatedSprite>(config.texture.at(0), config.animations.at(0))),
|
||||
power_sprite_(std::make_unique<AnimatedSprite>(config.texture.at(4), config.animations.at(1))),
|
||||
enter_name_(std::make_unique<EnterName>()),
|
||||
hi_score_table_(*config.hi_score_table),
|
||||
glowing_entry_(*config.glowing_entry),
|
||||
hi_score_table_(config.hi_score_table),
|
||||
glowing_entry_(config.glowing_entry),
|
||||
play_area_(*config.play_area),
|
||||
id_(config.id),
|
||||
default_pos_x_(config.x),
|
||||
@@ -929,14 +929,22 @@ void Player::playSound(const std::string &name) const {
|
||||
|
||||
// Indica si se puede dibujar el objeto
|
||||
auto Player::isRenderable() const -> bool {
|
||||
//return !isGameOver() && !isTitleHidden();
|
||||
// return !isGameOver() && !isTitleHidden();
|
||||
return !isTitleHidden();
|
||||
};
|
||||
|
||||
// Añade una puntuación a la tabla de records
|
||||
void Player::addScoreToScoreBoard() const {
|
||||
if (hi_score_table_ == nullptr) {
|
||||
return; // Verificar esto antes de crear el manager
|
||||
}
|
||||
|
||||
const auto ENTRY = HiScoreEntry(trim(getLastEnterName()), getScore(), get1CC());
|
||||
auto manager = std::make_unique<ManageHiScoreTable>(hi_score_table_);
|
||||
glowing_entry_ = manager->add(ENTRY);
|
||||
auto manager = std::make_unique<ManageHiScoreTable>(*hi_score_table_);
|
||||
|
||||
if (glowing_entry_ != nullptr) {
|
||||
*glowing_entry_ = manager->add(ENTRY);
|
||||
}
|
||||
|
||||
manager->saveToFile(Asset::get()->get("score.bin"));
|
||||
}
|
||||
Reference in New Issue
Block a user