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

Function OnSpawnItem

Source/msg.cpp:2032–2049  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2030}
2031
2032size_t OnSpawnItem(const TCmd *pCmd, size_t pnum)
2033{
2034 const auto &message = *reinterpret_cast<const TCmdPItem *>(pCmd);
2035 const auto &player = Players[pnum];
2036
2037 if (gbBufferMsgs == 1) {
2038 SendPacket(pnum, &message, sizeof(message));
2039 } else if (IsPItemValid(message, player)) {
2040 Player &player = Players[pnum];
2041 if (player.isOnActiveLevel() && &player != MyPlayer) {
2042 SyncDropItem(message);
2043 }
2044 PutItemRecord(SDL_SwapLE32(message.def.dwSeed), SDL_SwapLE16(message.def.wCI), static_cast<_item_indexes>(SDL_SwapLE16(message.def.wIndx)));
2045 DeltaPutItem(message, { message.x, message.y }, player);
2046 }
2047
2048 return sizeof(message);
2049}
2050
2051size_t OnSendPlayerInfo(const TCmd *pCmd, size_t pnum)
2052{

Callers 1

ParseCmdFunction · 0.85

Calls 6

IsPItemValidFunction · 0.85
PutItemRecordFunction · 0.85
DeltaPutItemFunction · 0.85
isOnActiveLevelMethod · 0.80
SendPacketFunction · 0.70
SyncDropItemFunction · 0.70

Tested by

no test coverage detected