fix: bucles cap a ranges algorithms (38 troballes)
This commit is contained in:
@@ -1425,11 +1425,11 @@ auto MapEditor::deleteRoom() -> std::string { // NOLINT(readability-function-co
|
||||
|
||||
if (target == "0") {
|
||||
// Buscar la primera room que no sea esta
|
||||
for (const auto& r : Resource::Cache::get()->getRooms()) {
|
||||
if (r.name != deleted_name) {
|
||||
target = r.name;
|
||||
break;
|
||||
}
|
||||
const auto& rooms = Resource::Cache::get()->getRooms();
|
||||
auto it = std::ranges::find_if(rooms,
|
||||
[&deleted_name](const auto& r) { return r.name != deleted_name; });
|
||||
if (it != rooms.end()) {
|
||||
target = it->name;
|
||||
}
|
||||
}
|
||||
if (target == "0") { return "Cannot delete: no other room to navigate to"; }
|
||||
|
||||
Reference in New Issue
Block a user