MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / DeltaExportData

Function DeltaExportData

Source/msg.cpp:2479–2510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2477}
2478
2479void DeltaExportData(int pnum)
2480{
2481 for (auto &it : DeltaLevels) {
2482 DLevel &deltaLevel = it.second;
2483
2484 const size_t bufferSize = 1U /* marker byte, always 0 */
2485 + sizeof(uint8_t) /* level id */
2486 + sizeof(deltaLevel.item) /* items spawned during dungeon generation which have been picked up, and items dropped by a player during a game */
2487 + sizeof(uint8_t) /* count of object interactions which caused a state change since dungeon generation */
2488 + (sizeof(WorldTilePosition) + sizeof(DObjectStr)) * deltaLevel.object.size() /* location/action pairs for the object interactions */
2489 + sizeof(deltaLevel.monster); /* latest monster state */
2490 std::unique_ptr<byte[]> dst { new byte[bufferSize] };
2491
2492 byte *dstEnd = &dst.get()[1];
2493 *dstEnd = static_cast<byte>(it.first);
2494 dstEnd += sizeof(uint8_t);
2495 dstEnd = DeltaExportItem(dstEnd, deltaLevel.item);
2496 dstEnd = DeltaExportObject(dstEnd, deltaLevel.object);
2497 dstEnd = DeltaExportMonster(dstEnd, deltaLevel.monster);
2498 uint32_t size = CompressData(dst.get(), dstEnd);
2499 multi_send_zero_packet(pnum, CMD_DLEVEL, dst.get(), size);
2500 }
2501
2502 byte dst[sizeof(DJunk) + 1];
2503 byte *dstEnd = &dst[1];
2504 dstEnd = DeltaExportJunk(dstEnd);
2505 uint32_t size = CompressData(dst, dstEnd);
2506 multi_send_zero_packet(pnum, CMD_DLEVEL_JUNK, dst, size);
2507
2508 byte src[1] = { static_cast<byte>(0) };
2509 multi_send_zero_packet(pnum, CMD_DLEVEL_END, src, 1);
2510}
2511
2512void delta_init()
2513{

Callers 1

multi_handle_deltaFunction · 0.85

Calls 8

DeltaExportItemFunction · 0.85
DeltaExportObjectFunction · 0.85
DeltaExportMonsterFunction · 0.85
CompressDataFunction · 0.85
multi_send_zero_packetFunction · 0.85
DeltaExportJunkFunction · 0.85
getMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected