Limit lifetime of controlled bombs

This commit is contained in:
Stefan Bühler 2009-08-11 18:20:48 +02:00
parent de5183b818
commit e280118e3d
2 changed files with 10 additions and 6 deletions

View File

@ -115,6 +115,7 @@ typedef struct bomb {
#define BOMB_NORMAL 1
#define BOMB_CONTROLLED 2
#define BOMBLIFE 60
#define BOMB_CONTROLLED_LIFE 150
#define FLAMELIFE 15
#define DECAYLIFE 15

15
game.c
View File

@ -237,18 +237,21 @@ static void adddetonate(bomb *bmb) {
}
static void processbombs() {
bomb *bmb;
bomb *bmb, *next;
foreach_list_fast(&activebombs, bmb) {
foreach_list_safe(&activebombs, bmb, next) {
++(bmb->figcount);
++bmb->timer;
switch(bmb->type) {
case BOMB_NORMAL:
++bmb->timer;
if(bmb->timer==BOMBLIFE)
if (bmb->timer == BOMBLIFE)
adddetonate(bmb);
++(bmb->figcount);
break;
case BOMB_CONTROLLED:
++(bmb->figcount);
if (bmb->timer == BOMB_CONTROLLED_LIFE) {
bmb->timer = 0;
bmb->type = BOMB_NORMAL;
}
break;
}
}