blob: ed7e3b65dabd88246635caafe39b59c7cb68f105 (
plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#pragma once
#include "File.h"
#include "ChunkStorage.h"
#include "LevelChunk.h"
// 4J Stu - There are changes to this class for 1.8.2, but since we never use it anyway lets not worry about it
using namespace std;
class ZoneFile;
class ZoneIo;
class ZonedChunkStorage : public ChunkStorage
{
public:
static const int BIT_TERRAIN_POPULATED;
static const int CHUNKS_PER_ZONE_BITS; // = 32
static const int CHUNKS_PER_ZONE; // ^2
static const int CHUNK_WIDTH;
static const int CHUNK_HEADER_SIZE;
static const int CHUNK_SIZE;
static const int CHUNK_LAYERS ;
static const int CHUNK_SIZE_BYTES;
static const ByteOrder BYTEORDER;
File dir;
private:
unordered_map<__int64, ZoneFile *> zoneFiles;
__int64 tickCount;
public:
ZonedChunkStorage(File dir);
private:
int getSlot(int x, int z);
ZoneFile *getZoneFile(int x, int z, bool create);
ZoneIo *getBuffer(int x, int z, bool create);
public:
LevelChunk *load(Level *level, int x, int z);
void save(Level *level, LevelChunk *lc);
void tick();
void flush();
void loadEntities(Level *level, LevelChunk *lc);
void saveEntities(Level *level, LevelChunk *lc);
};
|