summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-08-08 13:09:40 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-08-08 13:09:40 +0200
commit2f79ab2e2619925f378ff7a19b183f6b3ee6ce79 (patch)
treeff16dbe0c6f3b7d40d50733308d3a4be77687307
parentAdd documentation for @tigerw's new CMake flags (#4814) (diff)
downloadcuberite-2f79ab2e2619925f378ff7a19b183f6b3ee6ce79.tar
cuberite-2f79ab2e2619925f378ff7a19b183f6b3ee6ce79.tar.gz
cuberite-2f79ab2e2619925f378ff7a19b183f6b3ee6ce79.tar.bz2
cuberite-2f79ab2e2619925f378ff7a19b183f6b3ee6ce79.tar.lz
cuberite-2f79ab2e2619925f378ff7a19b183f6b3ee6ce79.tar.xz
cuberite-2f79ab2e2619925f378ff7a19b183f6b3ee6ce79.tar.zst
cuberite-2f79ab2e2619925f378ff7a19b183f6b3ee6ce79.zip
-rw-r--r--src/Chunk.cpp8
-rw-r--r--src/Chunk.h14
2 files changed, 11 insertions, 11 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index e24aa7733..1aa377651 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -1715,7 +1715,7 @@ OwnedEntity cChunk::RemoveEntity(cEntity & a_Entity)
-bool cChunk::HasEntity(UInt32 a_EntityID)
+bool cChunk::HasEntity(UInt32 a_EntityID) const
{
for (const auto & Entity : m_Entities)
{
@@ -1731,7 +1731,7 @@ bool cChunk::HasEntity(UInt32 a_EntityID)
-bool cChunk::ForEachEntity(cEntityCallback a_Callback)
+bool cChunk::ForEachEntity(cEntityCallback a_Callback) const
{
// The entity list is locked by the parent chunkmap's CS
for (const auto & Entity : m_Entities)
@@ -1748,7 +1748,7 @@ bool cChunk::ForEachEntity(cEntityCallback a_Callback)
-bool cChunk::ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback a_Callback)
+bool cChunk::ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback a_Callback) const
{
// The entity list is locked by the parent chunkmap's CS
for (const auto & Entity : m_Entities)
@@ -1774,7 +1774,7 @@ bool cChunk::ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback a_Ca
-bool cChunk::DoWithEntityByID(UInt32 a_EntityID, cEntityCallback a_Callback, bool & a_CallbackResult)
+bool cChunk::DoWithEntityByID(UInt32 a_EntityID, cEntityCallback a_Callback, bool & a_CallbackResult) const
{
// The entity list is locked by the parent chunkmap's CS
for (const auto & Entity : m_Entities)
diff --git a/src/Chunk.h b/src/Chunk.h
index d88b16555..25de55ec6 100644
--- a/src/Chunk.h
+++ b/src/Chunk.h
@@ -250,17 +250,17 @@ public:
Returns an owning reference to the found entity. */
OwnedEntity RemoveEntity(cEntity & a_Entity);
- bool HasEntity(UInt32 a_EntityID);
+ bool HasEntity(UInt32 a_EntityID) const;
/** Calls the callback for each entity; returns true if all entities processed, false if the callback aborted by returning true */
- bool ForEachEntity(cEntityCallback a_Callback); // Lua-accessible
+ bool ForEachEntity(cEntityCallback a_Callback) const; // Lua-accessible
/** Calls the callback for each entity that has a nonempty intersection with the specified boundingbox.
Returns true if all entities processed, false if the callback aborted by returning true. */
- bool ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback a_Callback); // Lua-accessible
+ bool ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback a_Callback) const; // Lua-accessible
/** Calls the callback if the entity with the specified ID is found, with the entity object as the callback param. Returns true if entity found. */
- bool DoWithEntityByID(UInt32 a_EntityID, cEntityCallback a_Callback, bool & a_CallbackResult); // Lua-accessible
+ bool DoWithEntityByID(UInt32 a_EntityID, cEntityCallback a_Callback, bool & a_CallbackResult) const; // Lua-accessible
/** Calls the callback for each tyEntity; returns true if all block entities processed, false if the callback aborted by returning true
tBlocktypes are all blocktypes convertible to tyEntity which are to be called. If no block type is given the callback is called for every block entity
@@ -516,10 +516,10 @@ public:
// Per-chunk simulator data:
cFireSimulatorChunkData & GetFireSimulatorData (void) { return m_FireSimulatorData; }
- cFluidSimulatorData * GetWaterSimulatorData(void) { return m_WaterSimulatorData; }
- cFluidSimulatorData * GetLavaSimulatorData (void) { return m_LavaSimulatorData; }
+ cFluidSimulatorData * GetWaterSimulatorData(void) const { return m_WaterSimulatorData; }
+ cFluidSimulatorData * GetLavaSimulatorData (void) const { return m_LavaSimulatorData; }
cSandSimulatorChunkData & GetSandSimulatorData (void) { return m_SandSimulatorData; }
- cRedstoneSimulatorChunkData * GetRedstoneSimulatorData(void) { return m_RedstoneSimulatorData; }
+ cRedstoneSimulatorChunkData * GetRedstoneSimulatorData(void) const { return m_RedstoneSimulatorData; }
/** Returns the block entity at the specified (absolute) coords.
Returns nullptr if no such BE or outside this chunk. */