summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c5
-rw-r--r--menuchoixpersos.c23
2 files changed, 16 insertions, 12 deletions
diff --git a/main.c b/main.c
index e6fc307..3167cb0 100644
--- a/main.c
+++ b/main.c
@@ -298,10 +298,7 @@ void Fdechargerimages (SURFACES *surfaces)//dechargement des surfaces alouées
SDL_FreeSurface(surfaces->Ppmcible);
SDL_FreeSurface(surfaces->Ppvpersos);
SDL_FreeSurface(surfaces->Ppmpersos);
- for(i = 0;i < 3;i++)
- {
- SDL_FreeSurface(surfaces->Tperso[i]);
- }
+
for(i=0;i<3;i++)
{
SDL_FreeSurface (surfaces->Pnomactions[i]);
diff --git a/menuchoixpersos.c b/menuchoixpersos.c
index 2d20ef2..7790255 100644
--- a/menuchoixpersos.c
+++ b/menuchoixpersos.c
@@ -119,14 +119,21 @@ void Fremplirpersos2 (SURFACES *surfaces, PERSONNAGES persos[])
{
int i;
- for (i=0;i<3;i++)
- {
- if (persos[i].classe==PALADIN)
- surfaces->Tperso[i]=IMG_Load("images/paladin.bmp");
- else if (persos[i].classe==PRETRE)
- surfaces->Tperso[i]=IMG_Load("images/prĂȘtre.bmp");
- else if (persos[i].classe==VOLEUR)
- surfaces->Tperso[i]=IMG_Load("images/voleur.bmp");
+
+ for (i = 0; i < 3; i++) {
+ switch (persos[i].classe) {
+ case PALADIN:
+ surfaces->Tperso[i] = surfaces->Ppaladin;
+ break;
+ case PRETRE:
+ surfaces->Tperso[i] = surfaces->Ppretre;
+ break;
+ case VOLEUR:
+ surfaces->Tperso[i] = surfaces->Pvoleur;
+ break;
+ default:
+ abort();
+ }
}
}