From 5466ae7a5fd66ecf93146899651ff1185cc60fb4 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 12 Apr 2022 09:47:44 +0200 Subject: [PATCH] =?UTF-8?q?V=C3=A9rification=20plus=20rapide=20si=20l'univ?= =?UTF-8?q?ers=20est=20mort=20ou=20non?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/univers.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/univers.cpp b/src/univers.cpp index 58d007b..c57e3ed 100644 --- a/src/univers.cpp +++ b/src/univers.cpp @@ -40,10 +40,8 @@ void Univers::melange(std::vector * vecteur) { } bool Univers::enVie(void) const noexcept { - for(auto organisme: m_organismes_univers[ID]) { // on parcours les organismes de notre univers - if(dynamic_cast(organisme)) { // si c'est un animal - return true; // renvoie true - } + if(m_index_libres_univers[ID].second.size() == static_cast(m_taille_univers)) { // si toutes les places animals sont libres + return false; // aucun animal n'est en vie, univers mort } - return false; // sinon renvoie false + return true; // sinon l'univers est vivant }