summaryrefslogtreecommitdiff
path: root/menuchoixpersos.c
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-01-07 15:05:59 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-01-07 15:05:59 +0100
commit5b6986f617c554ac27b57373be0b874807e2d49d (patch)
treef3149809f78dd31ec091d95d78f466ea058d3cbc /menuchoixpersos.c
parent7a9de9f475fcf4ba3cc4b5b6ef6b220af1c7d7bd (diff)
do not duplicate surfaces but make them point to each other
There is no need to reopen the bitmap files each time we need a new paladin or priest or whatever. Instead, just load them at startup and them make them point to the good destination. Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'menuchoixpersos.c')
-rw-r--r--menuchoixpersos.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/menuchoixpersos.c b/menuchoixpersos.c
index 2d20ef2..7790255 100644
--- a/menuchoixpersos.c
+++ b/menuchoixpersos.c
@@ -119,14 +119,21 @@ void Fremplirpersos2 (SURFACES *surfaces, PERSONNAGES persos[])
{
int i;
- for (i=0;i<3;i++)
- {
- if (persos[i].classe==PALADIN)
- surfaces->Tperso[i]=IMG_Load("images/paladin.bmp");
- else if (persos[i].classe==PRETRE)
- surfaces->Tperso[i]=IMG_Load("images/prĂȘtre.bmp");
- else if (persos[i].classe==VOLEUR)
- surfaces->Tperso[i]=IMG_Load("images/voleur.bmp");
+
+ for (i = 0; i < 3; i++) {
+ switch (persos[i].classe) {
+ case PALADIN:
+ surfaces->Tperso[i] = surfaces->Ppaladin;
+ break;
+ case PRETRE:
+ surfaces->Tperso[i] = surfaces->Ppretre;
+ break;
+ case VOLEUR:
+ surfaces->Tperso[i] = surfaces->Pvoleur;
+ break;
+ default:
+ abort();
+ }
}
}