-#if 0
-void Client::fetchBlock(v3s16 p, u8 flags)
-{
- if(connectedAndInitialized() == false)
- throw ClientNotReadyException
- ("ClientNotReadyException: connectedAndInitialized() == false");
-
- /*dstream<<"Client::fetchBlock(): Sending GETBLOCK for ("
- <<p.X<<","<<p.Y<<","<<p.Z<<")"<<std::endl;*/
-
- JMutexAutoLock conlock(m_con_mutex);
-
- SharedBuffer<u8> data(9);
- writeU16(&data[0], TOSERVER_GETBLOCK);
- writeS16(&data[2], p.X);
- writeS16(&data[4], p.Y);
- writeS16(&data[6], p.Z);
- writeU8(&data[8], flags);
- m_con.Send(PEER_ID_SERVER, 1, data, true);
-}
-
-/*
- Calls fetchBlock() on some nearby missing blocks.
-
- Returns when any of various network load indicators go over limit.
-
- Does nearly the same thing as the old updateChangedVisibleArea()
-*/
-void Client::fetchBlocks()
-{
- if(connectedAndInitialized() == false)
- throw ClientNotReadyException
- ("ClientNotReadyException: connectedAndInitialized() == false");
-}
-#endif
-
-bool Client::isFetchingBlocks()
-{
- JMutexAutoLock conlock(m_con_mutex);
- con::Peer *peer = m_con.GetPeerNoEx(PEER_ID_SERVER);
- // Not really fetching but can't fetch more.
- if(peer == NULL) return true;
-
- con::Channel *channel = &(peer->channels[1]);
- /*
- NOTE: Channel 0 should always be used for fetching blocks,
- and for nothing else.
- */
- if(channel->incoming_reliables.size() > 0)
- return true;
- if(channel->outgoing_reliables.size() > 0)
- return true;
- return false;
-}
-
-IncomingPacket Client::getPacket()
-{
- JMutexAutoLock lock(m_incoming_queue_mutex);
-
- core::list<IncomingPacket>::Iterator i;
- // Refer to first one
- i = m_incoming_queue.begin();
-
- // If queue is empty, return empty packet
- if(i == m_incoming_queue.end()){
- IncomingPacket packet;
- return packet;
- }
-
- // Pop out first packet and return it
- IncomingPacket packet = *i;
- m_incoming_queue.erase(i);
- return packet;
-}
-
-#if 0
-void Client::removeNode(v3s16 nodepos)
-{
- if(connectedAndInitialized() == false){
- dout_client<<DTIME<<"Client::removeNode() cancelled (not connected)"
- <<std::endl;
- return;
- }
-
- // Test that the position exists
- try{
- JMutexAutoLock envlock(m_env_mutex);
- m_env.getMap().getNode(nodepos);
- }
- catch(InvalidPositionException &e)
- {
- dout_client<<DTIME<<"Client::removeNode() cancelled (doesn't exist)"
- <<std::endl;
- return;
- }
-
- SharedBuffer<u8> data(8);
- writeU16(&data[0], TOSERVER_REMOVENODE);
- writeS16(&data[2], nodepos.X);
- writeS16(&data[4], nodepos.Y);
- writeS16(&data[6], nodepos.Z);
- Send(0, data, true);
-}
-
-void Client::addNodeFromInventory(v3s16 nodepos, u16 i)
-{
- if(connectedAndInitialized() == false){
- dout_client<<DTIME<<"Client::addNodeFromInventory() "
- "cancelled (not connected)"
- <<std::endl;
- return;
- }
-
- // Test that the position exists
- try{
- JMutexAutoLock envlock(m_env_mutex);
- m_env.getMap().getNode(nodepos);
- }
- catch(InvalidPositionException &e)
- {
- dout_client<<DTIME<<"Client::addNode() cancelled (doesn't exist)"
- <<std::endl;
- return;
- }
-
- //u8 ser_version = m_server_ser_ver;
-
- // SUGGESTION: The validity of the operation could be checked here too
-
- u8 datasize = 2 + 6 + 2;
- SharedBuffer<u8> data(datasize);
- writeU16(&data[0], TOSERVER_ADDNODE_FROM_INVENTORY);
- writeS16(&data[2], nodepos.X);
- writeS16(&data[4], nodepos.Y);
- writeS16(&data[6], nodepos.Z);
- writeU16(&data[8], i);
- Send(0, data, true);
-}
-#endif
-
-void Client::clickGround(u8 button, v3s16 nodepos_undersurface,