Skip to content

Commit

Permalink
Vial/potions hotkey count fix (#2730)
Browse files Browse the repository at this point in the history
Fix #2725 introduced in #2604.

Getting subtype for stackables ex. mana potions will break the full count. The solution is to compare if subtype returns its count, if not then pass the subtype.
  • Loading branch information
nekiro authored and DSpeichert committed Jan 3, 2020
1 parent 088ab53 commit 071fee8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/actions.cpp
Expand Up @@ -417,7 +417,8 @@ bool Actions::useItem(Player* player, const Position& pos, uint8_t index, Item*
player->stopWalk();

if (isHotkey) {
showUseHotkeyMessage(player, item, player->getItemTypeCount(item->getID(), item->getSubType()));
uint16_t subType = item->getSubType();
showUseHotkeyMessage(player, item, player->getItemTypeCount(item->getID(), subType != item->getItemCount() ? subType : -1));
}

ReturnValue ret = internalUseItem(player, pos, index, item, isHotkey);
Expand Down Expand Up @@ -447,7 +448,8 @@ bool Actions::useItemEx(Player* player, const Position& fromPos, const Position&
}

if (isHotkey) {
showUseHotkeyMessage(player, item, player->getItemTypeCount(item->getID(), item->getSubType()));
uint16_t subType = item->getSubType();
showUseHotkeyMessage(player, item, player->getItemTypeCount(item->getID(), subType != item->getItemCount() ? subType : -1));
}

if (!action->executeUse(player, item, fromPos, action->getTarget(player, creature, toPos, toStackPos), toPos, isHotkey)) {
Expand Down

0 comments on commit 071fee8

Please sign in to comment.