Browse Source

Clean up SpawnSmith

pull/88/head
Anders Jenbo 7 years ago
parent
commit
a71bab2ce1
  1. 23
      Source/items.cpp

23
Source/items.cpp

@ -4167,26 +4167,23 @@ void SortSmith()
void SpawnSmith(int lvl) void SpawnSmith(int lvl)
{ {
ItemStruct *holdItem; int i, iCnt;
int i, nsi, idata;
nsi = random(50, 10) + 10; iCnt = random(50, 10) + 10;
for (i = 0; i < nsi; i++) { for (i = 0; i < iCnt; ++i) {
holdItem = &smithitem[i];
do { do {
item[0]._iSeed = GetRndSeed(); item[0]._iSeed = GetRndSeed();
SetRndSeed(item[0]._iSeed); SetRndSeed(item[0]._iSeed);
idata = RndSmithItem(lvl) - 1; GetItemAttrs(0, RndSmithItem(lvl) - 1, lvl);
GetItemAttrs(0, idata, lvl);
} while (item[0]._iIvalue > 140000); } while (item[0]._iIvalue > 140000);
qmemcpy(holdItem, item, sizeof(ItemStruct)); smithitem[i] = *item;
holdItem->_iCreateInfo = lvl | 0x400; smithitem[i]._iCreateInfo = lvl | 0x400;
holdItem->_iIdentified = TRUE; smithitem[i]._iIdentified = 1;
holdItem->_iStatFlag = StoreStatOk(holdItem); smithitem[i]._iStatFlag = StoreStatOk(&smithitem[i]);
} }
for (i = nsi; i < 20; i++) { for (i = iCnt; i < 20; ++i)
smithitem[i]._itype = -1; smithitem[i]._itype = -1;
}
SortSmith(); SortSmith();
} }

Loading…
Cancel
Save