From 31a11a6df4922b590a50a5ff3d3c00d42a45599d Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Mon, 23 Jul 2018 19:12:51 +0100 Subject: Optimise chunk set (#4260) Closes #1244 Initially I was just going to add the cChunkData to cSetChunkData but profiling revealed that the copying wasn't even the biggest slowdown. Much more time was being spent in cChunk::CreateBlockEntities and cChunk::WakeUpSimulators than was in memcpy so I've made those significantly faster as well. Optimisations performed: * cSetChunkData now stores blocks in a cChunkData object * cChunkData objects can now perform moves even if they are using different pools * cChunk::CreateBlockEntities now iterates in the correct order and only over present chunk sections * Similarly for cChunk::WakeUpSimulators * cSetChunkData::CalculateHeightMap now shortcuts to the highest present chunk section before checking blocks directly --- src/Chunk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Chunk.h') diff --git a/src/Chunk.h b/src/Chunk.h index 18b3e9482..2ca8a751a 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -129,7 +129,7 @@ public: void WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes); /** Returns true if there is a block entity at the coords specified */ - bool HasBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ); + bool HasBlockEntityAt(Vector3i a_BlockPos); /** Sets or resets the internal flag that prevents chunk from being unloaded. The flag is cumulative - it can be set multiple times and then needs to be un-set that many times -- cgit v1.2.3