| 99 | |
| 100 | |
| 101 | void cChunkGenerator::QueueGenerateChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) |
| 102 | { |
| 103 | { |
| 104 | cCSLock Lock(m_CS); |
| 105 | |
| 106 | // Check if it is already in the queue: |
| 107 | for (cChunkCoordsList::iterator itr = m_Queue.begin(); itr != m_Queue.end(); ++itr) |
| 108 | { |
| 109 | if ((itr->m_ChunkX == a_ChunkX) && (itr->m_ChunkY == a_ChunkY) && (itr->m_ChunkZ == a_ChunkZ)) |
| 110 | { |
| 111 | // Already in the queue, bail out |
| 112 | return; |
| 113 | } |
| 114 | } // for itr - m_Queue[] |
| 115 | |
| 116 | // Add to queue, issue a warning if too many: |
| 117 | if (m_Queue.size() >= QUEUE_WARNING_LIMIT) |
| 118 | { |
| 119 | LOGWARN("WARNING: Adding chunk [%i, %i] to generation queue; Queue is too big! (" SIZE_T_FMT ")", a_ChunkX, a_ChunkZ, m_Queue.size()); |
| 120 | } |
| 121 | m_Queue.push_back(cChunkCoords(a_ChunkX, a_ChunkY, a_ChunkZ)); |
| 122 | } |
| 123 | |
| 124 | m_Event.Set(); |
| 125 | } |
| 126 | |
| 127 | |
| 128 | |