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"
class Loup: public Animal {
int generationVitesse(void) const noexcept;
public:
Loup(void);
Loup(int);
Loup(int, int, int);
~Loup(void);
// Renvoie vrai
bool carnivore(void) const noexcept;
// Représenté par "2" dans l'univers
short id(void) const noexcept;
};
#endif

View file

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

View file

@ -1,15 +1,19 @@
#include "../includes/loup.hpp"
Loup::Loup(void): Animal() {
_correspondance[id()] = 'L';
Loup::Loup(int universID): Animal(universID, 60, 0, Loup::generationVitesse()) {
_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) { }
int Loup::generationVitesse(void) const noexcept {
return 0;
}
bool Loup::carnivore(void) const noexcept {
return true;
}
short Loup::id(void) const noexcept {
return 2;
}

View file

@ -1,15 +1,17 @@
#include "../includes/mouton.hpp"
Mouton::Mouton(void): Animal() {
_correspondance[id()] = 'M';
Mouton::Mouton(int universID): Animal(universID, 50, 0, Mouton::generationVitesse()) {
_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 {
return false;
}
short Mouton::id(void) const noexcept {
return 1;
}