This repository has been archived on 2023-11-03. You can view files and clone it, but cannot push or open issues or pull requests.
GINPA/Controleur/destruction.c

39 lines
797 B
C

#include "destruction.h"
void freeTabGeneric(void ***tab, uint32_t nbElements)
{
for(uint32_t i = 0; i < nbElements; i++)
{
free((*tab)[i]);
(*tab)[i] = NULL;
}
free(*tab);
*tab = NULL;
}
void detruireCarte(sfTexture **mapTexture, sfSprite **mapSprite, const char *const cheminFichier)
{
sfTexture_destroy(*mapTexture);
*mapTexture = NULL;
sfSprite_destroy(*mapSprite);
*mapSprite = NULL;
if(remove(cheminFichier) == -1)
{
fprintf(stderr, "Le fichier \"%s\" n\'a pas pu être correctement supprimé: %s\n", cheminFichier, strerror(errno));
}
}
void detruireCercles(const uint32_t nbElements, sfCircleShape *tabPointeursCercle[nbElements])
{
for(uint32_t i = 0; i < nbElements; i++)
{
sfCircleShape_destroy(tabPointeursCercle[i]);
tabPointeursCercle[i] = NULL;
}
}