Sounds like you need to work out a data structure to contain the data for each location in the game. This data would include valid directions the player could exit from and pointers to the locations that traveling in that direction would take them. Once these location objects are all made, the code to actually move the player from node to node should be fairly straighforward.
quick pseudocode class example:
1 2 3 4 5 6 7 8 9
|
class location
{
string locName;
string description;
string north;
string south;
string east;
string west;
}
|
an object of this class could contain null strings for invalid directions and the locName of other instances of the object representing other valid locations that can be reached from the current location.
the code to do the actuall movement would just use a switch with a case for each direction. each of those cases would check if the corresponding direction string were empty, if so, you don't move, otherwise move the player to the destination.
You could just have a vector containing all the locations and movement between them handled by just searching through the vector until you find the destination locName. Keep in mind, this is just a very rough and inelegant example to show you how it could be done. If the project were large, I'd polish it up a lot and probably come up with a pointer scheme to hold the actual addresses of destination objects, but honestly, you're not writing Crysis 4. You could optimize the hell out of it and nobody would ever notice any difference. Keep it simple.