Ajout de la vitesse

This commit is contained in:
Mylloon 2022-04-04 00:10:51 +02:00
parent 90c880b399
commit d3a76dccae
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
4 changed files with 29 additions and 22 deletions

View file

@ -4,14 +4,15 @@
#include "animal.hpp" #include "animal.hpp"
class Loup: public Animal { class Loup: public Animal {
int generationVitesse(void) const noexcept;
public: public:
Loup(void); Loup(int);
Loup(int, int, int);
~Loup(void); ~Loup(void);
// Renvoie vrai
bool carnivore(void) const noexcept; bool carnivore(void) const noexcept;
// Représenté par "2" dans l'univers
short id(void) const noexcept;
}; };
#endif #endif

View file

@ -4,14 +4,14 @@
#include "animal.hpp" #include "animal.hpp"
class Mouton: public Animal { class Mouton: public Animal {
int generationVitesse(void) const noexcept;
public: public:
Mouton(void); Mouton(int);
~Mouton(void); Mouton(int, int, int);
// Renvoie faux
bool carnivore(void) const noexcept; bool carnivore(void) const noexcept;
// Représenté par "1" dans l'univers
short id(void) const noexcept;
}; };
#endif #endif

View file

@ -1,15 +1,19 @@
#include "../includes/loup.hpp" #include "../includes/loup.hpp"
Loup::Loup(void): Animal() { Loup::Loup(int universID): Animal(universID, 60, 0, Loup::generationVitesse()) {
_correspondance[id()] = 'L'; _correspondance[ID] = 'L';
}
Loup::Loup(int universID, int x, int y): Animal(universID, x, y, 60, 0, Loup::generationVitesse()) {
_correspondance[ID] = 'L';
} }
Loup::~Loup(void) { } Loup::~Loup(void) { }
int Loup::generationVitesse(void) const noexcept {
return 0;
}
bool Loup::carnivore(void) const noexcept { bool Loup::carnivore(void) const noexcept {
return true; return true;
} }
short Loup::id(void) const noexcept {
return 2;
}

View file

@ -1,15 +1,17 @@
#include "../includes/mouton.hpp" #include "../includes/mouton.hpp"
Mouton::Mouton(void): Animal() { Mouton::Mouton(int universID): Animal(universID, 50, 0, Mouton::generationVitesse()) {
_correspondance[id()] = 'M'; _correspondance[ID] = 'M';
} }
Mouton::~Mouton(void) { } Mouton::Mouton(int universID, int x, int y): Animal(universID, x, y, 50, 0, Mouton::generationVitesse()) {
_correspondance[ID] = 'M';
}
int Mouton::generationVitesse(void) const noexcept {
return 0;
}
bool Mouton::carnivore(void) const noexcept { bool Mouton::carnivore(void) const noexcept {
return false; return false;
} }
short Mouton::id(void) const noexcept {
return 1;
}