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