DWORD CPedWeapons::GetAmmoBySlot(eWeaponSlot weaponSlot) { if (m_pPedWeapons) { if(weaponSlot >= WEAPON_SLOT_MAX) return 0; CWeapon * pCurrentWeapon = GetCurrentWeapon(); if(pCurrentWeapon && pCurrentWeapon->GetSlot() == weaponSlot) m_pWeaponSlots[weaponSlot]->SetAmmo(pCurrentWeapon->GetAmmoTotal()); return m_pWeaponSlots[weaponSlot]->GetAmmo(); } return 0; }
const CCoverPoint *CAI_Stalker::find_best_cover (const Fvector &position_to_cover_from) { #ifdef _DEBUG // Msg ("* [%6d][%s] search for new cover performed",Device.dwTimeGlobal,*cName()); #endif #ifdef _DEBUG ++g_near_cover_search_count; #endif float minimum_enemy_distance, maximum_enemy_distance; compute_enemy_distances (minimum_enemy_distance, maximum_enemy_distance); if (!best_weapon()) m_ce_best->can_use_smart_covers (false); else { CWeapon* weapon = smart_cast<CWeapon*>(best_weapon()); if (!weapon) m_ce_best->can_use_smart_covers (false); else { if (weapon->GetSlot() != 2) m_ce_best->can_use_smart_covers (false); else m_ce_best->can_use_smart_covers (true); } } m_ce_best->setup (position_to_cover_from, minimum_enemy_distance,maximum_enemy_distance,minimum_enemy_distance); const CCoverPoint *point = ai().cover_manager().best_cover(Position(),10.f,*m_ce_best,CStalkerMovementRestrictor(this,true)); if (point) return (point); #ifdef _DEBUG ++g_far_cover_search_count; #endif m_ce_best->setup (position_to_cover_from, minimum_enemy_distance,maximum_enemy_distance,minimum_enemy_distance); point = ai().cover_manager().best_cover(Position(),30.f,*m_ce_best,CStalkerMovementRestrictor(this,true)); return (point); }