about summary refs log tree commit diff
path: root/src/engine/shared/mapchecker.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/shared/mapchecker.h')
-rw-r--r--src/engine/shared/mapchecker.h38
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