diff --git a/attack.cpp b/attack.cpp index 3429d4c1..1842323c 100644 --- a/attack.cpp +++ b/attack.cpp @@ -1178,9 +1178,9 @@ EX void killThePlayer(eMonster m, int id, flagtype flags) { } EX void killThePlayerAt(eMonster m, cell *c, flagtype flags) { - for(int i=0; impdist <= GUNRANGE; if(inrange) { inrange = false; - for(int i=0; i 1) { - for(int i=0; i 5 && items[itHunting] <= 22) { int q = 0; - for(int i=0; icpdist == 0) continue; c->cpdist = 0; checkTide(c); @@ -299,9 +297,7 @@ EX void bfs() { int distlimit = gamerange(); - for(int i=0; imonst == moTentacle || c->monst == moTentaclewait || c->monst == moTentacleEscaping) worms.push_back(c); @@ -799,8 +795,9 @@ EX void monstersTurn() { DEBB(DF_TURN, ("mmo")); int phase2 = (1 & items[itOrbSpeed]); if(!phase2) movemonsters(); - for(int i=0; iitem == itOrbSafety) { - collectItem(playerpos(i), true); + + for(cell *pc: player_positions()) if(pc->item == itOrbSafety) { + collectItem(pc, true); return; } @@ -852,9 +849,8 @@ EX void monstersTurn() { #endif if(items[itOrbFreedom]) - for(int i=0; imonst && c->monst != moTentacleGhost && isMountable(c->monst)) { - for(int i=0; imonst && sameMonster(c, playerpos(i))) return true; if(lastmountpos[i] && lastmountpos[i]->monst && sameMonster(c, lastmountpos[i])) diff --git a/game.cpp b/game.cpp index 9dd82110..0b53a018 100644 --- a/game.cpp +++ b/game.cpp @@ -449,8 +449,8 @@ EX bool sameMonster(cell *c1, cell *c2) { } EX eMonster haveMount() { - for(int i=0; imonst; + for(cell *pc: player_positions()) { + eMonster m = pc->monst; if(m) return m; } return moNone; diff --git a/graph.cpp b/graph.cpp index 58f80856..4cbfab2f 100644 --- a/graph.cpp +++ b/graph.cpp @@ -178,8 +178,8 @@ EX int flip_dark(int f, int a0, int a1) { color_t fc(int ph, color_t col, int z) { if(items[itOrbFire]) col = darkena(firecolor(ph), 0, 0xFF); if(items[itOrbAether]) col = (col &~0XFF) | (col&0xFF) / 2; - for(int i=0; iycenter - current_display->radius * 3/4, 2, vid.fsize, diff --git a/inventory.cpp b/inventory.cpp index 07169008..cdf9ba9d 100644 --- a/inventory.cpp +++ b/inventory.cpp @@ -442,14 +442,12 @@ EX namespace inv { void evokeOrb(eItem it) { if(it == itOrbFreedom) - for(int i=0; imonst)) evokeBeautyAt(c); @@ -464,12 +462,11 @@ EX namespace inv { } if(it == itOrbSword || it == itOrbSword2) { - for(int i=0; imonst == moShadow) { for(int j=0; jtype; j++) @@ -1445,7 +1443,7 @@ EX void moveshadow() { shpos[p][cshpos] = playerpos(p); } cshpos = (cshpos+1) % SHSIZE; - for(int p=0; pmonst == moNone && where->cpdist && where->land == laGraveyard && !sword::at(where)) { @@ -2038,7 +2036,9 @@ EX void movemonsters() { DEBB(DF_TURN, ("westwall")); if(havewhat & HF_WESTWALL) westwall::move(); #endif - for(int i=0; iitem == itOrbSafety) return; + for(cell *pc: player_positions()) + if(pc->item == itOrbSafety) + return; DEBB(DF_TURN, ("river")); if(havewhat & HF_RIVER) prairie::move(); /* DEBB(DF_TURN, ("magnet")); diff --git a/multi.cpp b/multi.cpp index e7847060..e55afd23 100644 --- a/multi.cpp +++ b/multi.cpp @@ -797,7 +797,7 @@ EX void handleInput(int delta) { } EX void checklastmove() { - for(int i=0; i player_positions() { + vector res; + for(int i=0; i player_indices() { + vector res; + for(int i=0; i 1) return multi::player[i].at; @@ -1210,14 +1226,14 @@ EX cell *playerpos(int i) { } EX bool allPlayersInBoats() { - for(int i=0; iwall != waBoat) return true; + for(cell *pc: player_positions()) + if(pc->wall != waBoat) return true; return false; } EX int whichPlayerOn(cell *c) { if(singleused()) return c == singlepos() ? 0 : -1; - for(int i=0; iland == laPower || singlepos()->land == laHalloween; - for(int i=0; iland == laPower || playerpos(i)->land == laHalloween)) + for(cell *pc: player_positions()) + if(pc->land == laPower || pc->land == laHalloween) return true; return false; } diff --git a/system.cpp b/system.cpp index 02e444d5..20604550 100644 --- a/system.cpp +++ b/system.cpp @@ -326,12 +326,11 @@ EX void initgame() { #endif if(multi::players > 1 && !shmup::on) { - for(int i=0; i