MCPcopy Create free account
hub / github.com/ddnet/ddnet / SendMap

Method SendMap

src/engine/server/server.cpp:1331–1365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1329}
1330
1331void CServer::SendMap(int ClientId)
1332{
1333 int MapType = IsSixup(ClientId) ? MAP_TYPE_SIXUP : MAP_TYPE_SIX;
1334 {
1335 CMsgPacker Msg(NETMSG_MAP_DETAILS, true);
1336 Msg.AddString(GameServer()->Map()->BaseName(), 0);
1337 Msg.AddRaw(&m_aCurrentMapSha256[MapType].data, sizeof(m_aCurrentMapSha256[MapType].data));
1338 Msg.AddInt(m_aCurrentMapCrc[MapType]);
1339 Msg.AddInt(m_aCurrentMapSize[MapType]);
1340 if(m_aMapDownloadUrl[0])
1341 {
1342 Msg.AddString(m_aMapDownloadUrl, 0);
1343 }
1344 else
1345 {
1346 Msg.AddString("", 0);
1347 }
1348 SendMsg(&Msg, MSGFLAG_VITAL, ClientId);
1349 }
1350 {
1351 CMsgPacker Msg(NETMSG_MAP_CHANGE, true);
1352 Msg.AddString(GameServer()->Map()->BaseName(), 0);
1353 Msg.AddInt(m_aCurrentMapCrc[MapType]);
1354 Msg.AddInt(m_aCurrentMapSize[MapType]);
1355 if(MapType == MAP_TYPE_SIXUP)
1356 {
1357 Msg.AddInt(Config()->m_SvMapWindow);
1358 Msg.AddInt(NET_MAX_CHUNK_SIZE - 128);
1359 Msg.AddRaw(m_aCurrentMapSha256[MapType].data, sizeof(m_aCurrentMapSha256[MapType].data));
1360 }
1361 SendMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_FLUSH, ClientId);
1362 }
1363
1364 m_aClients[ClientId].m_NextMapChunk = 0;
1365}
1366
1367void CServer::SendMapData(int ClientId, int Chunk)
1368{

Callers 2

ClientRejoinCallbackMethod · 0.80

Calls 6

AddRawMethod · 0.80
AddIntMethod · 0.80
ConfigFunction · 0.50
AddStringMethod · 0.45
BaseNameMethod · 0.45
MapMethod · 0.45

Tested by

no test coverage detected