fix: bucles cap a ranges algorithms (38 troballes)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <cmath> // Para std::sqrt, std::min
|
||||
#include <numeric> // Para std::accumulate
|
||||
#include <utility>
|
||||
#include <vector> // Para vector
|
||||
|
||||
@@ -865,14 +866,9 @@ auto Game::checkEndGame() -> bool {
|
||||
|
||||
// Obtiene la cantidad total de items que hay en el mapeado del juego
|
||||
auto Game::getTotalItems() -> int {
|
||||
int items = 0;
|
||||
auto rooms = Resource::Cache::get()->getRooms();
|
||||
|
||||
for (const auto& room : rooms) {
|
||||
items += room.room->items.size();
|
||||
}
|
||||
|
||||
return items;
|
||||
const auto& rooms = Resource::Cache::get()->getRooms();
|
||||
return static_cast<int>(std::accumulate(rooms.begin(), rooms.end(), size_t{0},
|
||||
[](size_t acc, const auto& room) { return acc + room.room->items.size(); }));
|
||||
}
|
||||
|
||||
// Pone el juego en pausa
|
||||
|
||||
Reference in New Issue
Block a user