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_SHARED_MAP_H
4#define ENGINE_SHARED_MAP_H
5
6#include <base/types.h>
7
8#include "datafile.h"
9#include <engine/map.h>
10
11class CMap : public IEngineMap
12{
13 CDataFileReader m_DataFile;
14
15public:
16 CMap();
17
18 CDataFileReader *GetReader() { return &m_DataFile; }
19
20 int GetDataSize(int Index) const override;
21 void *GetData(int Index) override;
22 void *GetDataSwapped(int Index) override;
23 const char *GetDataString(int Index) override;
24 void UnloadData(int Index) override;
25 int NumData() const override;
26
27 int GetItemSize(int Index) override;
28 void *GetItem(int Index, int *pType = nullptr, int *pId = nullptr) override;
29 void GetType(int Type, int *pStart, int *pNum) override;
30 int FindItemIndex(int Type, int Id) override;
31 void *FindItem(int Type, int Id) override;
32 int NumItems() const override;
33
34 bool Load(const char *pMapName) override;
35 void Unload() override;
36 bool IsLoaded() const override;
37 IOHANDLE File() const override;
38
39 SHA256_DIGEST Sha256() const override;
40 unsigned Crc() const override;
41 int MapSize() const override;
42
43 static void ExtractTiles(class CTile *pDest, size_t DestSize, const class CTile *pSrc, size_t SrcSize);
44};
45
46#endif
47