Doors and Corners, that’s where they get you. Seriously, doors are a staple of the roguelike and dungeon bashing genres. This chapter will help you place doors, make them openable, and ensure that line-of-sight and movement blocking are enforced correctly for closed doors - and not for open ones.
http://bfnightly.bracketproductions.com/rustbook/chapter_40.html