| 1540 | } |
| 1541 | |
| 1542 | void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy) |
| 1543 | { |
| 1544 | CUnpacker Unpacker; |
| 1545 | Unpacker.Reset(pPacket->m_pData, pPacket->m_DataSize); |
| 1546 | CMsgPacker Packer(NETMSG_EX, true); |
| 1547 | |
| 1548 | // unpack msgid and system flag |
| 1549 | int Msg; |
| 1550 | bool Sys; |
| 1551 | CUuid Uuid; |
| 1552 | |
| 1553 | int Result = UnpackMessageId(&Msg, &Sys, &Uuid, &Unpacker, &Packer); |
| 1554 | if(Result == UNPACKMESSAGE_ERROR) |
| 1555 | { |
| 1556 | return; |
| 1557 | } |
| 1558 | else if(Result == UNPACKMESSAGE_ANSWER) |
| 1559 | { |
| 1560 | SendMsg(Conn, &Packer, MSGFLAG_VITAL); |
| 1561 | } |
| 1562 | |
| 1563 | // allocates the memory for the translated data |
| 1564 | CPacker Packer6; |
| 1565 | if(IsSixup()) |
| 1566 | { |
| 1567 | bool IsExMsg = false; |
| 1568 | int Success = !TranslateSysMsg(&Msg, Sys, &Unpacker, &Packer6, pPacket, &IsExMsg); |
| 1569 | if(Msg < 0) |
| 1570 | return; |
| 1571 | if(Success && !IsExMsg) |
| 1572 | { |
| 1573 | Unpacker.Reset(Packer6.Data(), Packer6.Size()); |
| 1574 | } |
| 1575 | } |
| 1576 | |
| 1577 | if(Sys) |
| 1578 | { |
| 1579 | // system message |
| 1580 | if(Conn == CONN_MAIN && (pPacket->m_Flags & NET_CHUNKFLAG_VITAL) != 0 && Msg == NETMSG_MAP_DETAILS) |
| 1581 | { |
| 1582 | const char *pMap = Unpacker.GetString(CUnpacker::SANITIZE_CC | CUnpacker::SKIP_START_WHITESPACES); |
| 1583 | SHA256_DIGEST *pMapSha256 = (SHA256_DIGEST *)Unpacker.GetRaw(sizeof(*pMapSha256)); |
| 1584 | int MapCrc = Unpacker.GetInt(); |
| 1585 | int MapSize = Unpacker.GetInt(); |
| 1586 | if(Unpacker.Error()) |
| 1587 | { |
| 1588 | return; |
| 1589 | } |
| 1590 | |
| 1591 | const char *pMapUrl = Unpacker.GetString(CUnpacker::SANITIZE_CC); |
| 1592 | if(Unpacker.Error()) |
| 1593 | { |
| 1594 | pMapUrl = ""; |
| 1595 | } |
| 1596 | |
| 1597 | m_MapDetails = std::make_optional<CMapDetails>(); |
| 1598 | CMapDetails &MapDetails = m_MapDetails.value(); |
| 1599 | str_copy(MapDetails.m_aName, pMap); |
nothing calls this directly
no test coverage detected