int CWeapon::GetSuitableAmmoTotal( bool use_item_to_spawn ) const { int ae_count = iAmmoElapsed; if ( !m_pInventory ) { return ae_count; } //чтоб не делать лишних пересчетов if ( m_pInventory->ModifyFrame() <= m_BriefInfo_CalcFrame ) { return ae_count + m_iAmmoCurrentTotal; } m_BriefInfo_CalcFrame = Device.dwFrame; m_iAmmoCurrentTotal = 0; for ( u8 i = 0; i < u8(m_ammoTypes.size()); ++i ) { m_iAmmoCurrentTotal += GetAmmoCount_forType( m_ammoTypes[i] ); if ( !use_item_to_spawn ) { continue; } if ( !inventory_owner().item_to_spawn() ) { continue; } m_iAmmoCurrentTotal += inventory_owner().ammo_in_box_to_spawn(); } return ae_count + m_iAmmoCurrentTotal; }
bool CInventoryItem::CanTrade() const { bool res = true; #pragma todo("Dima to Andy : why CInventoryItem::CanTrade can be called for the item, which doesn't have owner?") if(m_pInventory) res = inventory_owner().AllowItemToTrade(this,m_eItemPlace); return (res && m_flags.test(FCanTrade) && !IsQuestItem()); }
bool CWeapon::unlimited_ammo() { if (IsGameTypeSingle()) { if(m_pInventory) { return inventory_owner().unlimited_ammo() && m_DefaultCartridge.m_flags.test(CCartridge::cfCanBeUnlimited); }else return false; } return ((GameID() == eGameIDDeathmatch) && m_DefaultCartridge.m_flags.test(CCartridge::cfCanBeUnlimited)); };
////////////////////////////////////////////////////////////////////////// // Для эффекта отдачи оружия void CWeapon::AddShotEffector () { inventory_owner().on_weapon_shot_start (this); }