Quote: Conner McCloud answers: Why are edge tiles a distinct type? It seems as though the easiest solution is to just not assign those pointers at all, and drop the entire concept of an edge tile.
Quote:Rip-off answers: how about having only one tile class, and having the edge tiles have NULL pointers to their non-existant neighbours.
Hopefully this can explain why I chose to do it this way:
Each corner of a tile is an independent height. The height of a corner is stored by the tile of which it is the top-left corner. That is each tile stores one height - the height of it's top left corner. The image below illustrates which tile controls the height of each corner:
Notice that the white corners are not top-left corners of any tile. The height of these corners tiles is therefore undefined.
Rather than making these corners a special case, I simply leave them as undefined. This does mean that the tiles they are part of cannot be drawn, or involved in any function requiring knowledge of the corner heights. Therefore such tiles are effectively fake tiles. They are only there to hold a height value necessary for the tiles adjacent to them.