diff --git a/attack.cpp b/attack.cpp index bcabce60..fd87babf 100644 --- a/attack.cpp +++ b/attack.cpp @@ -293,14 +293,14 @@ EX void prespill(cell* c, eWall t, int rad, cell *from) { // block spill if(t == waTemporary) return; // cwt.at->item = itNone; - if(rad) for(int i=0; itype; i++) if(c->move(i)) - prespill(c->move(i), t, rad-1, c); + if(rad) for(cell *c2: adj_minefield_cells(c)) + prespill(c2, t, rad-1, c); } EX void spillfix(cell* c, eWall t, int rad) { if(c->wall == waTemporary) c->wall = t; - if(rad) for(int i=0; itype; i++) if(c->move(i)) - spillfix(c->move(i), t, rad-1); + if(rad) for(cell *c2: adj_minefield_cells(c)) + spillfix(c2, t, rad-1); } EX void spill(cell* c, eWall t, int rad) { diff --git a/celldrawer.cpp b/celldrawer.cpp index 2d0551cd..dffac1cf 100644 --- a/celldrawer.cpp +++ b/celldrawer.cpp @@ -2242,9 +2242,20 @@ void celldrawer::add_map_effects() { int tim = ticks - lightat; if(tim > 1000) tim = 800; if(elec::havecharge && tim > 400) tim = 400; - for(int t=0; ttype; t++) if(c->move(t) && c->move(t)->ligon) { - int lcol = darkena(gradient(iinf[itOrbLightning].color, 0, 0, tim, 1100), 0, 0xFF); - queueline(V*chei(xspinpush(ticks * M_PI / cgi.S42, cgi.hexf/2), rand() % 1000, 1000) * C0, V*chei(currentmap->adj(c, t), rand() % 1000, 1000) * C0, lcol, 2 + vid.linequality); + for(int t=0; ttype; t++) if(c->move(t)) { + if(c->move(t)->ligon) { + int lcol = darkena(gradient(iinf[itOrbLightning].color, 0, 0, tim, 1100), 0, 0xFF); + queueline(V*chei(xspinpush(ticks * M_PI / cgi.S42, cgi.hexf/2), rand() % 1000, 1000) * C0, V*chei(currentmap->adj(c, t), rand() % 1000, 1000) * C0, lcol, 2 + vid.linequality); + } + for(int u: {-1, 1}) { + cellwalker cw = cellwalker(c, t) + wstep + u; + if(u == -1 && VALENCE == 4) continue; + cell *c2 = cw.peek(); + if(c2 && c2->ligon) { + int lcol = darkena(gradient(iinf[itOrbLightning].color, 0, 0, tim, 1100), 0, 0xFF); + queueline(V*chei(xspinpush(ticks * M_PI / cgi.S42, cgi.hexf/2), rand() % 1000, 1000) * C0, V*chei(currentmap->adj(c, t)*currentmap->adj(cw.at, cw.spin), rand() % 1000, 1000) * C0, lcol, 2 + vid.linequality); + } + } } } diff --git a/complex.cpp b/complex.cpp index 5465b86c..86dc893e 100644 --- a/complex.cpp +++ b/complex.cpp @@ -306,9 +306,7 @@ EX namespace elec { if(from != 1) charges[id].lowlink = 1; } - for(int i=0; itype; i++) { - cell *c2 = c->move(i); - if(!c2) continue; + for(cell *c2: adj_minefield_cells(c)) { if(c2->listindex == from) continue; eCharge ct = getCharge(c2); if(conduct(chh, ct)) @@ -2087,14 +2085,16 @@ EX namespace heat { if(isFire(c)) hmod += 4 * xrate; if(isPrincess(c->monst)) hmod += (markEmpathy(itOrbWinter) ? -1.2 : 1.2) * xrate; - forCellEx(ct, c) { + auto ls = adj_minefield_cells(c); + + for(cell* ct: ls) { if(!isIcyLand(ct) && isFire(ct)) hmod += xrate*.1; if(ct->land == laVolcano) hmod += xrate * (ct->wall == waMagma ? .4 : .2); } - forCellEx(ct, c) { + for(cell* ct: ls) { if(!isIcyLand(ct)) { // make sure that we can still enter Cocytus, // it won't heat up right away even without Orb of Winter or Orb of Speed @@ -2179,7 +2179,8 @@ EX namespace heat { cell *last = c->move(c->type-1); - forCellEx(c2, c) { + auto ls = adj_minefield_cells(c); + for(cell* c2: ls) { if(c->wall == waPartialFire) { // two partial fires adjacent are necessary to spread @@ -2300,7 +2301,7 @@ EX void livecaves() { hv = 0; if(c->monst == moDarkTroll) c->monst = moTroll; if(c->item || c->monst || c->cpdist == 0) continue; - forCellEx(c2, c) { + for(cell *c2: adj_minefield_cells(c)) { eWall w = c2->wall; if(w == waDeadfloor) hv++, bringlife.push_back(c2); else if(w == waDeadwall || (w == waDeadfloor2 && !c2->monst)) diff --git a/geom-exp.cpp b/geom-exp.cpp index f9e81981..6149121f 100644 --- a/geom-exp.cpp +++ b/geom-exp.cpp @@ -750,12 +750,13 @@ EX void showEuclideanMenu() { }); } - if(among(specialland, laMinefield, laCA) && geometry_has_alt_mine_rule()) { - dialog::addSelItem(XLAT("mine adjacency rule"), XLAT(mine_adjacency_rule ? "vertex" : WDIM == 3 ? "face" : "edge"), 'M'); + if(geometry_has_alt_mine_rule()) { + dialog::addSelItem(XLAT("adjacency rule"), XLAT(mine_adjacency_rule ? "vertex" : WDIM == 3 ? "face" : "edge"), 'M'); dialog::add_action([] { stop_game(); mine_adjacency_rule = !mine_adjacency_rule; start_game(); + addMessage(XLAT("Note: adjacency rule affects environmental effects, but not movement.")); }); }