DDraceNetwork Docs
map.h
Go to the documentation of this file.
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
10enum
11{
12 MAX_MAP_LENGTH = 128
13};
14
15class IMap : public IInterface
16{
18public:
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
34class IEngineMap : public IMap
35{
36 MACRO_INTERFACE("enginemap")
37public:
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
49
50#endif
Definition: map.h:35
Definition: kernel.h:10
Definition: map.h:16
virtual int NumData() const =0
virtual void * GetItem(int Index, int *pType=nullptr, int *pId=nullptr)=0
virtual int GetItemSize(int Index)=0
virtual const char * GetDataString(int Index)=0
virtual void * GetData(int Index)=0
virtual void * GetDataSwapped(int Index)=0
virtual int GetDataSize(int Index) const =0
virtual void GetType(int Type, int *pStart, int *pNum)=0
virtual int NumItems() const =0
virtual void * FindItem(int Type, int Id)=0
virtual void UnloadData(int Index)=0
virtual int FindItemIndex(int Type, int Id)=0
#define MACRO_INTERFACE(Name)
Definition: kernel.h:25
void * IOHANDLE
Definition: logger.h:11
@ MAX_MAP_LENGTH
Definition: map.h:12
IEngineMap * CreateEngineMap()
Definition: map.cpp:179
Definition: hash.h:15