summaryrefslogtreecommitdiff
path: root/game/shared/tf/tf_duel_summary.h
blob: 4529423c0adbf8e952c56a35cd7e37644d1e7e93 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Holds the CTFDualSummary
//
// $NoKeywords: $
//=============================================================================//

#ifndef TFDUELSUMMARY_H
#define TFDUELSUMMARY_H
#ifdef _WIN32
#pragma once
#endif

#include "gcsdk/protobufsharedobject.h"
#include "tf_gcmessages.h"


// do not re-order, stored in DB
enum eDuelStatus
{
	kDuelStatus_Loss,
	kDuelStatus_Tie,
	kDuelStatus_Win,
};

// do not re-order, stored in DB
enum eDuelEndReason
{
	kDuelEndReason_DuelOver,
	kDuelEndReason_PlayerDisconnected,
	kDuelEndReason_PlayerSwappedTeams,
	kDuelEndReason_LevelShutdown,
	kDuelEndReason_ScoreTiedAtZero,
	kDuelEndReason_PlayerKicked,
	kDuelEndReason_PlayerForceSwappedTeams,
	kDuelEndReason_ScoreTied,
	kDuelEndReason_Cancelled
};

const char *PchNameFromeDuelEndReason( eDuelEndReason eReason );

const uint32 kWinsPerLevel = 10;

//---------------------------------------------------------------------------------
// Purpose: 
//---------------------------------------------------------------------------------
class CTFDuelSummary : public GCSDK::CProtoBufSharedObject< CSOTFDuelSummary, k_EEconTypeDuelSummary >
{
#ifdef GC
	DECLARE_CLASS_MEMPOOL( CTFDuelSummary );
#endif

public:
#ifdef GC
	virtual bool BYieldingAddInsertToTransaction( GCSDK::CSQLAccess & sqlAccess );
	virtual bool BYieldingAddWriteToTransaction( GCSDK::CSQLAccess & sqlAccess, const CUtlVector< int > &fields );
	virtual bool BYieldingAddRemoveToTransaction( GCSDK::CSQLAccess & sqlAccess );

	void WriteToRecord( CSchDuelSummary *pDuelSummary ) const;
	void ReadFromRecord( const CSchDuelSummary & duelSummary );
#endif
};

#endif //TFDUELSUMMARY_H