| 2210 | |
| 2211 | |
| 2212 | void cWorld::SetChunkData( |
| 2213 | int a_ChunkX, int a_ChunkZ, |
| 2214 | const BLOCKTYPE * a_BlockTypes, |
| 2215 | const NIBBLETYPE * a_BlockMeta, |
| 2216 | const NIBBLETYPE * a_BlockLight, |
| 2217 | const NIBBLETYPE * a_BlockSkyLight, |
| 2218 | const cChunkDef::HeightMap * a_HeightMap, |
| 2219 | const cChunkDef::BiomeMap * a_BiomeMap, |
| 2220 | cEntityList & a_Entities, |
| 2221 | cBlockEntityList & a_BlockEntities, |
| 2222 | bool a_MarkDirty |
| 2223 | ) |
| 2224 | { |
| 2225 | // Validate biomes, if needed: |
| 2226 | cChunkDef::BiomeMap BiomeMap; |
| 2227 | const cChunkDef::BiomeMap * Biomes = a_BiomeMap; |
| 2228 | if (a_BiomeMap == NULL) |
| 2229 | { |
| 2230 | // The biomes are not assigned, get them from the generator: |
| 2231 | Biomes = &BiomeMap; |
| 2232 | m_Generator.GenerateBiomes(a_ChunkX, a_ChunkZ, BiomeMap); |
| 2233 | } |
| 2234 | |
| 2235 | m_ChunkMap->SetChunkData( |
| 2236 | a_ChunkX, a_ChunkZ, |
| 2237 | a_BlockTypes, a_BlockMeta, a_BlockLight, a_BlockSkyLight, |
| 2238 | a_HeightMap, *Biomes, |
| 2239 | a_BlockEntities, |
| 2240 | a_MarkDirty |
| 2241 | ); |
| 2242 | |
| 2243 | // Initialize the entities (outside the m_ChunkMap's CS, to fix FS #347): |
| 2244 | for (cEntityList::iterator itr = a_Entities.begin(), end = a_Entities.end(); itr != end; ++itr) |
| 2245 | { |
| 2246 | (*itr)->Initialize(this); |
| 2247 | } |
| 2248 | |
| 2249 | // If a client is requesting this chunk, send it to them: |
| 2250 | if (m_ChunkMap->HasChunkAnyClients(a_ChunkX, a_ChunkZ)) |
| 2251 | { |
| 2252 | m_ChunkSender.ChunkReady(a_ChunkX, a_ChunkZ); |
| 2253 | } |
| 2254 | } |
| 2255 | |
| 2256 | |
| 2257 |
no test coverage detected