mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Fix unnecessary block loading (#4847)
This commit makes the game load blocks only if they are not in the memory.
This commit is contained in:
parent
78bf7c46e5
commit
6d4e7f223a
@ -508,13 +508,15 @@ EmergeAction EmergeThread::getBlockOrStartGen(
|
|||||||
|
|
||||||
// 1). Attempt to fetch block from memory
|
// 1). Attempt to fetch block from memory
|
||||||
*block = m_map->getBlockNoCreateNoEx(pos);
|
*block = m_map->getBlockNoCreateNoEx(pos);
|
||||||
if (*block && !(*block)->isDummy() && (*block)->isGenerated())
|
if (*block && !(*block)->isDummy()) {
|
||||||
|
if ((*block)->isGenerated())
|
||||||
return EMERGE_FROM_MEMORY;
|
return EMERGE_FROM_MEMORY;
|
||||||
|
} else {
|
||||||
// 2). Attempt to load block from disk
|
// 2). Attempt to load block from disk if it was not in the memory
|
||||||
*block = m_map->loadBlock(pos);
|
*block = m_map->loadBlock(pos);
|
||||||
if (*block && (*block)->isGenerated())
|
if (*block && (*block)->isGenerated())
|
||||||
return EMERGE_FROM_DISK;
|
return EMERGE_FROM_DISK;
|
||||||
|
}
|
||||||
|
|
||||||
// 3). Attempt to start generation
|
// 3). Attempt to start generation
|
||||||
if (allow_gen && m_map->initBlockMake(pos, bmdata))
|
if (allow_gen && m_map->initBlockMake(pos, bmdata))
|
||||||
|
Loading…
Reference in New Issue
Block a user