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

Function RndTypeItems

Source/items.cpp:1916–1940  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1914}
1915
1916int RndTypeItems(int itype, int imid)
1917{
1918 int i, ri;
1919 BOOL okflag;
1920 int ril[512];
1921
1922 ri = 0;
1923 for (i = 0; AllItemsList[i].iLoc != ILOC_INVALID; i++) {
1924 okflag = TRUE;
1925 if (!AllItemsList[i].iRnd)
1926 okflag = FALSE;
1927 if (currlevel << 1 < AllItemsList[i].iMinMLvl)
1928 okflag = FALSE;
1929 if (AllItemsList[i].itype != itype)
1930 okflag = FALSE;
1931 if (imid != -1 && AllItemsList[i].iMiscId != imid)
1932 okflag = FALSE;
1933 if (okflag) {
1934 ril[ri] = i;
1935 ri++;
1936 }
1937 }
1938
1939 return ril[random_(27, ri)];
1940}
1941
1942int CheckUnique(int i, int lvl, int uper, BOOL recreate)
1943{

Callers 4

CreateTypeItemFunction · 0.85
CreateSpellBookFunction · 0.85
CreateMagicArmorFunction · 0.85
CreateMagicWeaponFunction · 0.85

Calls 1

random_Function · 0.85

Tested by

no test coverage detected