1
0

Fixed a generator bug

This commit is contained in:
Tiger Wang 2014-01-24 23:56:19 +00:00
parent b367a74d3e
commit 1112f5adc6
2 changed files with 9 additions and 1 deletions

View File

@ -201,7 +201,7 @@ void cChunkGenerator::Execute(void)
while (!m_ShouldTerminate) while (!m_ShouldTerminate)
{ {
cCSLock Lock(m_CS); cCSLock Lock(m_CS);
while (m_Queue.size() == 0) while (m_Queue.empty())
{ {
if ((NumChunksGenerated > 16) && (clock() - LastReportTick > CLOCKS_PER_SEC)) if ((NumChunksGenerated > 16) && (clock() - LastReportTick > CLOCKS_PER_SEC))
{ {
@ -221,6 +221,11 @@ void cChunkGenerator::Execute(void)
LastReportTick = clock(); LastReportTick = clock();
} }
if (m_Queue.empty())
{
continue;
}
cChunkCoords coords = m_Queue.front(); // Get next coord from queue cChunkCoords coords = m_Queue.front(); // Get next coord from queue
m_Queue.erase( m_Queue.begin() ); // Remove coordinate from queue m_Queue.erase( m_Queue.begin() ); // Remove coordinate from queue
bool SkipEnabled = (m_Queue.size() > QUEUE_SKIP_LIMIT); bool SkipEnabled = (m_Queue.size() > QUEUE_SKIP_LIMIT);

View File

@ -249,6 +249,9 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk)
return; return;
} }
if ((m_Target != NULL) && m_Target->IsDestroyed())
m_Target = NULL;
// Burning in daylight // Burning in daylight
HandleDaylightBurning(a_Chunk); HandleDaylightBurning(a_Chunk);