diff options
| author | oy <Tom_Adams@web.de> | 2011-03-31 15:13:49 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-03-31 15:13:49 +0200 |
| commit | 2a72c0b38b8c2610001f24340097ad3a1b052263 (patch) | |
| tree | aee816df77e1f1ac772d5a797b822d2ffc0c09b5 /src/engine/shared/mapchecker.h | |
| parent | 59d56cd332ecc86008c27326631566a4d2d94ecb (diff) | |
| download | zcatch-2a72c0b38b8c2610001f24340097ad3a1b052263.tar.gz zcatch-2a72c0b38b8c2610001f24340097ad3a1b052263.zip | |
added a mechanism to check for a valid standard map. Closes #132
Diffstat (limited to 'src/engine/shared/mapchecker.h')
| -rw-r--r-- | src/engine/shared/mapchecker.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/engine/shared/mapchecker.h b/src/engine/shared/mapchecker.h new file mode 100644 index 00000000..0d4332d9 --- /dev/null +++ b/src/engine/shared/mapchecker.h @@ -0,0 +1,38 @@ +/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ +/* If you are missing that file, acquire a complete release at teeworlds.com. */ +#ifndef ENGINE_SHARED_MAPCHECKER_H +#define ENGINE_SHARED_MAPCHECKER_H + +#include "memheap.h" + +class CMapChecker +{ + enum + { + MAX_MAP_LENGTH=8, + }; + + struct CWhitelistEntry + { + char m_aMapName[MAX_MAP_LENGTH]; + unsigned m_MapCrc; + unsigned m_MapSize; + CWhitelistEntry *m_pNext; + }; + + class CHeap m_Whitelist; + CWhitelistEntry *m_pFirst; + + bool m_RemoveDefaultList; + + void Init(); + void SetDefaults(); + +public: + CMapChecker(); + void AddMaplist(class CMapVersion *pMaplist, int Num); + bool IsMapValid(const char *pMapName, unsigned MapCrc, unsigned MapSize); + bool ReadAndValidateMap(class IStorage *pStorage, const char *pFilename, int StorageType); +}; + +#endif |