File: BlockDecoder.h

package info (click to toggle)
minetestmapper 20180325-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 236 kB
  • sloc: cpp: 2,101; ansic: 32; makefile: 9; sh: 9
file content (35 lines) | stat: -rw-r--r-- 638 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef BLOCKDECODER_H
#define BLOCKDECODER_H

#if __cplusplus >= 201103L
#include <unordered_map>
#else
#include <map>
#endif

#include "types.h"

class BlockDecoder {
public:
	BlockDecoder();

	void reset();
	void decode(const ustring &data);
	bool isEmpty() const;
	std::string getNode(u8 x, u8 y, u8 z) const; // returns "" for air, ignore and invalid nodes

private:
#if __cplusplus >= 201103L
	typedef std::unordered_map<int, std::string> NameMap;
#else
	typedef std::map<int, std::string> NameMap;
#endif
	NameMap m_nameMap;
	int m_blockAirId;
	int m_blockIgnoreId;

	u8 m_version;
	ustring m_mapData;
};

#endif // BLOCKDECODER_H