So I have 4 rooms, all with unique names, descriptions and values. Now I wanna link them together through south, north, west and east. What would be the most efficient way to do this? In python I used dictionaries and that worked just fine but I am still a bit unfamiliar with C++. Any advice?
Assume you have a var called currentRoom and the player wants to go East.
In this case you assign currentRoom to currentRoom.getExit(Direction::East);
Of course you could also return a pointer in case there is no exit
the most efficient way would be to have 4 pointers, for each direction, that point to the destination room in that direction. But the map is way better. If you do it with 4 pointers, you save a couple of nanoseconds doing an extra lookup or two inside the <map> but you lose the flexibility of adding a NE exit later, or an up/down stairs component, etc. Having it in the map, you can add these with minimal effort so its the cleaner answer. Often speed and design are at odds, and the answer for 'most efficient' is quite often not the answer for 'good approach'. Comes down to picking your battles... find where the code is slow and needs a tweak, and you can do something odd there if needed, and keep to good design everywhere you can as much as possible.