mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 18:00:34 +00:00
more efficient gate toggling algorithm
This commit is contained in:
parent
2dfc12799d
commit
e6a5c41c9b
9
game.cpp
9
game.cpp
@ -3136,8 +3136,10 @@ bool makeEmpty(cell *c) {
|
||||
|
||||
int numgates = 0;
|
||||
|
||||
void toggleGates(cell *ct, eWall type, int rad) {
|
||||
if(!ct) return;
|
||||
void toggleGates(cell *c, eWall type, int rad) {
|
||||
if(!c) return;
|
||||
celllister cl(c, rad, 1000000, NULL);
|
||||
for(cell *ct: cl.lst) {
|
||||
if(ct->wall == waOpenGate && type == waClosePlate) {
|
||||
bool onWorm = false;
|
||||
if(isWorm(ct)) onWorm = true;
|
||||
@ -3155,8 +3157,7 @@ void toggleGates(cell *ct, eWall type, int rad) {
|
||||
}
|
||||
if(ct->wall == waClosedGate && type == waOpenPlate)
|
||||
ct->wall = waOpenGate, rad = 1, numgates++;
|
||||
if(rad) for(int i=0; i<ct->type; i++)
|
||||
toggleGates(ct->mov[i], type, rad-1);
|
||||
}
|
||||
}
|
||||
|
||||
void toggleGates(cell *ct, eWall type) {
|
||||
|
Loading…
Reference in New Issue
Block a user