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) {
|
||||
generic *gen,*gen2;
|
||||
generic *gen, *next;
|
||||
|
||||
gen = (generic*) activegeneric.next;
|
||||
while ((listhead*) gen != &activegeneric) {
|
||||
gen2 = gen;
|
||||
gen = (generic*) gen->list.next;
|
||||
++(gen2->timer);
|
||||
gen2->process(gen2);
|
||||
foreach_list_safe(&activegeneric, gen, next) {
|
||||
++(gen->timer);
|
||||
gen->process(gen);
|
||||
}
|
||||
}
|
||||
|
||||
@ -765,13 +762,10 @@ static void doplayer(player *pl) {
|
||||
}
|
||||
|
||||
static void processplayers(void) {
|
||||
player *pl, *pl2;
|
||||
player *pl, *next;
|
||||
|
||||
pl = (player*) activeplayers.next;
|
||||
while ((listhead*) pl != &activeplayers) {
|
||||
pl2 = pl;
|
||||
pl = (player*) pl->list.next;
|
||||
doplayer(pl2);
|
||||
foreach_list_safe(&activeplayers, pl, next) {
|
||||
doplayer(pl);
|
||||
}
|
||||
}
|
||||
|
||||
@ -858,7 +852,7 @@ static int iterate(void) {
|
||||
drawplayers();
|
||||
plotsprites();
|
||||
copyup();
|
||||
if (activegeneric.next == &activegeneric) {
|
||||
if (list_empty(&activegeneric)) {
|
||||
player *pl;
|
||||
|
||||
int deadplayers = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user