Restrict players to 10 bombs, use enum for tile types

This commit is contained in:
Stefan Bühler 2009-08-10 22:00:27 +02:00
parent 9b60fa91f0
commit 8b614a8728
2 changed files with 23 additions and 12 deletions

View File

@ -166,13 +166,24 @@ typedef struct bonustile {
int type; int type;
} bonustile; } bonustile;
#define TILE_NONE -1 enum tile_types {
#define TILE_BOMB 5 TILE_NONE = -1,
#define TILE_FLAME 2 TILE_DISEASE = 0,
#define TILE_GOLDFLAME 7 TILE_KICK = 1,
#define TILE_CONTROL 9 TILE_FLAME = 2,
#define TILE_SKATES 4 TILE_PUNCH = 3,
#define TILE_TURTLE 14 TILE_SKATES = 4,
TILE_BOMB = 5,
TILE_SPOOGE = 6,
TILE_GOLDFLAME = 7,
TILE_BAD_DISEASE = 8,
TILE_TRIGGER = 9,
TILE_RANDOM = 10,
TILE_JELLY = 11,
TILE_GRAB = 12,
TILE_RANDOM2 = 13,
TILE_TURTLE = 14
};
#define ACT_INVALID 0x88 #define ACT_INVALID 0x88

8
game.c
View File

@ -41,7 +41,7 @@ static int bonustotal;
static const int bonuschances[]= { static const int bonuschances[]= {
TILE_BOMB,20, TILE_BOMB,20,
TILE_FLAME,20, TILE_FLAME,20,
TILE_CONTROL,2, TILE_TRIGGER,2,
TILE_GOLDFLAME,2, TILE_GOLDFLAME,2,
TILE_SKATES,20, TILE_SKATES,20,
TILE_TURTLE,5, TILE_TURTLE,5,
@ -685,9 +685,9 @@ static void applybonus(player *pl,bonustile *bonus) {
maxflame=arraynumx>arraynumy ? arraynumx : arraynumy; maxflame=arraynumx>arraynumy ? arraynumx : arraynumy;
type=bonus->type; type=bonus->type;
deletebonus(bonus); deletebonus(bonus);
switch(type) switch(type) {
{
case TILE_BOMB: case TILE_BOMB:
if (pl->bombsavailable < 9)
++(pl->bombsavailable); ++(pl->bombsavailable);
break; break;
case TILE_FLAME: case TILE_FLAME:
@ -697,7 +697,7 @@ static void applybonus(player *pl,bonustile *bonus) {
case TILE_GOLDFLAME: case TILE_GOLDFLAME:
pl->flamelength=maxflame; pl->flamelength=maxflame;
break; break;
case TILE_CONTROL: case TILE_TRIGGER:
pl->flags|=FLG_CONTROL; pl->flags|=FLG_CONTROL;
break; break;
case TILE_SKATES: case TILE_SKATES: