Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrolls do not auto refill the belt properly #5606

Closed
manapixel opened this issue Dec 15, 2022 · 1 comment
Closed

Scrolls do not auto refill the belt properly #5606

manapixel opened this issue Dec 15, 2022 · 1 comment

Comments

@manapixel
Copy link

Operating System

Linux x64

DevilutionX version

1.4.1 (latest release)

Describe

If the auto refill belt option is enabled, scrolls will still be consumed from the belt instead of the inventory. Potions work as expected.

To Reproduce

Set the Auto Refill Belt option on.
Place a scroll in your inventory. Place one in your belt.
Use the scroll in the belt.

Expected Behavior

The inventory item should be consumed rather than the belt item.

Additional context

The code in inv.cpp::UseInvItem that sets the player.queuedSpell.spellFrom value should be changed to use the newly calculated index (c) rather than the passed in index (cii) to allow either the found inventory item to be used, or the last item in the belt (if present). However, the calculated index (c) also needs to be reset as an offset from the baseline inv_item as expected by inv.cpp::ConsumeScroll.

if (speedlist) {
  if (player.SpdList[c]._iMiscId == IMISC_NOTE) {
    InitQTextMsg(TEXT_BOOK9);
    CloseInventory();
    return true;
  }
  if (!item->isScroll() && !item->isRune())
    player.RemoveSpdBarItem(c);
  else
    player.queuedSpell.spellFrom = cii;                           <---- OLD
    player.queuedSpell.spellFrom = INVITEM_BELT_FIRST + c;        <---- NEW
  return true;
}

if (player.InvList[c]._iMiscId == IMISC_MAPOFDOOM)
  return true;
if (player.InvList[c]._iMiscId == IMISC_NOTE) {
  InitQTextMsg(TEXT_BOOK9);
  CloseInventory();
  return true;
}
if (!item->isScroll() && !item->isRune())
  player.RemoveInvItem(c);
else
  player.queuedSpell.spellFrom = cii;                             <---- OLD    
  player.queuedSpell.spellFrom = INVITEM_INV_FIRST + c;           <---- NEW

return true;
@manapixel manapixel changed the title Scrolls do not auto refill on the belt properly Scrolls do not auto refill the belt properly Dec 15, 2022
@kphoenix137
Copy link
Collaborator

#7007

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants