summaryrefslogtreecommitdiffstats
path: root/source/Chunk.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-04-01 22:56:25 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-04-01 22:56:25 +0200
commit578560d2132188279e4b0930212edd915bc90008 (patch)
tree2519ecc38e0124bd58916b409f9222ee410c7e5e /source/Chunk.cpp
parentHotfix for FS #347. (diff)
downloadcuberite-578560d2132188279e4b0930212edd915bc90008.tar
cuberite-578560d2132188279e4b0930212edd915bc90008.tar.gz
cuberite-578560d2132188279e4b0930212edd915bc90008.tar.bz2
cuberite-578560d2132188279e4b0930212edd915bc90008.tar.lz
cuberite-578560d2132188279e4b0930212edd915bc90008.tar.xz
cuberite-578560d2132188279e4b0930212edd915bc90008.tar.zst
cuberite-578560d2132188279e4b0930212edd915bc90008.zip
Diffstat (limited to '')
-rw-r--r--source/Chunk.cpp35
1 files changed, 9 insertions, 26 deletions
diff --git a/source/Chunk.cpp b/source/Chunk.cpp
index 9121dd112..ad534f634 100644
--- a/source/Chunk.cpp
+++ b/source/Chunk.cpp
@@ -296,14 +296,8 @@ void cChunk::SetAllData(
CalculateHeightmap();
}
- // Initialize incoming entities:
- for (cEntityList::iterator itr = a_Entities.begin(), end = a_Entities.end(); itr != end; ++itr)
- {
- (*itr)->Initialize(m_World);
- } // for itr - a_Entities[]
-
// Append entities to current entity list:
- m_Entities.splice(m_Entities.end(), a_Entities);
+ m_Entities.insert(m_Entities.end(), a_Entities.begin(), a_Entities.end());
// Clear the block entities present - either the loader / saver has better, or we'll create empty ones:
for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr)
@@ -456,24 +450,13 @@ void cChunk::Tick(float a_Dt, MTRand & a_TickRandom)
TickBlocks(a_TickRandom);
- // Tick block entities (furnaces)
+ // Tick all block entities in this chunk:
for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr)
{
- if ((*itr)->GetBlockType() == E_BLOCK_FURNACE)
- {
- m_IsDirty = ((cFurnaceEntity *)(*itr))->Tick( a_Dt ) | m_IsDirty;
- }
+ m_IsDirty = (*itr)->Tick(a_Dt) | m_IsDirty;
}
-
- // Tick block entities (dispensers)
- for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr)
- {
- if ((*itr)->GetBlockType() == E_BLOCK_DISPENSER)
- {
- m_IsDirty = ((cDispenserEntity *)(*itr))->Tick( a_Dt ) | m_IsDirty;
- }
- }
- ApplyWeatherToTop(a_TickRandom);
+
+ ApplyWeatherToTop();
}
@@ -570,10 +553,10 @@ void cChunk::TickBlocks(MTRand & a_TickRandom)
-void cChunk::ApplyWeatherToTop(MTRand & a_TickRandom)
+void cChunk::ApplyWeatherToTop()
{
if (
- (a_TickRandom.randInt(100) != 0) ||
+ (m_World->GetTickRandomNumber(100) != 0) ||
(
(m_World->GetWeather() != eWeather_Rain) &&
(m_World->GetWeather() != eWeather_ThunderStorm)
@@ -584,8 +567,8 @@ void cChunk::ApplyWeatherToTop(MTRand & a_TickRandom)
return;
}
- int X = a_TickRandom.randInt(15);
- int Z = a_TickRandom.randInt(15);
+ int X = m_World->GetTickRandomNumber(15);
+ int Z = m_World->GetTickRandomNumber(15);
switch (GetBiomeAt(X, Z))
{
case biTaiga: