summaryrefslogtreecommitdiffstats
path: root/source/cChunk.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-19 22:31:21 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-19 22:31:21 +0200
commit602c2ec1b1dbd923b61113dfe9d6f6fffd619159 (patch)
treefd431c2cd3116075e64d11a7df16c48a80648b2f /source/cChunk.cpp
parentFixed a possible crash when restarting / stopping the server. (diff)
downloadcuberite-602c2ec1b1dbd923b61113dfe9d6f6fffd619159.tar
cuberite-602c2ec1b1dbd923b61113dfe9d6f6fffd619159.tar.gz
cuberite-602c2ec1b1dbd923b61113dfe9d6f6fffd619159.tar.bz2
cuberite-602c2ec1b1dbd923b61113dfe9d6f6fffd619159.tar.lz
cuberite-602c2ec1b1dbd923b61113dfe9d6f6fffd619159.tar.xz
cuberite-602c2ec1b1dbd923b61113dfe9d6f6fffd619159.tar.zst
cuberite-602c2ec1b1dbd923b61113dfe9d6f6fffd619159.zip
Diffstat (limited to 'source/cChunk.cpp')
-rw-r--r--source/cChunk.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/source/cChunk.cpp b/source/cChunk.cpp
index e185ef851..ff1f7472b 100644
--- a/source/cChunk.cpp
+++ b/source/cChunk.cpp
@@ -1535,8 +1535,9 @@ void cChunk::RemoveEntity(cEntity * a_Entity)
bool cChunk::ForEachEntity(cEntityCallback & a_Callback)
{
// The entity list is locked by the parent chunkmap's CS
- for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr)
+ for (cEntityList::iterator itr = m_Entities.begin(), itr2 = itr; itr != m_Entities.end(); itr = itr2)
{
+ ++itr2;
if (a_Callback.Item(*itr))
{
return false;
@@ -1552,8 +1553,9 @@ bool cChunk::ForEachEntity(cEntityCallback & a_Callback)
bool cChunk::ForEachChest(cChestCallback & a_Callback)
{
// The blockentity list is locked by the parent chunkmap's CS
- for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr)
+ for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2)
{
+ ++itr2;
if ((*itr)->GetBlockType() != E_BLOCK_CHEST)
{
continue;
@@ -1573,8 +1575,9 @@ bool cChunk::ForEachChest(cChestCallback & a_Callback)
bool cChunk::ForEachFurnace(cFurnaceCallback & a_Callback)
{
// The blockentity list is locked by the parent chunkmap's CS
- for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr)
+ for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2)
{
+ ++itr2;
switch ((*itr)->GetBlockType())
{
case E_BLOCK_FURNACE:
@@ -1602,8 +1605,9 @@ bool cChunk::ForEachFurnace(cFurnaceCallback & a_Callback)
bool cChunk::DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback)
{
// The blockentity list is locked by the parent chunkmap's CS
- for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr)
+ for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2)
{
+ ++itr2;
if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ))
{
continue;
@@ -1633,8 +1637,9 @@ bool cChunk::DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallb
bool cChunk::DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback)
{
// The blockentity list is locked by the parent chunkmap's CS
- for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr)
+ for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2)
{
+ ++itr2;
if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ))
{
continue;