From b91ac429108096a3de75b9b81ca2c637b27524ba Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Wed, 7 Jan 2015 13:30:26 +0100 Subject: replaced function inverse() by macro There was multiple problems with this function: void inverse(int *bool); First, we use "bool", which is actually a standard type, as the identifier. Then, we cannot pass different types to the function without cast. Then, inverse is not a meaninful name. At last, we have to pass the address of the variable we want to inverse. Fixed all these points by replacing the function by a macro : #define inverse_boolean(_b) /* impl */ Signed-off-by: Olivier Gayot --- constantes.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'constantes.h') diff --git a/constantes.h b/constantes.h index 24111d3..b3f9335 100644 --- a/constantes.h +++ b/constantes.h @@ -85,7 +85,7 @@ if(clan==ALLIE)\ selection=0;\ while(ennemis[selection].etat==MORT)\ selection++;\ - inverse(&clan);\ + inverse_boolean(clan);\ SDL_BlitSurface (surfaces->Pfondjeu,&positions->Vpositioncurseurallies,surfaces->Pecran,&positions->Vpositioncurseurallies);\ Fchangercurseurennemis (surfaces,positions,selection,ennemis);\ }\ @@ -98,7 +98,7 @@ if(clan==ENNEMI)\ selection=0;\ while(persos[selection].etat==MORT)\ selection++;\ - inverse(&clan);\ + inverse_boolean(clan);\ SDL_BlitSurface(surfaces->Pfondjeu,&positions->Vpositioncurseurennemis,surfaces->Pecran,&positions->Vpositioncurseurennemis);\ Fchangercurseurpersos(surfaces,positions,selection,persos);\ }\ @@ -170,4 +170,7 @@ else\ }\ break; +#include +#define inverse_boolean(_b) ((_b) = (((_b)) ? false : true)) + #endif -- cgit v1.2.3