Redo some list foreach loops
This commit is contained in:
parent
8a8afdf56e
commit
5e908b9936
22
game.c
22
game.c
@ -521,14 +521,11 @@ static void killplayer(player *pl) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void processgenerics(void) {
|
static void processgenerics(void) {
|
||||||
generic *gen,*gen2;
|
generic *gen, *next;
|
||||||
|
|
||||||
gen = (generic*) activegeneric.next;
|
foreach_list_safe(&activegeneric, gen, next) {
|
||||||
while ((listhead*) gen != &activegeneric) {
|
++(gen->timer);
|
||||||
gen2 = gen;
|
gen->process(gen);
|
||||||
gen = (generic*) gen->list.next;
|
|
||||||
++(gen2->timer);
|
|
||||||
gen2->process(gen2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -765,13 +762,10 @@ static void doplayer(player *pl) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void processplayers(void) {
|
static void processplayers(void) {
|
||||||
player *pl, *pl2;
|
player *pl, *next;
|
||||||
|
|
||||||
pl = (player*) activeplayers.next;
|
foreach_list_safe(&activeplayers, pl, next) {
|
||||||
while ((listhead*) pl != &activeplayers) {
|
doplayer(pl);
|
||||||
pl2 = pl;
|
|
||||||
pl = (player*) pl->list.next;
|
|
||||||
doplayer(pl2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -858,7 +852,7 @@ static int iterate(void) {
|
|||||||
drawplayers();
|
drawplayers();
|
||||||
plotsprites();
|
plotsprites();
|
||||||
copyup();
|
copyup();
|
||||||
if (activegeneric.next == &activegeneric) {
|
if (list_empty(&activegeneric)) {
|
||||||
player *pl;
|
player *pl;
|
||||||
|
|
||||||
int deadplayers = 0;
|
int deadplayers = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user