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

Function PackPlayer

Source/pack.cpp:35–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35void PackPlayer(PkPlayerStruct *pPack, int pnum, BOOL manashield)
36{
37 PlayerStruct *pPlayer;
38 int i;
39 ItemStruct *pi;
40 PkItemStruct *pki;
41
42 memset(pPack, 0, sizeof(*pPack));
43 pPlayer = &plr[pnum];
44 pPack->destAction = pPlayer->destAction;
45 pPack->destParam1 = pPlayer->destParam1;
46 pPack->destParam2 = pPlayer->destParam2;
47 pPack->plrlevel = pPlayer->plrlevel;
48 pPack->px = pPlayer->WorldX;
49 pPack->py = pPlayer->WorldY;
50 pPack->targx = pPlayer->_ptargx;
51 pPack->targy = pPlayer->_ptargy;
52 strcpy(pPack->pName, pPlayer->_pName);
53 pPack->pClass = pPlayer->_pClass;
54 pPack->pBaseStr = pPlayer->_pBaseStr;
55 pPack->pBaseMag = pPlayer->_pBaseMag;
56 pPack->pBaseDex = pPlayer->_pBaseDex;
57 pPack->pBaseVit = pPlayer->_pBaseVit;
58 pPack->pLevel = pPlayer->_pLevel;
59 pPack->pStatPts = pPlayer->_pStatPts;
60 pPack->pExperience = SwapLE32(pPlayer->_pExperience);
61 pPack->pGold = SwapLE32(pPlayer->_pGold);
62 pPack->pHPBase = SwapLE32(pPlayer->_pHPBase);
63 pPack->pMaxHPBase = SwapLE32(pPlayer->_pMaxHPBase);
64 pPack->pManaBase = SwapLE32(pPlayer->_pManaBase);
65 pPack->pMaxManaBase = SwapLE32(pPlayer->_pMaxManaBase);
66 pPack->pMemSpells = SDL_SwapLE64(pPlayer->_pMemSpells);
67
68 for (i = 0; i < MAX_SPELLS; i++)
69 pPack->pSplLvl[i] = pPlayer->_pSplLvl[i];
70
71 pki = pPack->InvBody;
72 pi = pPlayer->InvBody;
73
74 for (i = 0; i < NUM_INVLOC; i++) {
75 PackItem(pki, pi);
76 pki++;
77 pi++;
78 }
79
80 pki = pPack->InvList;
81 pi = pPlayer->InvList;
82
83 for (i = 0; i < NUM_INV_GRID_ELEM; i++) {
84 PackItem(pki, pi);
85 pki++;
86 pi++;
87 }
88
89 for (i = 0; i < NUM_INV_GRID_ELEM; i++)
90 pPack->InvGrid[i] = pPlayer->InvGrid[i];
91
92 pPack->_pNumInv = pPlayer->_pNumInv;

Callers 3

multi_send_pinfoFunction · 0.85
pfile_write_heroFunction · 0.85
pfile_ui_save_createFunction · 0.85

Calls 1

PackItemFunction · 0.85

Tested by

no test coverage detected