Maybe you should try making a 2d array (with constant sizes) of Tiles in the Map, rather than 3 layers of pointers. Why do you want 3d any way? It might be a nightmare to manage, and it is better to start with something simple first, get it working, then move to more complexity later.
One way to do things, is to have a CRoom class which has a 2d array of CTile objects, then have a CGameMap class which has a
std::list
of CRoom objects. The user moves from one room to the next in a linear fashion.
With the names, I would just have Tile instead of TileLocation as the location is stored in the map. The Tile class only stored info about the tile itself. It is also a good idea to make the file names the same as the class names, which should happen automatically if you use a class wizard in your IDE.
I put a leading C on my class names (e.g. CTile), and a leading p on pointer variables - but that is just me (some people hate doing this). Also, I start member variables with m_ , and use CamelCase rather than underscores (e.g. m_MapSizeX), this makes it easier to name arguments (e.g. MapSizeX). These last two are much common conventions. Too many underscores make the variable names too long IMO.
I used to have
protected
member variables - (why do you want to inherit from Map any way?) , but I have recently learnt that it is better to make them all private, and provide functions that form an interface to the class.
Finally, try to avoid
using namespace std;
it brings the whole std namespace into the global namespace, polluting it and causing naming conflicts. Did you know that
std::map
is an STL data container?
Instead, either put
std::
before each std thing (std::string say), or do this :
1 2 3
|
using std::cin;
using std::cout;
using sdtd::endl;
|
I do a mixture - have using statements for things that appear frequently, and put
std::
for things which only appear a couple of times.
HTH