free memory

This commit is contained in:
Mylloon 2023-11-24 20:34:22 +01:00
parent 8143fa3a85
commit 2af8608de8
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -1,6 +1,7 @@
#include "../includes/Plateau.hpp" #include "../includes/Plateau.hpp"
Plateau::Plateau(int t) { Plateau::Plateau(int t) {
// Création du plateau vide
plateau = new Piece **[t]; plateau = new Piece **[t];
for (int i = 0; i < t; i++) { for (int i = 0; i < t; i++) {
plateau[i] = new Piece *[t]; plateau[i] = new Piece *[t];
@ -10,7 +11,12 @@ Plateau::Plateau(int t) {
} }
} }
Plateau::~Plateau() {} Plateau::~Plateau() {
for (int i = 0; i < taille; i++) {
delete[] plateau[i];
}
delete[] plateau;
}
Plateau::Plateau(const Plateau &) {} Plateau::Plateau(const Plateau &) {}