From 08a10b8a6a77eb729d609979ee822134d5d7a645 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Thu, 1 Dec 2011 23:55:57 +0200 Subject: Remove stuff made obsolete by making players more ActiveObject-like and raise protocol version number by one (because it is not compatible at all anymore) --- src/client.cpp | 283 ------------------------------------------------ src/clientserver.h | 8 +- src/defaultsettings.cpp | 1 - src/server.cpp | 180 +----------------------------- src/server.h | 13 --- 5 files changed, 7 insertions(+), 478 deletions(-) (limited to 'src') diff --git a/src/client.cpp b/src/client.cpp index a165627e5..d264713e2 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -940,222 +940,6 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id) //infostream<<"Adding mesh update task for received block"<isLocal()) - { - start += player_size; - continue; - } - - v3s32 ps = readV3S32(&data[start+2]); - v3s32 ss = readV3S32(&data[start+2+12]); - s32 pitch_i = readS32(&data[start+2+12+12]); - s32 yaw_i = readS32(&data[start+2+12+12+4]); - /*infostream<<"Client: got " - <<"pitch_i="< players_alive; - for(u32 i=0; iupdateName((char*)&data[start+2]); - - start += item_size; - } - - /* - Remove those players from the environment that - weren't listed by the server. - */ - //infostream<<"Removing dead players"< players = m_env.getPlayers(); - core::list::Iterator ip; - for(ip=players.begin(); ip!=players.end(); ip++) - { - // Ingore local player - if((*ip)->isLocal()) - continue; - - // Warn about a special case - if((*ip)->peer_id == 0) - { - infostream<<"Client: Removing " - "dead player with id=0"<::Iterator i; - for(i=players_alive.begin(); i!=players_alive.end(); i++) - { - if((*ip)->peer_id == *i) - { - is_alive = true; - break; - } - } - /*infostream<<"peer_id="<<((*ip)->peer_id) - <<" is_alive="<peer_id - <peer_id); - } - } //envlock -#endif - } - else if(command == TOCLIENT_SECTORMETA) - { - infostream<<"Client received DEPRECATED TOCLIENT_SECTORMETA"<inventory.print(infostream); } } - //DEBUG - else if(command == TOCLIENT_OBJECTDATA) - { - // Strip command word and create a stringstream - std::string datastring((char*)&data[2], datasize-2); - std::istringstream is(datastring, std::ios_base::binary); - - u8 buf[12]; - - /* - Read players - */ - - is.read((char*)buf, 2); - u16 playercount = readU16(buf); - - for(u16 i=0; iisLocal()) - { - continue; - } - - f32 pitch = (f32)pitch_i / 100.0; - f32 yaw = (f32)yaw_i / 100.0; - v3f position((f32)p_i.X/100., (f32)p_i.Y/100., (f32)p_i.Z/100.); - v3f speed((f32)s_i.X/100., (f32)s_i.Y/100., (f32)s_i.Z/100.); - - player->setPosition(position); - player->setSpeed(speed); - player->setPitch(pitch); - player->setYaw(yaw); - } - - /* - Read block objects - NOTE: Deprecated stuff - */ - - // Read active block count - u16 blockcount = readU16(is); - if(blockcount != 0){ - infostream<<"TOCLIENT_OBJECTDATA: blockcount != 0 " - "not supported"<setDefault("profiler_print_interval", "0"); settings->setDefault("enable_mapgen_debug_info", "false"); - settings->setDefault("objectdata_interval", "0.2"); settings->setDefault("active_object_send_range_blocks", "3"); settings->setDefault("active_block_range", "2"); //settings->setDefault("max_simultaneous_block_sends_per_client", "1"); diff --git a/src/server.cpp b/src/server.cpp index 2dceb805b..a461c95e8 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -750,105 +750,6 @@ queue_full_break: infostream<<"GetNextBlocks duration: "< &stepped_blocks - ) -{ - DSTACK(__FUNCTION_NAME); - - // Can't send anything without knowing version - if(serialization_version == SER_FMT_VER_INVALID) - { - infostream<<"RemoteClient::SendObjectData(): Not sending, no version." - < players = server->m_env->getPlayers(true); - - // Write player count - u16 playercount = players.size(); - writeU16(buf, playercount); - os.write((char*)buf, 2); - - core::list::Iterator i; - for(i = players.begin(); - i != players.end(); i++) - { - Player *player = *i; - - v3f pf = player->getPosition(); - v3f sf = player->getSpeed(); - - v3s32 position_i(pf.X*100, pf.Y*100, pf.Z*100); - v3s32 speed_i (sf.X*100, sf.Y*100, sf.Z*100); - s32 pitch_i (player->getPitch() * 100); - s32 yaw_i (player->getYaw() * 100); - - writeU16(buf, player->peer_id); - os.write((char*)buf, 2); - writeV3S32(buf, position_i); - os.write((char*)buf, 12); - writeV3S32(buf, speed_i); - os.write((char*)buf, 12); - writeS32(buf, pitch_i); - os.write((char*)buf, 4); - writeS32(buf, yaw_i); - os.write((char*)buf, 4); - } - - /* - Get and write object data (dummy, for compatibility) - */ - - // Write block count - writeU16(buf, 0); - os.write((char*)buf, 2); - - /* - Send data - */ - - //infostream<<"Server: Sending object data to "< data((u8*)s.c_str(), s.size()); - // Send as unreliable - server->m_con.Send(peer_id, 0, data, false); -} - void RemoteClient::GotBlock(v3s16 p) { if(m_blocks_sending.find(p) != NULL) @@ -1914,25 +1815,6 @@ void Server::AsyncRunStep() } - /* - Send object positions - */ - { - float &counter = m_objectdata_timer; - counter += dtime; - if(counter >= g_settings->getFloat("objectdata_interval")) - { - JMutexAutoLock lock1(m_env_mutex); - JMutexAutoLock lock2(m_con_mutex); - - //ScopeProfiler sp(g_profiler, "Server: sending player positions"); - - SendObjectData(counter); - - counter = 0.0; - } - } - /* Trigger emergethread (it somehow gets to a non-triggered but bysy state sometimes) @@ -2286,7 +2168,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) SendTextures(peer_id); // Send player info to all players - SendPlayerInfos(); + //SendPlayerInfos(); // Send inventory to player UpdateCrafting(peer_id); @@ -3953,64 +3835,6 @@ void Server::SendCraftItemDef(con::Connection &con, u16 peer_id, Non-static send methods */ -void Server::SendObjectData(float dtime) -{ - DSTACK(__FUNCTION_NAME); - - core::map stepped_blocks; - - for(core::map::Iterator - i = m_clients.getIterator(); - i.atEnd() == false; i++) - { - u16 peer_id = i.getNode()->getKey(); - RemoteClient *client = i.getNode()->getValue(); - assert(client->peer_id == peer_id); - - if(client->serialization_version == SER_FMT_VER_INVALID) - continue; - - client->SendObjectData(this, dtime, stepped_blocks); - } -} - -void Server::SendPlayerInfos() -{ - DSTACK(__FUNCTION_NAME); - - //JMutexAutoLock envlock(m_env_mutex); - - // Get connected players - core::list players = m_env->getPlayers(true); - - u32 player_count = players.getSize(); - u32 datasize = 2+(2+PLAYERNAME_SIZE)*player_count; - - SharedBuffer data(datasize); - writeU16(&data[0], TOCLIENT_PLAYERINFO); - - u32 start = 2; - core::list::Iterator i; - for(i = players.begin(); - i != players.end(); i++) - { - Player *player = *i; - - /*infostream<<"Server sending player info for player with " - "peer_id="<peer_id<peer_id); - memset((char*)&data[start+2], 0, PLAYERNAME_SIZE); - snprintf((char*)&data[start+2], PLAYERNAME_SIZE, "%s", player->getName()); - start += 2+PLAYERNAME_SIZE; - } - - //JMutexAutoLock conlock(m_con_mutex); - - // Send as reliable - m_con.SendToAll(0, data, true); -} - void Server::SendInventory(u16 peer_id) { DSTACK(__FUNCTION_NAME); @@ -5042,7 +4866,7 @@ void Server::handlePeerChange(PeerChange &c) m_clients.remove(c.peer_id); // Send player info to all remaining clients - SendPlayerInfos(); + //SendPlayerInfos(); // Send leave chat message to all remaining clients BroadcastChatMessage(message); diff --git a/src/server.h b/src/server.h index 7568463b2..0fe1979b7 100644 --- a/src/server.h +++ b/src/server.h @@ -273,17 +273,6 @@ public: void GetNextBlocks(Server *server, float dtime, core::array &dest); - /* - Connection and environment should be locked when this is called. - steps() objects of blocks not found in active_blocks, then - adds those blocks to active_blocks - */ - void SendObjectData( - Server *server, - float dtime, - core::map &stepped_blocks - ); - void GotBlock(v3s16 p); void SentBlock(v3s16 p); @@ -541,8 +530,6 @@ private: */ // Envlock and conlock should be locked when calling these - void SendObjectData(float dtime); - void SendPlayerInfos(); void SendInventory(u16 peer_id); // send wielded item info about player to all void SendWieldedItem(const Player *player); -- cgit v1.2.3