diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/shared/econ/econ_contribution.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/shared/econ/econ_contribution.cpp')
| -rw-r--r-- | game/shared/econ/econ_contribution.cpp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/game/shared/econ/econ_contribution.cpp b/game/shared/econ/econ_contribution.cpp new file mode 100644 index 0000000..25dc060 --- /dev/null +++ b/game/shared/econ/econ_contribution.cpp @@ -0,0 +1,64 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Code for the CTFMapContribution object +// +// $NoKeywords: $ +//=============================================================================// + +#include "cbase.h" + +#include "econ_contribution.h" + +using namespace GCSDK; + +#ifdef GC +IMPLEMENT_CLASS_MEMPOOL( CTFMapContribution, 10 * 1000, UTLMEMORYPOOL_GROW_SLOW ); + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +bool CTFMapContribution::BYieldingAddInsertToTransaction( GCSDK::CSQLAccess & sqlAccess ) +{ + CSchMapContribution schMapContribution; + WriteToRecord( &schMapContribution ); + return CSchemaSharedObjectHelper::BYieldingAddInsertToTransaction( sqlAccess, &schMapContribution ); +} + +bool CTFMapContribution::BYieldingAddWriteToTransaction( GCSDK::CSQLAccess & sqlAccess, const CUtlVector< int > &fields ) +{ + CSchMapContribution schMapContribution; + WriteToRecord( &schMapContribution ); + CColumnSet csDatabaseDirty( schMapContribution.GetPSchema()->GetRecordInfo() ); + csDatabaseDirty.MakeEmpty(); + if ( fields.HasElement( CSOTFMapContribution::kContributionLevelFieldNumber ) ) + { + csDatabaseDirty.BAddColumn( CSchMapContribution::k_iField_unContributionLevel ); + } + return CSchemaSharedObjectHelper::BYieldingAddWriteToTransaction( sqlAccess, &schMapContribution, csDatabaseDirty ); +} + +bool CTFMapContribution::BYieldingAddRemoveToTransaction( GCSDK::CSQLAccess & sqlAccess ) +{ + CSchMapContribution schMapContribution; + WriteToRecord( &schMapContribution ); + return CSchemaSharedObjectHelper::BYieldingAddRemoveToTransaction( sqlAccess, &schMapContribution ); +} + +void CTFMapContribution::WriteToRecord( CSchMapContribution *pMapContribution ) const +{ + pMapContribution->m_unAccountID = Obj().account_id(); + pMapContribution->m_unDefIndex = Obj().def_index(); + pMapContribution->m_unContributionLevel = Obj().contribution_level(); +} + + +void CTFMapContribution::ReadFromRecord( const CSchMapContribution & mapContribution ) +{ + Obj().set_account_id( mapContribution.m_unAccountID ); + Obj().set_def_index( mapContribution.m_unDefIndex ); + Obj().set_contribution_level( mapContribution.m_unContributionLevel ); +} + + + +#endif |