Fix revflood bug, was revealing some tiles from below inappropriately

When scanning floor tiles from below, don't just leave them hidden, but
skip checking neighbors as well
develop
Quietust 2018-06-09 14:19:52 -06:00
parent 69cf5756c3
commit 8717144f14
1 changed files with 39 additions and 33 deletions

@ -407,10 +407,12 @@ command_result revflood(color_ostream &out, vector<string> & params)
continue; continue;
} }
// use base tile (beneath constructions/ice), to avoid bug #1871 // we don't want constructions or ice to restrict vision (to avoid bug #1871)
// so use the base tile beneath it
df::tiletype tt = MCache->baseTiletypeAt(current); df::tiletype tt = MCache->baseTiletypeAt(current);
// unless the actual tile is a downward stairway // UNLESS the actual tile has more visibility than the base
// i.e. if it's a downward or up/down stairway
df::tiletype ctt = MCache->tiletypeAt(current); df::tiletype ctt = MCache->tiletypeAt(current);
switch (tileShape(ctt)) switch (tileShape(ctt))
{ {
@ -422,19 +424,19 @@ command_result revflood(color_ostream &out, vector<string> & params)
break; break;
} }
bool below = 0; bool below = false;
bool above = 0; bool above = false;
bool sides = 0; bool sides = false;
bool unhide = 1; bool unhide = true;
// by tile shape, determine behavior and action // By tile shape, determine behavior and action
switch (tileShape(tt)) switch (tileShape(tt))
{ {
// walls: // Walls
case tiletype_shape::WALL: case tiletype_shape::WALL:
if (from_below) if (from_below)
unhide = 0; unhide = false;
break; break;
// air/free space // Open space
case tiletype_shape::NONE: case tiletype_shape::NONE:
case tiletype_shape::EMPTY: case tiletype_shape::EMPTY:
case tiletype_shape::RAMP_TOP: case tiletype_shape::RAMP_TOP:
@ -443,7 +445,7 @@ command_result revflood(color_ostream &out, vector<string> & params)
case tiletype_shape::BROOK_TOP: case tiletype_shape::BROOK_TOP:
above = below = sides = true; above = below = sides = true;
break; break;
// has floor // Floors
case tiletype_shape::FORTIFICATION: case tiletype_shape::FORTIFICATION:
case tiletype_shape::STAIR_UP: case tiletype_shape::STAIR_UP:
case tiletype_shape::RAMP: case tiletype_shape::RAMP:
@ -458,14 +460,17 @@ command_result revflood(color_ostream &out, vector<string> & params)
case tiletype_shape::BROOK_BED: case tiletype_shape::BROOK_BED:
case tiletype_shape::ENDLESS_PIT: case tiletype_shape::ENDLESS_PIT:
if (from_below) if (from_below)
unhide = 0; unhide = false;
else
above = sides = true; above = sides = true;
break; break;
} }
// Special case for trees - always reveal them as if they were floor tiles
if (tileMaterial(tt) == tiletype_material::PLANT || tileMaterial(tt) == tiletype_material::MUSHROOM) if (tileMaterial(tt) == tiletype_material::PLANT || tileMaterial(tt) == tiletype_material::MUSHROOM)
{ {
if (from_below) if (from_below)
unhide = 0; unhide = false;
else
above = sides = true; above = sides = true;
} }
if (unhide) if (unhide)
@ -475,6 +480,7 @@ command_result revflood(color_ostream &out, vector<string> & params)
} }
if (sides) if (sides)
{ {
// Scan adjacent tiles clockwise, starting toward east
flood.push(foo(DFCoord(current.x + 1, current.y , current.z), false)); flood.push(foo(DFCoord(current.x + 1, current.y , current.z), false));
flood.push(foo(DFCoord(current.x + 1, current.y + 1, current.z), false)); flood.push(foo(DFCoord(current.x + 1, current.y + 1, current.z), false));
flood.push(foo(DFCoord(current.x , current.y + 1, current.z), false)); flood.push(foo(DFCoord(current.x , current.y + 1, current.z), false));