globox

Platform game for the terminal
git clone git://git.bitsmanent.org/globox
Log | Files | Refs | README | LICENSE

commit 03be9a01328686fe2761c5b6eb3e4099b5dca12e
parent 47c0c1fa80561666524ac6ad54a5acab57d502de
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Tue, 19 Jun 2018 22:16:37 +0200

Add OF_AI flag to ignore zombie()s on finish()

Diffstat:
Mconfig.def.h | 28++++++++++++++--------------
Mglobox.c | 3++-
2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -3,20 +3,20 @@ Object objects[] = { /* symbol flags ontick argument */ { VACUUM, OF_OPEN, falling, {0} }, -[1] = {'o', OF_PLAYER|OF_OPEN|OF_FALL, NULL, {.i = 2} }, -[2] = {'a', OF_PLAYER|OF_OPEN|OF_FALL, NULL, {.i = 2} }, - {'_', OF_OPEN|OF_STICK|OF_JUMPFROM, NULL, {0} }, - {'|', 0, NULL, {0} }, - {'*', OF_OPEN, earnenergy, {.i = 2} }, - {')', OF_OPENLEFT|OF_STICK, finish, {0} }, - {'(', OF_OPENRIGHT|OF_STICK, finish, {0} }, - {'t', 0, cannon, {.v = &objects[11]} }, - {'j', 0, cannon, {.v = &objects[12]} }, -[11] = {'.', OF_OPEN, cannonball, {.i = +1} }, -[12] = {',', OF_OPEN, cannonball, {.i = -1} }, - {'#', OF_FALL|OF_PUSHABLE, NULL, {0} }, - {'@', OF_FALL|OF_PUSHABLE, NULL, {0} }, - {'x', OF_PLAYER|OF_OPEN|OF_FALL, zombie, {.i = 8} }, +[1] = {'o', OF_PLAYER|OF_OPEN|OF_FALL, NULL, {.i = 2} }, +[2] = {'a', OF_PLAYER|OF_OPEN|OF_FALL, NULL, {.i = 2} }, + {'_', OF_OPEN|OF_STICK|OF_JUMPFROM, NULL, {0} }, + {'|', 0, NULL, {0} }, + {'*', OF_OPEN, earnenergy, {.i = 2} }, + {')', OF_OPENLEFT|OF_STICK, finish, {0} }, + {'(', OF_OPENRIGHT|OF_STICK, finish, {0} }, + {'t', 0, cannon, {.v = &objects[11]} }, + {'j', 0, cannon, {.v = &objects[12]} }, +[11] = {'.', OF_OPEN, cannonball, {.i = +1} }, +[12] = {',', OF_OPEN, cannonball, {.i = -1} }, + {'#', OF_FALL|OF_PUSHABLE, NULL, {0} }, + {'@', OF_FALL|OF_PUSHABLE, NULL, {0} }, + {'x', OF_PLAYER|OF_AI|OF_OPEN|OF_FALL, zombie, {.i = 8} }, }; #include "levels.h" diff --git a/globox.c b/globox.c @@ -61,6 +61,7 @@ char *argv0; #define OF_STICK 1<<7 #define OF_FALL 1<<8 #define OF_PUSHABLE 1<<9 +#define OF_AI 1<<10 #define OF_OPEN (OF_OPENUP|OF_OPENRIGHT|OF_OPENDOWN|OF_OPENLEFT) /* enums */ @@ -417,7 +418,7 @@ finish(Object *o) { int np = 0; for(p = scene->blocks; p; p = p->next) { - if(!ISSET(p->o->flags, OF_PLAYER) || p->energy <= 0) + if(!ISSET(p->o->flags, OF_PLAYER) || p->energy <= 0 || ISSET(p->o->flags, OF_AI)) continue; ++np; for(b = scene->blocks; b; b = b->next)