summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-01-07 14:18:29 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-01-07 14:18:29 +0100
commit347813350f6f051b49187f020eb91f3ffc65f951 (patch)
tree3d02845ec438019a91cc520417979ab5fcc8b6c8
parente93ad2847791222937e26b57da5fd01a527d38cc (diff)
simplify the code of menuchoixpersos
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
-rw-r--r--menuchoixpersos.c44
-rw-r--r--prototypes.h1
2 files changed, 13 insertions, 32 deletions
diff --git a/menuchoixpersos.c b/menuchoixpersos.c
index cc217a8..2d20ef2 100644
--- a/menuchoixpersos.c
+++ b/menuchoixpersos.c
@@ -65,34 +65,26 @@ void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions)
{
case SDLK_LEFT:
case SDLK_h:
- if(Vchoix>PALADIN)
- {
- Vchoix--;
+ if (Vchoix > PALADIN) {
+ Vchoix--;
+ } else {
+ Vchoix=VOLEUR;
+ }
Fchangersurlignage2 (Vchoix,surfaces,positions);
- }
- else
- {
- Vchoix=VOLEUR;
- Fchangersurlignage2 (Vchoix,surfaces,positions);
- }
- break;
+
+ break;
case SDLK_RIGHT:
case SDLK_l:
- if (Vchoix<VOLEUR)
- {
- Vchoix++;
+ if (Vchoix < VOLEUR) {
+ Vchoix++;
+ } else {
+ Vchoix = PALADIN;
+ }
Fchangersurlignage2 (Vchoix,surfaces,positions);
- }
- else
- {
- Vchoix=PALADIN;
- Fchangersurlignage2 (Vchoix,surfaces,positions);
- }
break;
case SDLK_RETURN:
case SDLK_f:
- Fremplirpersos (Vchoix,persos,Vnbperso);
- Vnbperso++;
+ persos[Vnbperso++].classe = Vchoix;
continuer = false;
break;
default:
@@ -123,16 +115,6 @@ void Fchangersurlignage2 (int Vchoix, SURFACES *surfaces, POSITIONS *positions)
SDL_Flip (surfaces->Pecran);
}
-void Fremplirpersos (int Vchoix, PERSONNAGES persos[],int Vnbpersos)
-{
- if (Vchoix==PALADIN)
- persos[Vnbpersos].classe=PALADIN;
- else if (Vchoix==PRETRE)
- persos[Vnbpersos].classe=PRETRE;
- else if (Vchoix==VOLEUR)
- persos[Vnbpersos].classe=VOLEUR;
-}
-
void Fremplirpersos2 (SURFACES *surfaces, PERSONNAGES persos[])
{
diff --git a/prototypes.h b/prototypes.h
index b6401b9..65591db 100644
--- a/prototypes.h
+++ b/prototypes.h
@@ -6,7 +6,6 @@ void Fchangersurlignage (int Vmode, SURFACES *surfaces, POSITIONS *positions);
int Fentrermode (int Vmode, SURFACES *surfaces, POSITIONS *positions);
void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions);
void Fchangersurlignage2 (int Vperso, SURFACES *surfaces, POSITIONS *positions);
-void Fremplirpersos (int Vperso, PERSONNAGES persos[],int Vnbpersos);
void Fremplirpersos2 (SURFACES *surfaces, PERSONNAGES persos[]);
int Fjouer (SURFACES *surfaces, POSITIONS *positions, PERSONNAGES persos[],ENNEMIS ennemis[]);
void Fblitterpersos (SURFACES *surfaces, POSITIONS *positions, PERSONNAGES persos[]);