aboutsummaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/clientpackethandler.cpp4
-rw-r--r--src/network/serverpackethandler.cpp26
2 files changed, 23 insertions, 7 deletions
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp
index a8ae8a5ef..d47571d14 100644
--- a/src/network/clientpackethandler.cpp
+++ b/src/network/clientpackethandler.cpp
@@ -463,6 +463,10 @@ void Client::handleCommand_ActiveObjectRemoveAdd(NetworkPacket* pkt)
infostream << "handleCommand_ActiveObjectRemoveAdd: " << e.what()
<< ". The packet is unreliable, ignoring" << std::endl;
}
+
+ // m_activeobjects_received is false before the first
+ // TOCLIENT_ACTIVE_OBJECT_REMOVE_ADD packet is received
+ m_activeobjects_received = true;
}
void Client::handleCommand_ActiveObjectMessages(NetworkPacket* pkt)
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp
index 9999a1690..ecaf2a2a8 100644
--- a/src/network/serverpackethandler.cpp
+++ b/src/network/serverpackethandler.cpp
@@ -298,9 +298,6 @@ void Server::handleCommand_Init2(NetworkPacket* pkt)
infostream << "Server: Sending content to "
<< getPlayerName(pkt->getPeerId()) << std::endl;
- // Send player movement settings
- SendMovement(pkt->getPeerId());
-
// Send item definitions
SendItemDef(pkt->getPeerId(), m_itemdef, protocol_version);
@@ -312,9 +309,25 @@ void Server::handleCommand_Init2(NetworkPacket* pkt)
// Send media announcement
sendMediaAnnouncement(pkt->getPeerId(), lang);
+ RemoteClient *client;
+ {
+ MutexAutoLock(m_con);
+ client = getClient(pkt->getPeerId(), CS_InitDone);
+ }
+
+ // Send active objects
+ {
+ PlayerSAO *sao = getPlayerSAO(pkt->getPeerId());
+ if (client && sao)
+ SendActiveObjectRemoveAdd(client, sao);
+ }
+
// Send detached inventories
sendDetachedInventories(pkt->getPeerId(), false);
+ // Send player movement settings
+ SendMovement(pkt->getPeerId());
+
// Send time of day
u16 time = m_env->getTimeOfDay();
float time_speed = g_settings->getFloat("time_speed");
@@ -323,11 +336,10 @@ void Server::handleCommand_Init2(NetworkPacket* pkt)
SendCSMRestrictionFlags(pkt->getPeerId());
// Warnings about protocol version can be issued here
- if (getClient(pkt->getPeerId())->net_proto_version < LATEST_PROTOCOL_VERSION) {
+ if (client->net_proto_version < LATEST_PROTOCOL_VERSION) {
SendChatMessage(pkt->getPeerId(), ChatMessage(CHATMESSAGE_TYPE_SYSTEM,
- L"# Server: WARNING: YOUR CLIENT'S VERSION MAY NOT BE FULLY COMPATIBLE "
- L"WITH THIS SERVER!"));
-
+ L"# Server: WARNING: YOUR CLIENT'S VERSION MAY NOT BE FULLY COMPATIBLE "
+ L"WITH THIS SERVER!"));
}
}