X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/ledger2?a=blobdiff_plain;f=src%2Fserver%2Frun.c;h=ea8d608dd4c5003ea142ce77c7bb630ee3503064;hb=6dbb8b2dc9c4e33081e5e1d21880f1d7968987a6;hp=808be55398a3a03e7f1d69d67c104d3850ebaffd;hpb=a9377a5125c28779f812f859564d4f4d0b744e89;p=plomrogue diff --git a/src/server/run.c b/src/server/run.c index 808be55..ea8d608 100644 --- a/src/server/run.c +++ b/src/server/run.c @@ -227,7 +227,7 @@ static int16_t * build_whitelist() for (; t; t = t->next, i_things++); int16_t * whitelist = try_malloc(i_things * sizeof(int16_t), __func__); for (i_things = 0, t = world.things; t; - whitelist[i_things] = t->id, t = t->next, i_things++) + whitelist[i_things] = t->id, t = t->next, i_things++); whitelist[i_things] = -1; return whitelist; } @@ -236,7 +236,7 @@ static int16_t * build_whitelist() static uint8_t thing_in_whitelist(uint8_t id, int16_t * whitelist) { - int16_t i; + uint16_t i; for (i = 0; -1 < whitelist[i]; i++) { if ((int16_t) id == whitelist[i]) @@ -263,8 +263,8 @@ static void turn_over() world.turn++; thing = world.things; free(whitelist); - whitelist = build_whitelist(); - } + whitelist = build_whitelist();/* The whitelist excludes things */ + } /* that appear only during the turn.*/ if (thing_in_whitelist(thing->id, whitelist)) { if (0 < thing->lifepoints)