summaryrefslogtreecommitdiff
path: root/replay/common/basereplayserializeable.cpp
blob: a0a7bd47780f6d060167e183bc70e74036e942c3 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//

#include "replay/basereplayserializeable.h"
#include "replay/replayutils.h"
#include "KeyValues.h"
#include "tier1/strtools.h"
#include "replay/shared_defs.h"

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

//----------------------------------------------------------------------------------------

CBaseReplaySerializeable::CBaseReplaySerializeable()
:	m_hThis( REPLAY_HANDLE_INVALID ),
	m_bLocked( false )
{
}

void CBaseReplaySerializeable::SetHandle( ReplayHandle_t h )
{
	m_hThis = h;
}

ReplayHandle_t CBaseReplaySerializeable::GetHandle() const
{
	return m_hThis;
}

bool CBaseReplaySerializeable::Read( KeyValues *pIn )
{
	m_hThis = (ReplayHandle_t)pIn->GetInt( "handle" );

	return true;
}

void CBaseReplaySerializeable::Write( KeyValues *pOut )
{
	pOut->SetInt( "handle", (int)m_hThis );
}

const char *CBaseReplaySerializeable::GetFullFilename() const
{
	const char *pPath = GetPath();
	const char *pFilename = GetFilename();

	if ( !pPath || !pPath[0] || !pFilename || !pFilename[0] )
		return NULL;

	return Replay_va( "%s%s", pPath, pFilename );
}

const char *CBaseReplaySerializeable::GetFilename() const
{
	return Replay_va( "%s.%s", GetSubKeyTitle(), GENERIC_FILE_EXTENSION );
}

const char *CBaseReplaySerializeable::GetDebugName() const
{
	return GetSubKeyTitle();
}

void CBaseReplaySerializeable::SetLocked( bool bLocked )
{
	m_bLocked = bLocked;
}

bool CBaseReplaySerializeable::IsLocked() const
{
	return m_bLocked;
}

void CBaseReplaySerializeable::OnDelete()
{
}

void CBaseReplaySerializeable::OnUnload()
{
}

void CBaseReplaySerializeable::OnAddedToDirtyList()
{
}

//----------------------------------------------------------------------------------------