1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Reduced server CPU usage on NodeMetadata step()s. Also furnace now cooks while no players are near it.

This commit is contained in:
Perttu Ahola 2011-05-31 20:02:55 +03:00
parent 7740425085
commit bbead93c1a
7 changed files with 163 additions and 80 deletions

View file

@ -1637,6 +1637,11 @@ void Server::AsyncRunStep()
dstream<<"Server: MEET_REMOVENODE"<<std::endl;
sendRemoveNode(event->p, event->already_known_by_peer);
}
else if(event->type == MEET_BLOCK_NODE_METADATA_CHANGED)
{
dstream<<"Server: MEET_BLOCK_NODE_METADATA_CHANGED"<<std::endl;
setBlockNotSent(event->p);
}
else if(event->type == MEET_OTHER)
{
dstream<<"WARNING: Server: MEET_OTHER not implemented"
@ -1676,7 +1681,7 @@ void Server::AsyncRunStep()
Step node metadata
TODO: Move to ServerEnvironment and utilize active block stuff
*/
{
/*{
//TimeTaker timer("Step node metadata");
JMutexAutoLock envlock(m_env_mutex);
@ -1686,6 +1691,8 @@ void Server::AsyncRunStep()
core::map<v3s16, MapBlock*> changed_blocks;
m_env.getMap().nodeMetadataStep(dtime, changed_blocks);
// Use setBlockNotSent
for(core::map<v3s16, MapBlock*>::Iterator
i = changed_blocks.getIterator();
@ -1701,7 +1708,7 @@ void Server::AsyncRunStep()
client->SetBlockNotSent(block->getPos());
}
}
}
}*/
/*
Trigger emergethread (it somehow gets to a non-triggered but
@ -3655,6 +3662,17 @@ void Server::sendAddNode(v3s16 p, MapNode n, u16 ignore_id,
}
}
void Server::setBlockNotSent(v3s16 p)
{
for(core::map<u16, RemoteClient*>::Iterator
i = m_clients.getIterator();
i.atEnd()==false; i++)
{
RemoteClient *client = i.getNode()->getValue();
client->SetBlockNotSent(p);
}
}
void Server::SendBlockNoLock(u16 peer_id, MapBlock *block, u8 ver)
{
DSTACK(__FUNCTION_NAME);