How about, instead of this cycle, you have a list of XYZ coords to be checked, with each coord having another coord to be checked for air (remember, bookcases behind torches don't count):
```cpp
static const struct
{
  int m_BookX, m_BookY, m_BookZ;  // Coords to check for bookcases
  int m_AirX, m_AirY, m_AirZ;  // Coords to check for air; if not air, the bookcase won't be counted
} CheckCoords[] =
{
  {-2, 0, -2, -1, 0, -1},  // Bookcase at {-2, 0, -2}, air at {-1, 0, -1}
  ...
};

for (size_t i = 0; i < ARRAYCOUNT(CheckCoords); i++)
{
  if (
    (Area.GetRelBlockType(CheckCoords[i].m_AirX, ...) == E_BLOCK_AIR) &&  // There's air in the checkspot
    (Area.GetRelBlockType(CheckCoords[i].m_BookX, ...) == E_BLOCK_BOOKCASE)  // There's bookcase in the wanted place
  )
  {
    NumBookcases++;
  }
}  // for i - CheckCoords
```