修复库存问题

This commit is contained in:
aozhiwei 2021-07-06 14:31:02 +08:00
parent e9133812d4
commit 5431630556
2 changed files with 15 additions and 0 deletions

View File

@ -1343,6 +1343,9 @@ void Creature::Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance)
case IS_FRAG: //手雷
case IS_SMOKE: //烟雾弹
{
#if 1
DecInventory(slot_id, 1);
#endif
if (GetCurrWeapon()->ammo <= 0) {
if (GetInventory(slot_id) > 0) {
DecInventory(slot_id, 1);
@ -1371,6 +1374,9 @@ void Creature::Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance)
case IS_TRAP: //陷井
case IS_MINE: //地雷
{
#if 1
DecInventory(slot_id, 1);
#endif
if (GetCurrWeapon()->ammo <= 0) {
if (GetInventory(slot_id) > 0) {
DecInventory(slot_id, 1);
@ -1399,6 +1405,9 @@ void Creature::Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance)
case IS_SINGAL_GUN:
case IS_OIL_BUCKET:
{
#if 1
DecInventory(slot_id, 1);
#endif
if (GetCurrWeapon()->ammo <= 0) {
if (GetInventory(slot_id) > 0) {
DecInventory(slot_id, 1);

View File

@ -629,7 +629,9 @@ void Player::LootInteraction(Loot* entity)
weapon->ammo += entity->count;
weapon->meta = item_meta;
weapon->Recalc();
#if 0
DecInventory(item_meta->i->_inventory_slot(), add_num);
#endif
}
break;
case IS_1XSCOPE:
@ -656,7 +658,9 @@ void Player::LootInteraction(Loot* entity)
weapon->ammo += entity->count;
weapon->meta = item_meta;
weapon->Recalc();
#if 0
DecInventory(item_meta->i->_inventory_slot(), add_num);
#endif
}
break;
case IS_C4:
@ -672,7 +676,9 @@ void Player::LootInteraction(Loot* entity)
weapon->ammo += entity->count;
weapon->meta = item_meta;
weapon->Recalc();
#if 0
DecInventory(item_meta->i->_inventory_slot(), add_num);
#endif
}
break;
default: