From a93147276a815f21bdbea3ce19edb42dd88591cd Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 12 Apr 2022 09:57:20 +0200 Subject: [PATCH] Supprime les #include superflues --- includes/animal.hpp | 4 +--- includes/evenement.hpp | 5 ++--- includes/sel.hpp | 2 +- includes/univers.hpp | 3 +-- src/animal.cpp | 3 --- src/main.cpp | 1 - src/organisme.cpp | 4 +++- src/sel.cpp | 1 - 8 files changed, 8 insertions(+), 15 deletions(-) diff --git a/includes/animal.hpp b/includes/animal.hpp index 1567ad9..0fb5dac 100644 --- a/includes/animal.hpp +++ b/includes/animal.hpp @@ -1,9 +1,7 @@ #ifndef ECOSYSTEME_ANIMAL_HPP #define ECOSYSTEME_ANIMAL_HPP 1 -#include - -#include "organisme.hpp" +#include "univers.hpp" /* Un animal possède une vitesse, plus il est rapide, * plus vite il se déplacera à chaque tour, par exemple : diff --git a/includes/evenement.hpp b/includes/evenement.hpp index 4dce5f7..2a7ca19 100644 --- a/includes/evenement.hpp +++ b/includes/evenement.hpp @@ -3,9 +3,8 @@ #include -#include "../includes/univers.hpp" -#include "../includes/mouton.hpp" -#include "../includes/loup.hpp" +#include "mouton.hpp" +#include "loup.hpp" struct Evenement { Evenement() = delete; diff --git a/includes/sel.hpp b/includes/sel.hpp index d39756f..cd10216 100644 --- a/includes/sel.hpp +++ b/includes/sel.hpp @@ -1,7 +1,7 @@ #ifndef ECOSYSTEME_SEL_HPP #define ECOSYSTEME_SEL_HPP 1 -#include "organisme.hpp" +#include "herbe.hpp" class Sel: public Organisme { const char _m_lettre = '-'; // caractère représentant le sel diff --git a/includes/univers.hpp b/includes/univers.hpp index 4c13c1a..bb8e2bb 100644 --- a/includes/univers.hpp +++ b/includes/univers.hpp @@ -2,9 +2,8 @@ #define ECOSYSTEME_UNIVERS_HPP 1 #include +#include -#include "animal.hpp" -#include "organisme.hpp" #include "herbe.hpp" class Univers { diff --git a/src/animal.cpp b/src/animal.cpp index 1c32530..093f591 100644 --- a/src/animal.cpp +++ b/src/animal.cpp @@ -1,7 +1,4 @@ #include "../includes/animal.hpp" -#include "../includes/univers.hpp" - -#include Animal::Animal(const int univers_ID, const int index, const int age_max, const int faim_max, const int p_vitesse): Organisme(univers_ID, false, index), diff --git a/src/main.cpp b/src/main.cpp index 78d8fb3..675b798 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,5 @@ #include -#include "../includes/univers.hpp" #include "../includes/evenement.hpp" void erreurArguments(char const * nom_programme) { diff --git a/src/organisme.cpp b/src/organisme.cpp index cf02c64..a3f546e 100644 --- a/src/organisme.cpp +++ b/src/organisme.cpp @@ -1,5 +1,7 @@ -#include "../includes/univers.hpp" #include "../includes/organisme.hpp" +#include "../includes/univers.hpp" // on import ici et pas dans le .hpp car l'univers importe lui meme + // organisme.hpp, donc si on importe univers.hpp dans organisme.hpp + // alors univers.hpp ne pourra pas s'initalisé correctement Organisme::Organisme(const int univers_ID, const bool superposable, const int index): m_univers_ID(univers_ID), m_index(index), ID(m_total_ID + 1) { // S'il n'y a plus d'index de libres diff --git a/src/sel.cpp b/src/sel.cpp index 9cf71b8..491fd7c 100644 --- a/src/sel.cpp +++ b/src/sel.cpp @@ -1,5 +1,4 @@ #include "../includes/sel.hpp" -#include "../includes/univers.hpp" Sel::Sel(const int univers_ID, const int index): Organisme(univers_ID, true, index) { m_correspondance[ID] = _m_lettre;