From 40c476353b251cd2c423c8945480572b64381f44 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Sun, 26 Oct 2014 19:44:01 +0000 Subject: game: fix segmentation fault whenever the game starts Signed-off-by: Olivier Gayot --- blits.c | 14 +++++++------- main.c | 4 ---- menuchoixpersos.c | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/blits.c b/blits.c index 34d8180..eef8414 100644 --- a/blits.c +++ b/blits.c @@ -48,7 +48,7 @@ void Fchangercurseurennemis (SURFACES *surfaces, POSITIONS *positions,int select SDL_FreeSurface (surfaces->Pnomcible); surfaces->Pnomcible=NULL; } - police=TTF_OpenFont("C://Windows//Fonts//times.ttf",20); + police=TTF_OpenFont("times.ttf",20); SDL_BlitSurface (surfaces->Pfondjeu,&positions->Vpositioncurseurennemis,surfaces->Pecran,&positions->Vpositioncurseurennemis); SELECTION (0,ENNEMI) SELECTION (1,ENNEMI) @@ -86,7 +86,7 @@ void Fchangeractionselectionnee(SURFACES *surfaces, POSITIONS *positions,int sel TTF_Font *police=NULL; SDL_Color couleur={0,0,0,0}; char chaine[3][50]; - police=TTF_OpenFont ("C://Windows//Fonts//TIMESBI.TTF",20); + police=TTF_OpenFont ("TIMESBI.TTF",20); SDL_BlitSurface(surfaces->Pfondjeu,&positions->Vpositioncadreactions,surfaces->Pecran,&positions->Vpositioncadreactions); SDL_BlitSurface (surfaces->Pcadreactions,NULL,surfaces->Pecran,&positions->Vpositioncadreactions); for(i=0;iPnbdegats=NULL; } sprintf (chaine,"%d ", degats); - police = TTF_OpenFont ("C://Windows//Fonts//TIMES.TTF", 30 + police = TTF_OpenFont ("TIMES.TTF", 30 ); TTF_SetFontStyle(police,TTF_STYLE_BOLD); surfaces->Pnbdegats = TTF_RenderText_Blended(police,chaine,fg); @@ -222,7 +222,7 @@ void Faffichersoins (SURFACES *surfaces, POSITIONS *positions, int degats,int cl surfaces->Pnbdegats=NULL; } sprintf (chaine,"%d", degats); - police = TTF_OpenFont ("C://Windows//Fonts//TIMES.TTF", 30); + police = TTF_OpenFont ("TIMES.TTF", 30); TTF_SetFontStyle(police,TTF_STYLE_BOLD); surfaces->Pnbdegats = TTF_RenderText_Blended (police,chaine,fg); if(clan==ENNEMI) @@ -292,7 +292,7 @@ void Fblitterpvcible (SURFACES *surfaces,POSITIONS *positions,ENNEMIS ennemis[], if (ennemis[selection].pv<0) ennemis[selection].pv=0; sprintf (chaine,"%d/%d",ennemis[selection].pv,ennemis[selection].pvinitiaux); - police=TTF_OpenFont ("C://Windows//Fonts//TIMESBI.TTF",18); + police=TTF_OpenFont ("TIMESBI.TTF",18); surfaces->Ppvcible=TTF_RenderText_Blended (police,chaine,couleur); SDL_BlitSurface (surfaces->Ppvcible,NULL,surfaces->Pecran,&positions->Vpositionpvcible); TTF_CloseFont (police); @@ -310,7 +310,7 @@ void Fblitterpmcible (SURFACES *surfaces,POSITIONS *positions,ENNEMIS ennemis[], surfaces->Ppvcible=NULL; } sprintf (chaine,"%d/%d",ennemis[selection].pm,ennemis[selection].pminitiaux); - police=TTF_OpenFont ("C://Windows//Fonts//TIMESBI.TTF",18); + police=TTF_OpenFont ("TIMESBI.TTF",18); surfaces->Ppmcible=TTF_RenderText_Blended (police,chaine,couleur); SDL_BlitSurface (surfaces->Ppmcible,NULL,surfaces->Pecran,&positions->Vpositionpmcible); TTF_CloseFont (police); @@ -321,7 +321,7 @@ void Fblitterpmpvpersos(SURFACES *surfaces,POSITIONS *positions,PERSONNAGES pers TTF_Font *police=NULL; SDL_Color fg={132,215,107,0},bg={100,0,0,0}; char chaine[2][50]; - police=TTF_OpenFont("C://WINDOWS//Fonts//TIMESBI.TTF",18); + police=TTF_OpenFont("TIMESBI.TTF",18); sprintf(chaine[0],"PV %d/%d ",persos[selection].pv,persos[selection].pvinitiaux); surfaces->Ppvpersos=TTF_RenderText_Shaded(police,chaine[0],fg,bg); sprintf(chaine[1],"PM %d/%d ",persos[selection].pm,persos[selection].pminitiaux); diff --git a/main.c b/main.c index 8cbc3dc..1dc987e 100644 --- a/main.c +++ b/main.c @@ -244,10 +244,6 @@ void Fdechargerimages (SURFACES *surfaces)//dechargement des surfaces alou { SDL_FreeSurface(surfaces->Tperso[i]); } - for(i=0;i<5;i++) - { - SDL_FreeSurface(surfaces->Tennemi[i]); - } for(i=0;i<3;i++) { SDL_FreeSurface (surfaces->Pnomactions[i]); diff --git a/menuchoixpersos.c b/menuchoixpersos.c index 6c5f9b7..2616e56 100644 --- a/menuchoixpersos.c +++ b/menuchoixpersos.c @@ -24,7 +24,7 @@ void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions) vert.g = 189; vert.b = 31; SDL_BlitSurface (surfaces->Pchoixpaladin,NULL,surfaces->Pecran,&positions->Vpositionmenu); - police = TTF_OpenFont ("C://WINDOWS//Fonts//TIMESI.TTF",36); + police = TTF_OpenFont ("TIMESI.TTF",36); while (Vnbperso!=3) { continuer = 1; -- cgit v1.2.3