-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCvDllDiplomacyAI.cpp
95 lines (92 loc) · 3.25 KB
/
CvDllDiplomacyAI.cpp
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
88
89
90
91
92
93
94
95
/* -------------------------------------------------------------------------------------------------------
© 1991-2012 Take-Two Interactive Software and its subsidiaries. Developed by Firaxis Games.
Sid Meier's Civilization V, Civ, Civilization, 2K Games, Firaxis Games, Take-Two Interactive Software
and their respective logos are all trademarks of Take-Two interactive Software, Inc.
All other marks and trademarks are the property of their respective owners.
All rights reserved.
------------------------------------------------------------------------------------------------------- */
#include "CvGameCoreDLLPCH.h"
#include "CvDllDiplomacyAI.h"
#include "CvDllContext.h"
#include "CvDiplomacyAI.h"
CvDllDiplomacyAI::CvDllDiplomacyAI(CvDiplomacyAI* pDiplomacyAI)
: m_pDiplomacyAI(pDiplomacyAI)
, m_uiRefCount(1)
{
}
//------------------------------------------------------------------------------
CvDllDiplomacyAI::~CvDllDiplomacyAI()
{
}
//------------------------------------------------------------------------------
void* CvDllDiplomacyAI::QueryInterface(GUID guidInterface)
{
if( guidInterface == ICvUnknown::GetInterfaceId() ||
guidInterface == ICvDiplomacyAI1::GetInterfaceId())
{
IncrementReference();
return this;
}
return NULL;
}
//------------------------------------------------------------------------------
unsigned int CvDllDiplomacyAI::IncrementReference()
{
++m_uiRefCount;
return m_uiRefCount;
}
//------------------------------------------------------------------------------
unsigned int CvDllDiplomacyAI::DecrementReference()
{
if(m_uiRefCount == 1)
{
delete this;
return 0;
}
else
{
--m_uiRefCount;
return m_uiRefCount;
}
}
//------------------------------------------------------------------------------
unsigned int CvDllDiplomacyAI::GetReferenceCount()
{
return m_uiRefCount;
}
//------------------------------------------------------------------------------
void CvDllDiplomacyAI::Destroy()
{
DecrementReference();
}
//------------------------------------------------------------------------------
void CvDllDiplomacyAI::operator delete(void* p)
{
CvDllGameContext::Free(p);
}
//------------------------------------------------------------------------------
void* CvDllDiplomacyAI::operator new(size_t bytes)
{
return CvDllGameContext::Allocate(bytes);
}
//------------------------------------------------------------------------------
CvDiplomacyAI* CvDllDiplomacyAI::GetInstance()
{
return m_pDiplomacyAI;
}
//------------------------------------------------------------------------------
void CvDllDiplomacyAI::DoBeginDiploWithHuman()
{
m_pDiplomacyAI->DoBeginDiploWithHuman();
}
//------------------------------------------------------------------------------
const char* CvDllDiplomacyAI::GetDiploStringForMessage(DiploMessageTypes eDiploMessage, PlayerTypes eForPlayer, const char* szOptionalKey1)
{
return m_pDiplomacyAI->GetDiploStringForMessage(eDiploMessage, eForPlayer, szOptionalKey1);
}
//------------------------------------------------------------------------------
void CvDllDiplomacyAI::TestUIDiploStatement(PlayerTypes eToPlayer, DiploStatementTypes eStatement, int iArg1)
{
m_pDiplomacyAI->TestUIDiploStatement(eToPlayer, eStatement, iArg1);
}
//------------------------------------------------------------------------------