Skip to content

Commit a2e1b0f

Browse files
committedJul 7, 2014
Don't copy back already generated blocks on map generation
1 parent 8b3ed78 commit a2e1b0f

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed
 

Diff for: ‎src/map.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -2312,7 +2312,7 @@ void ServerMap::finishBlockMake(BlockMakeData *data,
23122312
{
23132313
// 70ms @cs=8
23142314
//TimeTaker timer("finishBlockMake() blitBackAll");
2315-
data->vmanip->blitBackAll(&changed_blocks);
2315+
data->vmanip->blitBackAll(&changed_blocks, false);
23162316
}
23172317

23182318
EMERGE_DBG_OUT("finishBlockMake: changed_blocks.size()=" << changed_blocks.size());
@@ -3586,7 +3586,8 @@ void ManualMapVoxelManipulator::initialEmerge(v3s16 blockpos_min,
35863586
}
35873587

35883588
void ManualMapVoxelManipulator::blitBackAll(
3589-
std::map<v3s16, MapBlock*> * modified_blocks)
3589+
std::map<v3s16, MapBlock*> *modified_blocks,
3590+
bool overwrite_generated)
35903591
{
35913592
if(m_area.getExtent() == v3s16(0,0,0))
35923593
return;
@@ -3601,10 +3602,9 @@ void ManualMapVoxelManipulator::blitBackAll(
36013602
v3s16 p = i->first;
36023603
MapBlock *block = m_map->getBlockNoCreateNoEx(p);
36033604
bool existed = !(i->second & VMANIP_BLOCK_DATA_INEXIST);
3604-
if((existed == false) || (block == NULL))
3605-
{
3605+
if ((existed == false) || (block == NULL) ||
3606+
(overwrite_generated == false && block->isGenerated() == true))
36063607
continue;
3607-
}
36083608

36093609
block->copyFrom(*this);
36103610

Diff for: ‎src/map.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -543,10 +543,11 @@ class ManualMapVoxelManipulator : public VoxelManipulator
543543
{m_map = map;}
544544

545545
void initialEmerge(v3s16 blockpos_min, v3s16 blockpos_max,
546-
bool load_if_inexistent = true);
546+
bool load_if_inexistent = true);
547547

548548
// This is much faster with big chunks of generated data
549-
void blitBackAll(std::map<v3s16, MapBlock*> * modified_blocks);
549+
void blitBackAll(std::map<v3s16, MapBlock*> * modified_blocks,
550+
bool overwrite_generated = true);
550551

551552
protected:
552553
bool m_create_area;

0 commit comments

Comments
 (0)
Please sign in to comment.