MCPcopy Create free account
hub / github.com/diasurgical/devilution / UnPackItem

Function UnPackItem

Source/pack.cpp:112–142  ·  view source on GitHub ↗

Note: last slot of item[MAXITEMS+1] used as temporary buffer find real name reference below, possibly [sizeof(item[])/sizeof(ItemStruct)]

Source from the content-addressed store, hash-verified

110// Note: last slot of item[MAXITEMS+1] used as temporary buffer
111// find real name reference below, possibly [sizeof(item[])/sizeof(ItemStruct)]
112static void UnPackItem(PkItemStruct *is, ItemStruct *id)
113{
114 WORD idx = SwapLE16(is->idx);
115
116 if (idx == 0xFFFF) {
117 id->_itype = ITYPE_NONE;
118 } else {
119 if (idx == IDI_EAR) {
120 RecreateEar(
121 MAXITEMS,
122 SwapLE16(is->iCreateInfo),
123 SwapLE32(is->iSeed),
124 is->bId,
125 is->bDur,
126 is->bMDur,
127 is->bCh,
128 is->bMCh,
129 SwapLE16(is->wValue),
130 SwapLE32(is->dwBuff));
131 } else {
132 RecreateItem(MAXITEMS, idx, SwapLE16(is->iCreateInfo), SwapLE32(is->iSeed), SwapLE16(is->wValue));
133 item[MAXITEMS]._iMagical = is->bId >> 1;
134 item[MAXITEMS]._iIdentified = is->bId & 1;
135 item[MAXITEMS]._iDurability = is->bDur;
136 item[MAXITEMS]._iMaxDur = is->bMDur;
137 item[MAXITEMS]._iCharges = is->bCh;
138 item[MAXITEMS]._iMaxCharges = is->bMCh;
139 }
140 *id = item[MAXITEMS];
141 }
142}
143
144void VerifyGoldSeeds(PlayerStruct *pPlayer)
145{

Callers 1

UnPackPlayerFunction · 0.85

Calls 2

RecreateEarFunction · 0.85
RecreateItemFunction · 0.85

Tested by

no test coverage detected