clang-tidy modernize
This commit is contained in:
@@ -13,22 +13,22 @@ void ManageHiScoreTable::clear() {
|
||||
table_.clear();
|
||||
|
||||
// Añade 10 entradas predefinidas
|
||||
table_.push_back(HiScoreEntry("BRY", 1000000));
|
||||
table_.push_back(HiScoreEntry("USUFO", 500000));
|
||||
table_.push_back(HiScoreEntry("GLUCA", 100000));
|
||||
table_.push_back(HiScoreEntry("PARRA", 50000));
|
||||
table_.push_back(HiScoreEntry("CAGAM", 10000));
|
||||
table_.push_back(HiScoreEntry("PEPE", 5000));
|
||||
table_.push_back(HiScoreEntry("ROSIT", 1000));
|
||||
table_.push_back(HiScoreEntry("SAM", 500));
|
||||
table_.push_back(HiScoreEntry("PACMQ", 200));
|
||||
table_.push_back(HiScoreEntry("PELEC", 100));
|
||||
table_.emplace_back("BRY", 1000000);
|
||||
table_.emplace_back("USUFO", 500000);
|
||||
table_.emplace_back("GLUCA", 100000);
|
||||
table_.emplace_back("PARRA", 50000);
|
||||
table_.emplace_back("CAGAM", 10000);
|
||||
table_.emplace_back("PEPE", 5000);
|
||||
table_.emplace_back("ROSIT", 1000);
|
||||
table_.emplace_back("SAM", 500);
|
||||
table_.emplace_back("PACMQ", 200);
|
||||
table_.emplace_back("PELEC", 100);
|
||||
|
||||
sort();
|
||||
}
|
||||
|
||||
// Añade un elemento a la tabla
|
||||
int ManageHiScoreTable::add(const HiScoreEntry &entry) {
|
||||
auto ManageHiScoreTable::add(const HiScoreEntry &entry) -> int {
|
||||
// Añade la entrada a la tabla
|
||||
table_.push_back(entry);
|
||||
|
||||
@@ -63,14 +63,14 @@ int ManageHiScoreTable::add(const HiScoreEntry &entry) {
|
||||
void ManageHiScoreTable::sort() {
|
||||
struct
|
||||
{
|
||||
bool operator()(const HiScoreEntry &a, const HiScoreEntry &b) const { return a.score > b.score; }
|
||||
auto operator()(const HiScoreEntry &a, const HiScoreEntry &b) const -> bool { return a.score > b.score; }
|
||||
} score_descending_comparator;
|
||||
|
||||
std::sort(table_.begin(), table_.end(), score_descending_comparator);
|
||||
}
|
||||
|
||||
// Carga la tabla desde un fichero
|
||||
bool ManageHiScoreTable::loadFromFile(const std::string &file_path) {
|
||||
auto ManageHiScoreTable::loadFromFile(const std::string &file_path) -> bool {
|
||||
clear();
|
||||
auto success = true;
|
||||
auto file = SDL_IOFromFile(file_path.c_str(), "rb");
|
||||
@@ -117,7 +117,7 @@ bool ManageHiScoreTable::loadFromFile(const std::string &file_path) {
|
||||
}
|
||||
|
||||
// Guarda la tabla en un fichero
|
||||
bool ManageHiScoreTable::saveToFile(const std::string &file_path) {
|
||||
auto ManageHiScoreTable::saveToFile(const std::string &file_path) -> bool {
|
||||
auto success = true;
|
||||
auto file = SDL_IOFromFile(file_path.c_str(), "w+b");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user