| 1365 | } |
| 1366 | |
| 1367 | void CServer::SendMapData(int ClientId, int Chunk) |
| 1368 | { |
| 1369 | int MapType = IsSixup(ClientId) ? MAP_TYPE_SIXUP : MAP_TYPE_SIX; |
| 1370 | unsigned int ChunkSize = NET_MAX_CHUNK_SIZE - 128; |
| 1371 | unsigned int Offset = Chunk * ChunkSize; |
| 1372 | int Last = 0; |
| 1373 | |
| 1374 | // drop faulty map data requests |
| 1375 | if(Chunk < 0 || Offset > m_aCurrentMapSize[MapType]) |
| 1376 | return; |
| 1377 | |
| 1378 | if(Offset + ChunkSize >= m_aCurrentMapSize[MapType]) |
| 1379 | { |
| 1380 | ChunkSize = m_aCurrentMapSize[MapType] - Offset; |
| 1381 | Last = 1; |
| 1382 | } |
| 1383 | |
| 1384 | CMsgPacker Msg(NETMSG_MAP_DATA, true); |
| 1385 | if(MapType == MAP_TYPE_SIX) |
| 1386 | { |
| 1387 | Msg.AddInt(Last); |
| 1388 | Msg.AddInt(m_aCurrentMapCrc[MAP_TYPE_SIX]); |
| 1389 | Msg.AddInt(Chunk); |
| 1390 | Msg.AddInt(ChunkSize); |
| 1391 | } |
| 1392 | Msg.AddRaw(&m_apCurrentMapData[MapType][Offset], ChunkSize); |
| 1393 | SendMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_FLUSH, ClientId); |
| 1394 | |
| 1395 | if(Config()->m_Debug) |
| 1396 | { |
| 1397 | char aBuf[256]; |
| 1398 | str_format(aBuf, sizeof(aBuf), "sending chunk %d with size %d", Chunk, ChunkSize); |
| 1399 | Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "server", aBuf); |
| 1400 | } |
| 1401 | } |
| 1402 | |
| 1403 | void CServer::SendMapReload(int ClientId) |
| 1404 | { |
nothing calls this directly
no test coverage detected