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

Function CreateSpellBook

Source/items.cpp:3917–3940  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3915}
3916
3917void CreateSpellBook(int x, int y, int ispell, BOOL sendmsg, BOOL delta)
3918{
3919 int ii, idx;
3920 BOOL done;
3921
3922 done = FALSE;
3923 idx = RndTypeItems(ITYPE_MISC, IMISC_BOOK);
3924 if (numitems < MAXITEMS) {
3925 ii = itemavail[0];
3926 GetSuperItemSpace(x, y, ii);
3927 itemavail[0] = itemavail[MAXITEMS - numitems - 1];
3928 itemactive[numitems] = ii;
3929 while (!done) {
3930 SetupAllItems(ii, idx, GetRndSeed(), 2 * currlevel, 1, TRUE, FALSE, delta);
3931 if (item[ii]._iMiscId == IMISC_BOOK && item[ii]._iSpell == ispell)
3932 done = TRUE;
3933 }
3934 if (sendmsg)
3935 NetSendCmdDItem(FALSE, ii);
3936 if (delta)
3937 DeltaAddItem(ii);
3938 numitems++;
3939 }
3940}
3941
3942void CreateMagicArmor(int x, int y, int imisc, int icurs, BOOL sendmsg, BOOL delta)
3943{

Callers 1

OperateSlainHeroFunction · 0.85

Calls 6

RndTypeItemsFunction · 0.85
GetSuperItemSpaceFunction · 0.85
SetupAllItemsFunction · 0.85
GetRndSeedFunction · 0.85
NetSendCmdDItemFunction · 0.85
DeltaAddItemFunction · 0.85

Tested by

no test coverage detected