Counter Strike : Global Offensive Source Code
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.

64 lines
2.2 KiB

  1. //========= Copyright (c), Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Code for the CTFMapContribution object
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "cbase.h"
  8. #include "econ_contribution.h"
  9. using namespace GCSDK;
  10. #ifdef GC
  11. IMPLEMENT_CLASS_MEMPOOL( CTFMapContribution, 10 * 1000, UTLMEMORYPOOL_GROW_SLOW );
  12. // memdbgon must be the last include file in a .cpp file!!!
  13. #include "tier0/memdbgon.h"
  14. bool CTFMapContribution::BYieldingAddInsertToTransaction( GCSDK::CSQLAccess & sqlAccess )
  15. {
  16. CSchMapContribution schMapContribution;
  17. WriteToRecord( &schMapContribution );
  18. return CSchemaSharedObjectHelper::BYieldingAddInsertToTransaction( sqlAccess, &schMapContribution );
  19. }
  20. bool CTFMapContribution::BYieldingAddWriteToTransaction( GCSDK::CSQLAccess & sqlAccess, const CUtlVector< int > &fields )
  21. {
  22. CSchMapContribution schMapContribution;
  23. WriteToRecord( &schMapContribution );
  24. CColumnSet csDatabaseDirty( schMapContribution.GetPSchema()->GetRecordInfo() );
  25. csDatabaseDirty.MakeEmpty();
  26. if ( fields.HasElement( CSOTFMapContribution::kContributionLevelFieldNumber ) )
  27. {
  28. csDatabaseDirty.BAddColumn( CSchMapContribution::k_iField_unContributionLevel );
  29. }
  30. return CSchemaSharedObjectHelper::BYieldingAddWriteToTransaction( sqlAccess, &schMapContribution, csDatabaseDirty );
  31. }
  32. bool CTFMapContribution::BYieldingAddRemoveToTransaction( GCSDK::CSQLAccess & sqlAccess )
  33. {
  34. CSchMapContribution schMapContribution;
  35. WriteToRecord( &schMapContribution );
  36. return CSchemaSharedObjectHelper::BYieldingAddRemoveToTransaction( sqlAccess, &schMapContribution );
  37. }
  38. void CTFMapContribution::WriteToRecord( CSchMapContribution *pMapContribution ) const
  39. {
  40. pMapContribution->m_unAccountID = Obj().account_id();
  41. pMapContribution->m_unDefIndex = Obj().def_index();
  42. pMapContribution->m_unContributionLevel = Obj().contribution_level();
  43. }
  44. void CTFMapContribution::ReadFromRecord( const CSchMapContribution & mapContribution )
  45. {
  46. Obj().set_account_id( mapContribution.m_unAccountID );
  47. Obj().set_def_index( mapContribution.m_unDefIndex );
  48. Obj().set_contribution_level( mapContribution.m_unContributionLevel );
  49. }
  50. #endif