When shopping, allow stacking without empty slot
This commit is contained in:
@@ -579,6 +579,10 @@ eBuyStatus cPlayer::give_item(cItem item, int flags) {
|
|||||||
return eBuyStatus::NO_SPACE;
|
return eBuyStatus::NO_SPACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eBuyStatus cPlayer::can_give_item(cItem item) const {
|
||||||
|
return const_cast<cPlayer*>(this)->give_item(item, GIVE_CHECK_ONLY);
|
||||||
|
}
|
||||||
|
|
||||||
bool cPlayer::equip_item(int which_item, bool do_print) {
|
bool cPlayer::equip_item(int which_item, bool do_print) {
|
||||||
const cItem& item = items[which_item];
|
const cItem& item = items[which_item];
|
||||||
if((*item.variety).equip_count == 0) {
|
if((*item.variety).equip_count == 0) {
|
||||||
@@ -896,11 +900,9 @@ eBuyStatus cPlayer::ok_to_buy(short cost,cItem item) const {
|
|||||||
if(items[i].variety != eItemType::NO_ITEM && items[i].type_flag == item.type_flag && items[i].charges > 123)
|
if(items[i].variety != eItemType::NO_ITEM && items[i].type_flag == item.type_flag && items[i].charges > 123)
|
||||||
return eBuyStatus::HAVE_LOTS;
|
return eBuyStatus::HAVE_LOTS;
|
||||||
|
|
||||||
if(!has_space())
|
eBuyStatus pc_can_fit = can_give_item(item);
|
||||||
return eBuyStatus::NO_SPACE;
|
if(pc_can_fit != eBuyStatus::OK)
|
||||||
if(item.item_weight() > free_weight()) {
|
return pc_can_fit;
|
||||||
return eBuyStatus::TOO_HEAVY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(cost > party->gold)
|
if(cost > party->gold)
|
||||||
return eBuyStatus::NEED_GOLD;
|
return eBuyStatus::NEED_GOLD;
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ public:
|
|||||||
// Possible results of give_item are a subset of eBuyStatus, and shop code calls this function,
|
// Possible results of give_item are a subset of eBuyStatus, and shop code calls this function,
|
||||||
// so reuse the enum
|
// so reuse the enum
|
||||||
eBuyStatus give_item(cItem item, int flags);
|
eBuyStatus give_item(cItem item, int flags);
|
||||||
|
eBuyStatus can_give_item(cItem item) const;
|
||||||
bool equip_item(int which_item, bool do_print);
|
bool equip_item(int which_item, bool do_print);
|
||||||
bool unequip_item(int which_item, bool do_print);
|
bool unequip_item(int which_item, bool do_print);
|
||||||
std::pair<cInvenSlot, cInvenSlot> get_weapons();
|
std::pair<cInvenSlot, cInvenSlot> get_weapons();
|
||||||
|
|||||||
Reference in New Issue
Block a user