Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarPlayerInventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/game/StarPlayerInventory.cpp')
-rw-r--r--source/game/StarPlayerInventory.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/game/StarPlayerInventory.cpp b/source/game/StarPlayerInventory.cpp
index dc8d8e4..bacd58d 100644
--- a/source/game/StarPlayerInventory.cpp
+++ b/source/game/StarPlayerInventory.cpp
@@ -214,6 +214,14 @@ ItemPtr PlayerInventory::addItems(ItemPtr items) {
if (is<BackArmor>(items) && !backArmor())
m_equipment[EquipmentSlot::Back] = items->take(1);
+ if (is<MaterialItem>(items)) {
+ if (auto primary = primaryHeldItem()) {
+ primary->stackWith(items);
+ if (items->empty())
+ return {};
+ }
+ }
+
// Then, finally the bags
return addToBags(std::move(items));
}