diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-01-07 14:18:29 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-01-07 14:18:29 +0100 |
commit | 347813350f6f051b49187f020eb91f3ffc65f951 (patch) | |
tree | 3d02845ec438019a91cc520417979ab5fcc8b6c8 /menuchoixpersos.c | |
parent | e93ad2847791222937e26b57da5fd01a527d38cc (diff) |
simplify the code of menuchoixpersos
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'menuchoixpersos.c')
-rw-r--r-- | menuchoixpersos.c | 44 |
1 files changed, 13 insertions, 31 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[]) { |