1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

map generation framework under development... not quite operational at this point.

This commit is contained in:
Perttu Ahola 2011-01-30 01:44:54 +02:00
parent 8788fffec0
commit be851871cd
13 changed files with 965 additions and 372 deletions

View file

@ -156,20 +156,18 @@ void * EmergeThread::Thread()
only_from_disk = true;
// First check if the block already exists
if(only_from_disk)
{
block = map.getBlockNoCreate(p);
}
//block = map.getBlockNoCreate(p);
if(block == NULL)
{
//dstream<<"Calling emergeBlock"<<std::endl;
block = map.emergeBlock(
p,
only_from_disk,
changed_blocks,
lighting_invalidated_blocks);
#if 1
#if 0
/*
EXPERIMENTAL: Create a few other blocks too
*/
@ -206,6 +204,12 @@ void * EmergeThread::Thread()
{
//dstream<<"EmergeThread: Got a dummy block"<<std::endl;
got_block = false;
if(only_from_disk == false)
{
dstream<<"EmergeThread: wanted to generate a block but got a dummy"<<std::endl;
assert(0);
}
}
}
catch(InvalidPositionException &e)
@ -581,16 +585,10 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime,
/*
Check if map has this block
*/
MapBlock *block = NULL;
try
{
block = server->m_env.getMap().getBlockNoCreate(p);
}
catch(InvalidPositionException &e)
{
}
MapBlock *block = server->m_env.getMap().getBlockNoCreateNoEx(p);
bool surely_not_found_on_disk = false;
bool block_is_invalid = false;
if(block != NULL)
{
/*if(block->isIncomplete())
@ -603,6 +601,11 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime,
{
surely_not_found_on_disk = true;
}
if(block->isValid() == false)
{
block_is_invalid = true;
}
}
/*
@ -627,8 +630,10 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime,
/*
Add inexistent block to emerge queue.
*/
if(block == NULL || surely_not_found_on_disk)
if(block == NULL || surely_not_found_on_disk || block_is_invalid)
{
//dstream<<"asd"<<std::endl;
/*SharedPtr<JMutexAutoLock> lock
(m_num_blocks_in_emerge_queue.getLock());*/
@ -636,6 +641,8 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime,
// Allow only one block in emerge queue
if(server->m_emerge_queue.peerItemCount(peer_id) < 1)
{
//dstream<<"Adding block to emerge queue"<<std::endl;
// Add it to the emerge queue and trigger the thread
u8 flags = 0;