Skip to content

Commit ce494fc

Browse files
committed
final refactor
1 parent b507049 commit ce494fc

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

Source/items.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,6 +1432,8 @@ _item_indexes RndTypeItems(ItemType itemType, int imid, int lvl)
14321432
return false;
14331433
if (imid != -1 && item.iMiscId != imid)
14341434
return false;
1435+
if (*GetOptions().Gameplay.disableSearch && item.iSpell == SpellID::Search)
1436+
return false;
14351437
return true;
14361438
});
14371439
}
@@ -1526,13 +1528,7 @@ void SetupBaseItem(Point position, _item_indexes idx, bool onlygood, bool sendms
15261528

15271529
do {
15281530
auto originalPos = item.position;
1529-
if (item._iMiscId == IMISC_SCROLL) {
1530-
item = {};
1531-
idx = RndTypeItems(ItemType::Misc, IMISC_SCROLL, curlv);
1532-
} else if (item._iMiscId == IMISC_BOOK) {
1533-
item = {};
1534-
idx = RndTypeItems(ItemType::Misc, IMISC_BOOK, curlv);
1535-
}
1531+
item = {};
15361532
item.position = originalPos;
15371533
SetupAllItems(*MyPlayer, item, idx, AdvanceRndSeed(), 2 * curlv, 1, onlygood, delta, false);
15381534
} while ((item._iSpell == SpellID::Search) && *GetOptions().Gameplay.disableSearch);
@@ -3264,9 +3260,8 @@ _item_indexes RndItemForMonsterLevel(int8_t monsterLevel)
32643260
return IDI_GOLD;
32653261

32663262
return GetItemIndexForDroppableItem(true, [&monsterLevel](const ItemData &item) {
3267-
if (*GetOptions().Gameplay.disableSearch && item.iSpell == SpellID::Search)
3268-
return false;
3269-
return item.iMinMLvl <= monsterLevel;
3263+
return (!(*GetOptions().Gameplay.disableSearch) || item.iSpell != SpellID::Search)
3264+
&& (item.iMinMLvl <= monsterLevel);
32703265
});
32713266
}
32723267

0 commit comments

Comments
 (0)