vector<Item*> UseItemCommand::getUseableItemsInInventory(Hero& hero) { int i{ 1 }; vector<Item*> list; for (const auto d : hero.getItems()) { SpecialItem* item = dynamic_cast<SpecialItem*>(d); if (item) { list.push_back(item); } else { Potion* potion = dynamic_cast<Potion*>(d); if (potion) { list.push_back(potion); } } } return list; }