This commit is contained in:
aozhiwei 2023-05-20 22:14:33 +08:00
parent 78a5893c09
commit 92ecda9c19
3 changed files with 7 additions and 1 deletions

View File

@ -47,6 +47,11 @@ void Compose::Clear()
hold_buffs_.clear(); hold_buffs_.clear();
} }
bool Compose::CanAdd()
{
return GetNum() < 9;
}
void Compose::IncNum() void Compose::IncNum()
{ {
++num_; ++num_;

View File

@ -12,6 +12,7 @@ class Compose
void Init(); void Init();
void IncNum(); void IncNum();
bool CanAdd();
int GetNum() { return num_; } int GetNum() { return num_; }
private: private:

View File

@ -2637,7 +2637,7 @@ void Human::ProcLootWeaponNew(AddItemDTO& dto)
if (GetCurrWeapon()->weapon_idx == GUN_SLOT1 || if (GetCurrWeapon()->weapon_idx == GUN_SLOT1 ||
GetCurrWeapon()->weapon_idx == GUN_SLOT2) { GetCurrWeapon()->weapon_idx == GUN_SLOT2) {
if (GetCurrWeapon()->weapon_id == dto.item_meta->id()) { if (GetCurrWeapon()->weapon_id == dto.item_meta->id()) {
if (GetCompose()->GetNum() >= 9) { if (!GetCompose()->CanAdd()) {
return; return;
} }
GetCompose()->IncNum(); GetCompose()->IncNum();