summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 5869dc77b..e86b3a4f8 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -39,10 +39,12 @@ void * MeshUpdateThread::Thread()
QueuedMeshUpdate *q = m_queue_in.pop();
if(q == NULL)
{
- sleep_ms(50);
+ sleep_ms(3);
continue;
}
+ ScopeProfiler sp(&g_profiler, "mesh make");
+
scene::SMesh *mesh_new = NULL;
mesh_new = makeMapBlockMesh(q->data);
@@ -218,12 +220,12 @@ void Client::step(float dtime)
g_settings.getFloat("client_delete_unused_sectors_timeout");
// Delete sector blocks
- /*u32 num = m_env.getMap().deleteUnusedSectors
+ /*u32 num = m_env.getMap().unloadUnusedData
(delete_unused_sectors_timeout,
true, &deleted_blocks);*/
// Delete whole sectors
- u32 num = m_env.getMap().deleteUnusedSectors
+ u32 num = m_env.getMap().unloadUnusedData
(delete_unused_sectors_timeout,
false, &deleted_blocks);
@@ -306,8 +308,14 @@ void Client::step(float dtime)
SharedBuffer<u8> data(2+1+PLAYERNAME_SIZE+PASSWORD_SIZE);
writeU16(&data[0], TOSERVER_INIT);
writeU8(&data[2], SER_FMT_VER_HIGHEST);
+
memset((char*)&data[3], 0, PLAYERNAME_SIZE);
snprintf((char*)&data[3], PLAYERNAME_SIZE, "%s", myplayer->getName());
+
+ /*dstream<<"Client: password hash is \""<<m_password<<"\""
+ <<std::endl;*/
+
+ memset((char*)&data[23], 0, PASSWORD_SIZE);
snprintf((char*)&data[23], PASSWORD_SIZE, "%s", m_password.c_str());
// Send as unreliable
@@ -610,6 +618,13 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
// to be processed even if the serialisation format has
// not been agreed yet, the same as TOCLIENT_INIT.
m_access_denied = true;
+ m_access_denied_reason = L"Unknown";
+ if(datasize >= 4)
+ {
+ std::string datastring((char*)&data[2], datasize-2);
+ std::istringstream is(datastring, std::ios_base::binary);
+ m_access_denied_reason = deSerializeWideString(is);
+ }
return;
}
@@ -780,7 +795,9 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
*/
//m_env.getClientMap().updateMeshes(block->getPos(), getDayNightRatio());
-
+ /*
+ Add it to mesh update queue and set it to be acknowledged after update.
+ */
addUpdateMeshTaskWithEdge(p, true);
}
else if(command == TOCLIENT_PLAYERPOS)