Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cMapKeys.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_CMapKeys_H
7 #define _INC_CMapKeys_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "GrayMapData.h"
13 
14 namespace GrayMapData
15 {
16  typedef int MAP_METERI_t;
17  typedef float MAP_METERf_t;
18 
19  typedef UINT32 MAP_KEY_TYPE; // map crypt key.
20 #define CMapKeys_File "MapKeys" MIME_EXT_scp
21 #define CMapKeys_Section "MapKeys"
22 
24  {
27  public:
28  HASHCODE_t m_dwHashCode; // octant id;
29  MAP_KEY_TYPE m_KeyCur; // Use this key code to read.
30  MAP_KEY_TYPE m_KeyNew; // write stuff in the key code. usually the same as m_KeyCur but allow change.
31  public:
32  CMapKey(HASHCODE_t dwHashCode = 0, MAP_KEY_TYPE KeyCur = 0, MAP_KEY_TYPE KeyNew = 0)
33  : m_dwHashCode(dwHashCode)
34  , m_KeyCur(KeyCur)
35  , m_KeyNew(KeyNew)
36  {
37  }
38  HASHCODE_t get_HashCode() const noexcept
39  {
40  return m_dwHashCode;
41  }
42  bool operator == (const CMapKey& key) const noexcept
43  {
44  return key.m_dwHashCode == m_dwHashCode ;
45  }
46  };
47 
48  class GRAYMAPDATA_LINK CMapKeys : public cArraySortStructHash<CMapKey, HASHCODE_t>
49  {
50  // TODO: Make Map keys work.
51  // a set of keys to cover the map.
52  // the server gives these to us as it allows us to see/unlock parts of the map.
53  public:
54  CMapKeys();
55  ~CMapKeys();
56 
57  int FindMapKeyIndex(MAP_METERI_t x, MAP_METERI_t y) const;
58  HRESULT AddMapKey(MAP_METERI_t x, MAP_METERI_t y, MAP_KEY_TYPE nKeyCur, MAP_KEY_TYPE nKeyNew = 0); // server gives us a key
59 
60 #ifdef USE_DEV_FEATURES
61  HRESULT AddMapKey(cVariant& vArgs);
62  HRESULT ReadMapKeys(const char* pszMapDir, const char* pszMapName);
63  HRESULT MakeMapKeys(const char* pszMapDir, const char* pszMapName, bool bAllNew);
64 #endif
65 
66  protected:
67  static HASHCODE_t MakeHashCode(MAP_METERI_t x, MAP_METERI_t y);
68  };
69 };
70 
71 #endif // _INC_CMapKeys_H
#define GRAYMAPDATA_LINK
Definition: GrayMapData.h:13
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cVariant.h:26
Definition: cMapKeys.h:24
HASHCODE_t get_HashCode() const noexcept
Definition: cMapKeys.h:38
MAP_KEY_TYPE m_KeyNew
Definition: cMapKeys.h:30
MAP_KEY_TYPE m_KeyCur
Definition: cMapKeys.h:29
HASHCODE_t m_dwHashCode
Definition: cMapKeys.h:28
CMapKey(HASHCODE_t dwHashCode=0, MAP_KEY_TYPE KeyCur=0, MAP_KEY_TYPE KeyNew=0)
Definition: cMapKeys.h:32
Definition: cMapKeys.h:49
Definition: cArraySort.h:363
Definition: GrayMapData.cpp:12
UINT32 MAP_KEY_TYPE
Definition: cMapKeys.h:19
int MAP_METERI_t
integer meters for the location of a patch. MAP_METER_t
Definition: cMapKeys.h:16
float MAP_METERf_t
Height meters dont need double accuracy. MAP_METER_t.
Definition: cMapKeys.h:17
UINT_PTR HASHCODE_t
could hold a pointer converted to a number? maybe 64 or 32 bit ? same as size_t.
Definition: GrayCore.h:116
bool operator==(const cTimeDouble &dt1, const cTimeDouble &dt2)
Definition: cTimeDouble.h:250