summaryrefslogtreecommitdiff
path: root/actions.c
diff options
context:
space:
mode:
Diffstat (limited to 'actions.c')
-rw-r--r--actions.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/actions.c b/actions.c
index 096fba9..cb0d8ea 100644
--- a/actions.c
+++ b/actions.c
@@ -5,7 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
-enum action_state_t Fattaquer(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy)
+enum action_state_t Fattaquer(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy, void *data)
{
int degats;
struct character_t *target;
@@ -13,6 +13,9 @@ enum action_state_t Fattaquer(SURFACES *surfaces,POSITIONS *positions, struct te
int selection = 0;
SDL_Event event;
SDL_BlitSurface (surfaces->Pfondjeu,&positions->Vpositioncadreactions,surfaces->Pecran,&positions->Vpositioncadreactions);
+
+ (void) data;
+
while(!enemy->chrs[selection].alive)
selection++;
update_selected_target(surfaces, positions, &enemy->chrs[selection]);
@@ -150,7 +153,7 @@ enum action_state_t Fselectionnermagienoire(SURFACES *surfaces,POSITIONS *positi
case SDLK_RETURN:
SDL_BlitSurface(surfaces->Pfondjeu,&positions->Vpositiondegats,surfaces->Pecran,&positions->Vpositiondegats);
SDL_Flip(surfaces->Pecran);
- ret = Fmagieelement(surfaces,positions, ally, enemy, selection);
+ ret = Fmagieelement(surfaces,positions, ally, enemy, (enum element_t []) {selection});
if (ret == ACTION_PERFORMED) {
continuer = 0;
@@ -211,7 +214,7 @@ enum action_state_t Fselectionnermagieblanche(SURFACES *surfaces,POSITIONS *posi
SDL_BlitSurface(surfaces->Pfondjeu,&positions->Vpositiondegats,surfaces->Pecran,&positions->Vpositiondegats);
SDL_Flip(surfaces->Pecran);
if(selection==SOIN)
- ret = Fmagiesoin(surfaces,positions, ally, enemy);
+ ret = Fmagiesoin(surfaces,positions, ally, enemy, NULL);
if (ret == ACTION_PERFORMED) {
continuer = 0;
@@ -273,17 +276,17 @@ enum action_state_t Fselectionnerobjet(SURFACES *surfaces,POSITIONS *positions,
if(page==0)
{
if(selection==POTION)
- ret = Fpotion(surfaces,positions, ally, enemy, selection);
+ ret = Fpotion(surfaces,positions, ally, enemy, (int []) {selection});
else if(selection==ETHER)
- ret = Fether(surfaces,positions, ally, enemy, selection);
+ ret = Fether(surfaces,positions, ally, enemy, (int []) {selection});
else if(selection==POTIONPLUS)
- ret = Fpotion(surfaces,positions, ally, enemy, selection);
+ ret = Fpotion(surfaces,positions, ally, enemy, (int []) { selection});
}
else if(page==1)
{
if(selection==ETHERPLUS)
- ret = Fether(surfaces,positions, ally, enemy, selection);
+ ret = Fether(surfaces,positions, ally, enemy, (int []) { selection});
}
if (ret == ACTION_PERFORMED) {
@@ -300,7 +303,7 @@ enum action_state_t Fselectionnerobjet(SURFACES *surfaces,POSITIONS *positions,
return ret;
}
-enum action_state_t Fpotion(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy, int type)
+enum action_state_t Fpotion(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy, void *data)
{
struct character_t *target;
SDL_Event event;
@@ -308,6 +311,8 @@ enum action_state_t Fpotion(SURFACES *surfaces,POSITIONS *positions, struct team
int soins=0;
int clan=ALLIE;
+ int type = *((int *)data);
+
if (type == POTION && ally->objects.potions <= 0)
return ACTION_ERROR;
else if(type == POTIONPLUS && ally->objects.potionsplus <= 0)
@@ -365,7 +370,7 @@ enum action_state_t Fpotion(SURFACES *surfaces,POSITIONS *positions, struct team
}
}
-enum action_state_t Fether(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy, int type)
+enum action_state_t Fether(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy, void *data)
{
struct character_t *target;
SDL_Event event;
@@ -373,6 +378,8 @@ enum action_state_t Fether(SURFACES *surfaces,POSITIONS *positions, struct team_
int soins=0;
int clan=ALLIE;
+ int type = *((int *)data);
+
if (type == ETHER && ally->objects.ethers <= 0)
return ACTION_ERROR;
else if (type == ETHERPLUS && ally->objects.ethersplus <= 0)