diff options
| author | XaviDCR92 <xavi.dcr@gmail.com> | 2017-08-26 17:54:03 +0200 |
|---|---|---|
| committer | XaviDCR92 <xavi.dcr@gmail.com> | 2017-08-26 17:54:03 +0200 |
| commit | 4ca8c2d15b51c479dd890773643ea24440b3991f (patch) | |
| tree | 59f134fac677d30187b78453f5b35280f57b0f94 /Unit.c | |
| parent | 845c7cba1d8efd16b073ca034eb8239b6616e681 (diff) | |
| download | pocketempires-4ca8c2d15b51c479dd890773643ea24440b3991f.tar.gz | |
+ Added Makefiles for dependencies
Diffstat (limited to 'Unit.c')
| -rw-r--r-- | Unit.c | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -9,6 +9,8 @@ * Defines * * **************************************/ +#define MAX_ACTION_LEVELS 2 + /* ************************************** * Local prototypes * * **************************************/ @@ -28,16 +30,27 @@ typedef struct void (*pAction)(TYPE_UNIT*); }TYPE_UNIT_ACTION; +typedef enum t_availableactions +{ + ACTION_BUILD = 0, + ACTION_ATTACK, + MAX_ACTIONS +}UNIT_AVAILABLE_ACTIONS; + /* Sprites */ static TYPE_SPRITE PeasantSpr; static TYPE_SPRITE PeasantWalkingSpr; /* Tables */ -static uint8_t const UnitHPTable[] = { 25 }; -static uint8_t const UnitSpeedTable[] = { 1 }; +static uint8_t const UnitHPTable[] = { [PEASANT] = 25 }; +static uint8_t const UnitSpeedTable[] = { [PEASANT] = 1 }; -static TYPE_UNIT_ACTION const UnitActionsTable_Level0[] = { {"Build", NULL} }; -static TYPE_UNIT_ACTION const UnitActionsTable_Level1[] = { {"Barracks", &UnitBuildAccept} }; +static TYPE_UNIT_ACTION const UnitActionsTable_Level0[MAX_ACTIONS] = { [ACTION_BUILD] = {"Build", NULL}, + [ACTION_ATTACK] = {"Attack", NULL} }; +static TYPE_UNIT_ACTION const UnitActionsTable_Level1[MAX_ACTIONS] = { {"Barracks", &UnitBuildAccept} }; + +static TYPE_UNIT_ACTION* const UnitActionsTable_LevelX[MAX_ACTION_LEVELS] = { &UnitActionsTable_Level0 , + &UnitActionsTable_Level1 }; static TYPE_SPRITE * const UnitSprTable[] = {&PeasantSpr}; static TYPE_SPRITE * const UnitWalkingSprTable[] = {&PeasantWalkingSpr}; @@ -210,10 +223,7 @@ void UnitHandler(TYPE_UNIT * ptrUnit) ptrUnit->mirror = true; } - if(bMoving == false) - { - ptrUnit->walking = false; - } + ptrUnit->walking = bMoving; } } |
