I'm not sure I understand the need for all the code about directions ... you could just figure out which tiles need to be loaded based on the player's current position in the map
Figuring out which tile to load is what the direction code is about. It's a book keeping system to see which one to load based on your current tile and also helps to let the program know where to render that tile on the screen.
I assume you're loading tiles in the direction the player is moving? We tried that early on (long time ago so may be better now) but it was easier just to assume that in our world a player could move to any of the 8 surrounding tiles and that any of them could be drawn at any time so load all of them and to reduce any load stutters to thread the loading of the next 16 edge tiles as well.