Triggering build.
1 /* ======== SourceHook ========
2 * Copyright (C) 2004-2010 Metamod:Source Development Team
3 * No warranties of any kind
7 * Author(s): Pavol "PM OnoTo" Marko
8 * ============================
11 #include "sourcehook_impl.h"
17 void CProto::Fill(const ProtoInfo *pProto)
22 m_ParamsPassInfo.clear();
24 if (pProto->paramsPassInfo[0].size == 0)
28 m_Convention = pProto->convention;
29 m_NumOfParams = pProto->numOfParams;
31 m_RetPassInfo.size = pProto->retPassInfo.size;
32 m_RetPassInfo.type = pProto->retPassInfo.type;
33 m_RetPassInfo.flags = GetRealFlags(pProto->retPassInfo);
35 m_RetPassInfo.pNormalCtor = NULL;
36 m_RetPassInfo.pCopyCtor = NULL;
37 m_RetPassInfo.pDtor = NULL;
38 m_RetPassInfo.pAssignOperator = NULL;
41 m_ParamsPassInfo.resize(pProto->numOfParams);
43 for (int i = 1; i <= pProto->numOfParams; ++i)
45 m_ParamsPassInfo[i-1].size = pProto->paramsPassInfo[i].size;
46 m_ParamsPassInfo[i-1].type = pProto->paramsPassInfo[i].type;
47 m_ParamsPassInfo[i-1].flags = GetRealFlags(pProto->paramsPassInfo[i]);
49 m_ParamsPassInfo[i-1].pNormalCtor = NULL;
50 m_ParamsPassInfo[i-1].pCopyCtor = NULL;
51 m_ParamsPassInfo[i-1].pDtor = NULL;
52 m_ParamsPassInfo[i-1].pAssignOperator = NULL;
55 else if (pProto->paramsPassInfo[0].size == 1)
59 m_Convention = pProto->convention;
60 m_NumOfParams = pProto->numOfParams;
62 m_RetPassInfo.size = pProto->retPassInfo.size;
63 m_RetPassInfo.type = pProto->retPassInfo.type;
64 m_RetPassInfo.flags = pProto->retPassInfo.flags;
66 m_RetPassInfo.pNormalCtor = pProto->retPassInfo2.pNormalCtor;
67 m_RetPassInfo.pCopyCtor = pProto->retPassInfo2.pCopyCtor;
68 m_RetPassInfo.pDtor = pProto->retPassInfo2.pDtor;
69 m_RetPassInfo.pAssignOperator = pProto->retPassInfo2.pAssignOperator;
71 m_ParamsPassInfo.resize(pProto->numOfParams);
73 for (int i = 1; i <= pProto->numOfParams; ++i)
75 m_ParamsPassInfo[i-1].size = pProto->paramsPassInfo[i].size;
76 m_ParamsPassInfo[i-1].type = pProto->paramsPassInfo[i].type;
77 m_ParamsPassInfo[i-1].flags = pProto->paramsPassInfo[i].flags;
79 m_ParamsPassInfo[i-1].pNormalCtor = pProto->paramsPassInfo2[i].pNormalCtor;
80 m_ParamsPassInfo[i-1].pCopyCtor = pProto->paramsPassInfo2[i].pCopyCtor;
81 m_ParamsPassInfo[i-1].pDtor = pProto->paramsPassInfo2[i].pDtor;
82 m_ParamsPassInfo[i-1].pAssignOperator = pProto->paramsPassInfo2[i].pAssignOperator;
93 // Other than this, we assume that the plugins know what they're doing
94 bool CProto::operator == (const CProto &other) const
96 if (m_Version < 0 || other.GetVersion() < 0)
99 if (m_NumOfParams != other.GetNumOfParams())
102 if (m_Convention != ProtoInfo::CallConv_Unknown && other.GetConvention() != ProtoInfo::CallConv_Unknown &&
103 m_Convention != other.GetConvention())
106 if (GetRealSize(GetRet()) != GetRealSize(other.GetRet()))
109 for (int i = 0; i < m_NumOfParams; ++i)
111 if (GetRealSize(GetParam(i)) != GetRealSize(other.GetParam(i)))
113 if (GetParam(i).type != PassInfo::PassType_Unknown && other.GetParam(i).type != PassInfo::PassType_Unknown)
115 if (GetParam(i).type != other.GetParam(i).type)
117 if (GetParam(i).flags != other.GetParam(i).flags)
125 bool CProto::ExactlyEqual(const CProto &other) const
127 if (m_Version != other.m_Version ||
128 m_NumOfParams != other.m_NumOfParams ||
129 m_Convention != other.m_Convention ||
130 GetRet() != other.GetRet())
135 for (int i = 0; i < m_NumOfParams; ++i)
137 if(GetParam(i) != other.GetParam(i))