Hopefully this C# is okay for you - my c++ is very rusty:
abstract class MapFeature
{
public void Draw();
public bool IsWall();
}
enum Direction
{
North, South, East, West
}
class Wall : MapFeature
{
public bool IsWall() { return true; }
public Tile Front, Back; // Tiles on either side of the wall, otherwise null.
#region Implementation of MapFeature
public void Draw()
{
// Wall specific drawing code...
}
#endregion
}
class Tile : MapFeature
{
public bool IsWall() { return false; }
public MapFeature North, South, East, West; // Tiles/Walls on each side, otherwise null
public bool CanGo(Direction direction)
{
switch (direction)
{
case Direction.North:
return !North.IsWall();
case Direction.South:
return !South.IsWall();
case Direction.East:
return !East.IsWall();
case Direction.West:
return !West.IsWall();
default:
throw new ArgumentOutOfRangeException("direction");
}
}
#region Implementation of MapFeature
public void Draw()
{
// Tile specific drawing code...
}
#endregion
}
You can add wall-specific information to the Wall class, Tile specific information to the Tile class, and further refine conditions in the "CanGo" method. For example, when a wall is actually a locked door - say, a Door class.
In order to draw this, you would start with some arbitrary tile - say the tile in the middle of the current camera position. Then move toward and to the left of the camera according to the size of the tiles. Then do a breadth-first traversal of the IMapFeature nodes, drawing each wall/tile in the order encountered.
A* will work on this structure, though you would obviously need some modifications to handle something like locked doors.
If you wanted to, you could also maintain a spatial index of the tiles, which would implicitly include the walls, in order to find out which tiles were within camera bounds.
You'd still only need to pick a starting tile and a distance to traverse based on tile size.