Ajout direct des animaux dans l'univers
This commit is contained in:
parent
4929d5a997
commit
e46626e061
1 changed files with 4 additions and 11 deletions
15
src/main.cpp
15
src/main.cpp
|
@ -5,21 +5,14 @@
|
|||
void lancerSimulation(Univers ** univers, int m, int n, int nb_moutons, int nb_loups) {
|
||||
*univers = new Univers(m, n);
|
||||
|
||||
std::vector<Animal*> animaux;
|
||||
|
||||
while(nb_moutons > 0) {
|
||||
animaux.push_back(new Mouton((*univers)->ID));
|
||||
while(nb_moutons > 0) { // Création des moutons dans l'univers
|
||||
new Mouton((*univers)->ID);
|
||||
nb_moutons--;
|
||||
}
|
||||
while(nb_loups > 0) {
|
||||
animaux.push_back(new Loup((*univers)->ID));
|
||||
while(nb_loups > 0) { // Création des loups dans l'univers
|
||||
new Loup((*univers)->ID);
|
||||
nb_loups--;
|
||||
}
|
||||
|
||||
(*univers)->ajoutAnimaux(animaux);
|
||||
|
||||
for(Animal *const &animal: animaux)
|
||||
delete animal;
|
||||
}
|
||||
|
||||
void arreterSimulation(Univers * univers) {
|
||||
|
|
Reference in a new issue