From b37b127792e09cb7148200e0bccf294892e9a889 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Sun, 11 Jan 2015 01:42:56 +0100 Subject: remove or replace a lot of code for the initialization many structures or positions were not revelant anymore and thus have been removed. some positions were not relative to each other it is sometimes not meaningful to put surfaces in the global scope when they only need to be used once. Signed-off-by: Olivier Gayot --- blits.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'blits.c') diff --git a/blits.c b/blits.c index 2e79342..59956c4 100644 --- a/blits.c +++ b/blits.c @@ -88,16 +88,13 @@ void Fblitterpvcible (SURFACES *surfaces,POSITIONS *positions, const struct char { SDL_Color couleur = {132,215,107,0}; char chaine[50]; - - if (surfaces->Ppvcible != NULL) - { - SDL_FreeSurface (surfaces->Ppvcible); - surfaces->Ppvcible=NULL; - } + SDL_Surface *surf; sprintf (chaine,"%d/%d", chr->hp, chr->max_hp); - surfaces->Ppvcible=TTF_RenderText_Blended(rpg_g.font, chaine, couleur); - SDL_BlitSurface (surfaces->Ppvcible,NULL,surfaces->Pecran,&positions->Vpositionpvcible); + surf = TTF_RenderText_Blended(rpg_g.font, chaine, couleur); + SDL_BlitSurface(surf, NULL, surfaces->screen, &positions->Vpositionpvcible); + + SDL_FreeSurface(surf); } static @@ -105,15 +102,13 @@ void Fblitterpmcible (SURFACES *surfaces,POSITIONS *positions, const struct char { SDL_Color couleur = {132,215,107,0}; char chaine[50]; + SDL_Surface *surf; - if (surfaces->Ppmcible != NULL) - { - SDL_FreeSurface (surfaces->Ppmcible); - surfaces->Ppmcible=NULL; - } sprintf (chaine,"%d/%d", chr->mp, chr->max_mp); - surfaces->Ppmcible=TTF_RenderText_Blended(rpg_g.font, chaine, couleur); - SDL_BlitSurface (surfaces->Ppmcible,NULL,surfaces->Pecran,&positions->Vpositionpmcible); + surf = TTF_RenderText_Blended(rpg_g.font, chaine, couleur); + SDL_BlitSurface(surf, NULL, surfaces->screen, &positions->Vpositionpmcible); + + SDL_FreeSurface(surf); } static void display_target_infos(SURFACES *surfaces, POSITIONS *positions, struct target_t *target) -- cgit v1.2.3