Limit lifetime of controlled bombs
This commit is contained in:
parent
de5183b818
commit
e280118e3d
1
bomber.h
1
bomber.h
@ -115,6 +115,7 @@ typedef struct bomb {
|
|||||||
#define BOMB_NORMAL 1
|
#define BOMB_NORMAL 1
|
||||||
#define BOMB_CONTROLLED 2
|
#define BOMB_CONTROLLED 2
|
||||||
#define BOMBLIFE 60
|
#define BOMBLIFE 60
|
||||||
|
#define BOMB_CONTROLLED_LIFE 150
|
||||||
#define FLAMELIFE 15
|
#define FLAMELIFE 15
|
||||||
#define DECAYLIFE 15
|
#define DECAYLIFE 15
|
||||||
|
|
||||||
|
13
game.c
13
game.c
@ -237,18 +237,21 @@ static void adddetonate(bomb *bmb) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void processbombs() {
|
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) {
|
switch(bmb->type) {
|
||||||
case BOMB_NORMAL:
|
case BOMB_NORMAL:
|
||||||
++bmb->timer;
|
|
||||||
if (bmb->timer == BOMBLIFE)
|
if (bmb->timer == BOMBLIFE)
|
||||||
adddetonate(bmb);
|
adddetonate(bmb);
|
||||||
++(bmb->figcount);
|
|
||||||
break;
|
break;
|
||||||
case BOMB_CONTROLLED:
|
case BOMB_CONTROLLED:
|
||||||
++(bmb->figcount);
|
if (bmb->timer == BOMB_CONTROLLED_LIFE) {
|
||||||
|
bmb->timer = 0;
|
||||||
|
bmb->type = BOMB_NORMAL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user