mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-19 04:26:52 -04:00
cache World.Blocks/World.Blocks2 in ReadChunkData
Otherwise it gets reloaded from memory every single time, i.e. at least width*height*length times
This commit is contained in:
parent
cee0fd38c2
commit
c1d61af91f
@ -258,18 +258,21 @@ for (yy = -1; yy < 17; ++yy) {\
|
|||||||
}
|
}
|
||||||
|
|
||||||
static cc_bool ReadChunkData(int x1, int y1, int z1, cc_bool* outAllAir) {
|
static cc_bool ReadChunkData(int x1, int y1, int z1, cc_bool* outAllAir) {
|
||||||
|
BlockRaw* blocks = World.Blocks;
|
||||||
|
BlockRaw* blocks2;
|
||||||
cc_bool allAir = true, allSolid = true;
|
cc_bool allAir = true, allSolid = true;
|
||||||
int index, cIndex;
|
int index, cIndex;
|
||||||
BlockID block;
|
BlockID block;
|
||||||
int xx, yy, zz, y;
|
int xx, yy, zz, y;
|
||||||
|
|
||||||
#ifndef EXTENDED_BLOCKS
|
#ifndef EXTENDED_BLOCKS
|
||||||
ReadChunkBody(World.Blocks[index]);
|
ReadChunkBody(blocks[index]);
|
||||||
#else
|
#else
|
||||||
if (World.IDMask <= 0xFF) {
|
if (World.IDMask <= 0xFF) {
|
||||||
ReadChunkBody(World.Blocks[index]);
|
ReadChunkBody(blocks[index]);
|
||||||
} else {
|
} else {
|
||||||
ReadChunkBody(World.Blocks[index] | (World.Blocks2[index] << 8));
|
blocks2 = World.Blocks2;
|
||||||
|
ReadChunkBody(blocks[index] | (blocks2[index] << 8));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -304,18 +307,21 @@ for (yy = -1; yy < 17; ++yy) {\
|
|||||||
}
|
}
|
||||||
|
|
||||||
static cc_bool ReadBorderChunkData(int x1, int y1, int z1, cc_bool* outAllAir) {
|
static cc_bool ReadBorderChunkData(int x1, int y1, int z1, cc_bool* outAllAir) {
|
||||||
|
BlockRaw* blocks = World.Blocks;
|
||||||
|
BlockRaw* blocks2;
|
||||||
cc_bool allAir = true;
|
cc_bool allAir = true;
|
||||||
int index, cIndex;
|
int index, cIndex;
|
||||||
BlockID block;
|
BlockID block;
|
||||||
int xx, yy, zz, x, y, z;
|
int xx, yy, zz, x, y, z;
|
||||||
|
|
||||||
#ifndef EXTENDED_BLOCKS
|
#ifndef EXTENDED_BLOCKS
|
||||||
ReadBorderChunkBody(World.Blocks[index]);
|
ReadBorderChunkBody(blocks[index]);
|
||||||
#else
|
#else
|
||||||
if (World.IDMask <= 0xFF) {
|
if (World.IDMask <= 0xFF) {
|
||||||
ReadBorderChunkBody(World.Blocks[index]);
|
ReadBorderChunkBody(blocks[index]);
|
||||||
} else {
|
} else {
|
||||||
ReadBorderChunkBody(World.Blocks[index] | (World.Blocks2[index] << 8));
|
blocks2 = World.Blocks2;
|
||||||
|
ReadBorderChunkBody(blocks[index] | (blocks2[index] << 8));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user