[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2.4.4 RoomCoordinate Class

This is a very simple class that keeps track of a coordinate in the maze:

 
class RoomCoordinate
{
public:
  int x, y, z;
  RoomCoordinate () : x (0), y (0), z (0) { }
  RoomCoordinate (int x, int y, int z) : x (x), y (y), z (z) { }
  RoomCoordinate (const RoomCoordinate& rc) : x (rc.x), y (rc.y), z (rc.z) { }
# ifdef CS_DEBUG
  static bool IsValid (int x, int y, int z)
  {
    return (x >= 0 && x < MAZE_DIMENSION &&
	    y >= 0 && y < MAZE_DIMENSION &&
	    z >= 0 && z < MAZE_DIMENSION);
  }
  bool IsValid () const
  {
    return IsValid (x, y, z);
  }
# endif
};

One special thing in this class is the usage of the `CS_DEBUG' define. When your application is compiled in debug mode this define will be set. This means that you can do additional checks in debug mode that will disappear in optimize/release mode. This is very useful during development.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated using texi2html 1.76.