Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
cMapChanSurface.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_CMapChanSurface_H
7 #define _INC_CMapChanSurface_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cMapBase.h"
13 
14 namespace GrayMapData
15 {
17  {
23  private:
24  MAP_SURFACE_ID_t* m_pSurf; // store the X*Y grid of MAP_SURFACE_ID_t
25  size_t m_iPitch; // bytes
26 
27  public:
29  : m_pSurf(nullptr)
30  , m_iPitch(0)
31  {
32  }
34  {
35  EmptySurf();
36  }
38  {
39  ASSERT(IS_INDEX_GOOD(px, 1025) && IS_INDEX_GOOD(py, 1025));
40  return m_pSurf + (py*m_iPitch) + px;
41  }
43  {
44  // get raw surface id at a point.
45  // ARGS: x,y = coords offset in the patch
46  if (m_pSurf == nullptr)
47  return MAP_SURFACE_Legacy; // no idea. not loaded ??
48  return *GetSurfPtr(px, py);
49  }
50  void EmptySurf()
51  {
52  if (m_pSurf != nullptr)
53  {
54  delete m_pSurf;
55  m_pSurf = nullptr;
56  }
57  }
58  };
59 }
60 
61 #endif
#define GRAYMAPDATA_LINK
Definition: GrayMapData.h:13
#define IS_INDEX_GOOD(i, q)
cast the (likely) int to unsigned to check for negatives.
Definition: Index.h:35
#define ASSERT(exp)
Definition: cDebugAssert.h:87
Definition: cMapChanSurface.h:17
void EmptySurf()
Definition: cMapChanSurface.h:50
MAP_SURFACE_ID_t GetSurf(MAP_PATCH_POINT_t px, MAP_PATCH_POINT_t py) const
Definition: cMapChanSurface.h:42
~CMapChanSurface()
Definition: cMapChanSurface.h:33
CMapChanSurface()
Definition: cMapChanSurface.h:28
MAP_SURFACE_ID_t * GetSurfPtr(MAP_PATCH_POINT_t px, MAP_PATCH_POINT_t py) const
Definition: cMapChanSurface.h:37
Definition: GrayMapData.cpp:12
int MAP_PATCH_POINT_t
this gives the number of samples in the heightmap file: 128 means a 129x129 file (include skirt pixel...
Definition: cMapBase.h:42
BYTE MAP_SURFACE_ID_t
Definition: cMapBase.h:114
@ MAP_SURFACE_Legacy
For MAP_CHANNEL_Surface.
Definition: cMapBase.h:118