1 | /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ |
2 | /* If you are missing that file, acquire a complete release at teeworlds.com. */ |
3 | #ifndef ENGINE_MAP_H |
4 | #define ENGINE_MAP_H |
5 | |
6 | #include "kernel.h" |
7 | #include <base/hash.h> |
8 | #include <base/types.h> |
9 | |
10 | enum |
11 | { |
12 | MAX_MAP_LENGTH = 128 |
13 | }; |
14 | |
15 | class IMap : public IInterface |
16 | { |
17 | MACRO_INTERFACE("map" ) |
18 | public: |
19 | virtual int GetDataSize(int Index) const = 0; |
20 | virtual void *GetData(int Index) = 0; |
21 | virtual void *GetDataSwapped(int Index) = 0; |
22 | virtual const char *GetDataString(int Index) = 0; |
23 | virtual void UnloadData(int Index) = 0; |
24 | virtual int NumData() const = 0; |
25 | |
26 | virtual int GetItemSize(int Index) = 0; |
27 | virtual void *GetItem(int Index, int *pType = nullptr, int *pId = nullptr) = 0; |
28 | virtual void GetType(int Type, int *pStart, int *pNum) = 0; |
29 | virtual int FindItemIndex(int Type, int Id) = 0; |
30 | virtual void *FindItem(int Type, int Id) = 0; |
31 | virtual int NumItems() const = 0; |
32 | }; |
33 | |
34 | class IEngineMap : public IMap |
35 | { |
36 | MACRO_INTERFACE("enginemap" ) |
37 | public: |
38 | virtual bool Load(const char *pMapName) = 0; |
39 | virtual void Unload() = 0; |
40 | virtual bool IsLoaded() const = 0; |
41 | virtual IOHANDLE File() const = 0; |
42 | |
43 | virtual SHA256_DIGEST Sha256() const = 0; |
44 | virtual unsigned Crc() const = 0; |
45 | virtual int MapSize() const = 0; |
46 | }; |
47 | |
48 | extern IEngineMap *CreateEngineMap(); |
49 | |
50 | #endif |
51 | |