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_CONTROLLED 2
|
||||
#define BOMBLIFE 60
|
||||
#define BOMB_CONTROLLED_LIFE 150
|
||||
#define FLAMELIFE 15
|
||||
#define DECAYLIFE 15
|
||||
|
||||
|
13
game.c
13
game.c
@ -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)
|
||||
adddetonate(bmb);
|
||||
++(bmb->figcount);
|
||||
break;
|
||||
case BOMB_CONTROLLED:
|
||||
++(bmb->figcount);
|
||||
if (bmb->timer == BOMB_CONTROLLED_LIFE) {
|
||||
bmb->timer = 0;
|
||||
bmb->type = BOMB_NORMAL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user