Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "cs_ammodef.h"
  8. // memdbgon must be the last include file in a .cpp file!!!
  9. #include "tier0/memdbgon.h"
  10. //-----------------------------------------------------------------------------
  11. void CCSAmmoDef::AddAmmoCost( char const* name, int cost, int buySize )
  12. {
  13. int index = Index( name );
  14. if ( index < 1 || index >= m_nAmmoIndex )
  15. return;
  16. m_csAmmo[index].buySize = buySize;
  17. m_csAmmo[index].cost = cost;
  18. }
  19. //-----------------------------------------------------------------------------
  20. int CCSAmmoDef::GetBuySize( int index ) const
  21. {
  22. if ( index < 1 || index >= m_nAmmoIndex )
  23. return 0;
  24. return m_csAmmo[index].buySize;
  25. }
  26. //-----------------------------------------------------------------------------
  27. int CCSAmmoDef::GetCost( int index ) const
  28. {
  29. if ( index < 1 || index >= m_nAmmoIndex )
  30. return 0;
  31. return m_csAmmo[index].cost;
  32. }
  33. //-----------------------------------------------------------------------------
  34. CCSAmmoDef::CCSAmmoDef(void)
  35. {
  36. memset( m_csAmmo, 0, sizeof( m_csAmmo ) );
  37. }
  38. //-----------------------------------------------------------------------------
  39. CCSAmmoDef::~CCSAmmoDef( void )
  40. {
  41. }
  42. //-----------------------------------------------------------------------------