本文整理汇总了C++中CheckCondition函数的典型用法代码示例。如果您正苦于以下问题:C++ CheckCondition函数的具体用法?C++ CheckCondition怎么用?C++ CheckCondition使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckCondition函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckCondition
uint32 EquipImprove::cost(GameItem* item)
{
uint32 coststonenum=0;
uint32 costmoney=100;
uint32 money = m_owner->getMoney(MoneyType_Money);
if(coststonenum != 0)
{
GameItem *stone = m_owner->m_pack_manager.m_commom_pack.getItemByBaseID(100001);
CheckCondition(stone,ERR_STONE);
CheckCondition(stone->getItemNumber()>coststonenum,ERR_STONE);
}
CheckCondition(money>=costmoney,ERR_MONEY);
m_owner->subMoney(MoneyType_Money,costmoney,DelMoneyAction_EquipImprove);
if(coststonenum != 0)
{
m_owner->m_pack_manager.reduceItemNumByBaseID(100001,coststonenum,DelItemAction_Improve);
}
return ERR_SUCCESS;
}
示例2: CreateIndexBuffer
static GLuint CreateIndexBuffer()
{
GLuint inds[IndexCount];
GLuint* pIndex = &inds[0];
GLuint n = 0;
for (GLuint i = 0; i < Slices; i++)
{
for (GLuint j = 0; j < Stacks; j++)
{
*pIndex++ = n + j;
*pIndex++ = n + (j + 1) % Stacks;
*pIndex++ = n + j + Stacks;
*pIndex++ = n + j + Stacks;
*pIndex++ = n + (j + 1) % Stacks;
*pIndex++ = n + (j + 1) % Stacks + Stacks;
}
n += Stacks;
}
CheckCondition(n == VertexCount, "Tessellation error.");
CheckCondition(pIndex - &inds[0] == IndexCount, "Tessellation error.");
GLuint handle;
GLsizeiptr size = sizeof(inds);
const GLvoid* data = &inds[0];
GLenum usage = GL_STATIC_DRAW;
glGenBuffers(1, &handle);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, handle);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, data, usage);
return handle;
}
示例3: FilterKeyMatch
unsigned char FilterKeyMatch(
void* arg,
const char* key, size_t length,
const char* filter, size_t filter_length) {
CheckCondition(filter_length == 4);
CheckCondition(memcmp(filter, "fake", 4) == 0);
return fake_filter_result;
}
示例4: CheckDel
// Callback from leveldb_writebatch_iterate()
static void CheckDel(void* ptr, const char* k, size_t klen)
{
int* state = (int*) ptr;
CheckCondition(*state == 2);
CheckEqual("bar", k, klen);
(*state)++;
}
示例5: callr
// Generic callr implementation
// CALLRcc $R
// 0001 0111 rrr1 cccc
// Call function if condition cc has been met. Push program counter of
// instruction following "call" to call stack $st0. Set program counter to
// register $R.
void callr(const UDSPInstruction opc)
{
if (CheckCondition(opc & 0xf))
{
u8 reg = (opc >> 5) & 0x7;
u16 addr = dsp_op_read_reg(reg);
dsp_reg_store_stack(DSP_STACK_C, g_dsp.pc);
g_dsp.pc = addr;
}
示例6: ODM_ReadAndConfig_PHY_REG_PG_8723B
void
ODM_ReadAndConfig_PHY_REG_PG_8723B(
IN PDM_ODM_T pDM_Odm
)
{
u4Byte hex = 0;
u4Byte i = 0;
u2Byte count = 0;
pu4Byte ptr_array = NULL;
u1Byte platform = pDM_Odm->SupportPlatform;
u1Byte _interface = pDM_Odm->SupportInterface;
u1Byte board = pDM_Odm->BoardType;
u4Byte ArrayLen = sizeof(Array_PHY_REG_PG_8723B)/sizeof(u4Byte);
pu4Byte Array = Array_PHY_REG_PG_8723B;
//TODO,130422
// pDM_Odm->PhyRegPgVersion = 1;
// pDM_Odm->PhyRegPgValueType = PHY_REG_PG_RELATIVE_VALUE;
hex += board;
hex += _interface << 8;
hex += platform << 16;
hex += 0xFF000000;
for (i = 0; i < ArrayLen; i += 6 )
{
u4Byte v1 = Array[i];
u4Byte v2 = Array[i+1];
u4Byte v3 = Array[i+2];
u4Byte v4 = Array[i+3];
u4Byte v5 = Array[i+4];
u4Byte v6 = Array[i+5];
// this line is a line of pure_body
if ( v1 < 0xCDCDCDCD )
{
odm_ConfigBB_PHY_REG_PG_8723B(pDM_Odm, v1, v2, v3, v4, v5, v6);
continue;
}
else
{ // this line is the start of branch
if ( !CheckCondition(Array[i], hex) )
{ // don't need the hw_body
i += 2; // skip the pair of expression
v1 = Array[i];
v2 = Array[i+1];
v3 = Array[i+2];
while (v2 != 0xDEAD)
{
i += 3;
v1 = Array[i];
v2 = Array[i+1];
v3 = Array[i+1];
}
}
}
}
}
示例7: while
bool CTesterProgram::NextLine(char &type, CString &cmd)
{
if(m_iStackDepth <= 0) //not running in any function
return false;
CString line;
CString para;
//stay in some function ,retrieve the parameter first
para = m_fun.GetAt(m_iStackDepth);
line = m_fun.GetAt(m_iFunpos[m_iStackDepth]);
m_iFunpos[m_iStackDepth]+=1;
//replace the ^i^ with the corresponding parameter
if(line.Find('^',0) > 0)
{
int count = 1;
while(1)
{
CString str2;
int pos;
pos=para.Find(',',0);
if(pos < 0)
break;
str2.Format("^%d^",count++);
line.Replace(str2,para.Left(pos));
para = para.Right(para.GetLength()-pos-1);
}
}
//skip empty lines
if(line.GetLength() < 1)
line = _T("//");
if(line.GetAt(0) == '{')//function calls
{
while(FunEnter(line));
}
else
{
if(line.GetAt(0) == '>')
{
m_iStackDepth--;
}
}
if(CheckCondition(line,type))
{
if(!ProgramFunction(type,line))
{
cmd = line;
return true;
}
}
return false;
}
示例8: ODM_ReadAndConfig_PHY_REG_PG_8188E
void
ODM_ReadAndConfig_PHY_REG_PG_8188E(
IN PDM_ODM_T pDM_Odm
)
{
u4Byte hex = 0;
u4Byte i = 0;
u2Byte count = 0;
pu4Byte ptr_array = NULL;
u1Byte platform = pDM_Odm->SupportPlatform;
u1Byte interfaceValue = pDM_Odm->SupportInterface;
u1Byte board = pDM_Odm->BoardType;
u4Byte ArrayLen = sizeof(Array_PHY_REG_PG_8188E)/sizeof(u4Byte);
pu4Byte Array = Array_PHY_REG_PG_8188E;
BOOLEAN biol = FALSE;
hex += board;
hex += interfaceValue << 8;
hex += platform << 16;
hex += 0xFF000000;
for (i = 0; i < ArrayLen; i += 3 )
{
u4Byte v1 = Array[i];
u4Byte v2 = Array[i+1];
u4Byte v3 = Array[i+2];
// this line is a line of pure_body
if ( v1 < 0xCDCDCDCD )
{
odm_ConfigBB_PHY_REG_PG_8188E(pDM_Odm, v1, v2, v3);
continue;
}
else
{ // this line is the start of branch
if ( !CheckCondition(Array[i], hex) )
{ // don't need the hw_body
i += 2; // skip the pair of expression
v1 = Array[i];
v2 = Array[i+1];
v3 = Array[i+2];
while (v2 != 0xDEAD)
{
i += 3;
v1 = Array[i];
v2 = Array[i+1];
v3 = Array[i+1];
}
}
}
}
}
示例9: ODM_ReadAndConfig_RadioA_1T_8723A
void ODM_ReadAndConfig_RadioA_1T_8723A(struct dm_odm_t *pDM_Odm)
{
#define READ_NEXT_PAIR(v1, v2, i) \
do { \
i += 2; v1 = Array[i]; v2 = Array[i+1];\
} while (0)
u32 hex = 0;
u32 i = 0;
u8 platform = 0x04;
u8 interfaceValue = pDM_Odm->SupportInterface;
u8 board = pDM_Odm->BoardType;
u32 ArrayLen = sizeof(Array_RadioA_1T_8723A)/sizeof(u32);
u32 *Array = Array_RadioA_1T_8723A;
hex += board;
hex += interfaceValue << 8;
hex += platform << 16;
hex += 0xFF000000;
for (i = 0; i < ArrayLen; i += 2) {
u32 v1 = Array[i];
u32 v2 = Array[i+1];
/* This (offset, data) pair meets the condition. */
if (v1 < 0xCDCDCDCD) {
odm_ConfigRFReg_8723A(pDM_Odm, v1, v2, RF_PATH_A, v1);
continue;
} else {
if (!CheckCondition(Array[i], hex)) {
/* Discard the following (offset, data) pairs. */
READ_NEXT_PAIR(v1, v2, i);
while (v2 != 0xDEAD &&
v2 != 0xCDEF &&
v2 != 0xCDCD && i < ArrayLen - 2)
READ_NEXT_PAIR(v1, v2, i);
i -= 2; /* prevent from for-loop += 2 */
} else {
/* Configure matched pairs and skip to end of if-else. */
READ_NEXT_PAIR(v1, v2, i);
while (v2 != 0xDEAD &&
v2 != 0xCDEF &&
v2 != 0xCDCD && i < ArrayLen - 2) {
odm_ConfigRFReg_8723A(pDM_Odm, v1, v2,
RF_PATH_A, v1);
READ_NEXT_PAIR(v1, v2, i);
}
while (v2 != 0xDEAD && i < ArrayLen - 2)
READ_NEXT_PAIR(v1, v2, i);
}
}
}
}
示例10: odm_SetArrayPointerGetLength_8192C
static u2Byte
odm_SetArrayPointerGetLength_8192C(
IN PDM_ODM_T pDM_Odm,
IN u4Byte ArrayLen,
IN pu4Byte Array,
OUT pu4Byte *gArrayPointer
)
{
u4Byte hex = 0;
u4Byte i = 0;
u2Byte count = 0;
pu4Byte ptr_array = NULL;
u1Byte platform = pDM_Odm->SupportPlatform;
u1Byte interface = pDM_Odm->SupportInterface;
u1Byte board = pDM_Odm->BoardType;
ODM_AllocateMemory(pDM_Odm, (PVOID*)&ptr_array, sizeof(u4Byte) * RETURNED_ARRAY_SIZE);
hex += board;
hex += interface << 8;
hex += platform << 16;
hex += 0xFF000000;
for (i = 0; i < ArrayLen; i += 2 )
{
u4Byte v1 = Array[i];
u4Byte v2 = Array[i+1];
// this line is a line of pure_body
if ( v1 < 0xCDCDCDCD )
{
ptr_array[count++] = v1;
ptr_array[count++] = v2;
continue;
}
else
{ // this line is the start of branch
if ( !CheckCondition(Array[i], hex) )
{ // don't need the hw_body
i += 2;
v1 = Array[i];
v2 = Array[i+1];
while (v2 != 0xDEAD)
{
i += 2;
v1 = Array[i];
v2 = Array[i+1];
}
}
}
}
*gArrayPointer = ptr_array;
return count;
}
示例11: NeighborhoodSum
std::vector<std::vector<int> > CellularAutomaton::NextGeneration(){
std::vector<std::vector<int> > nextData = data;
for(int i = 0; i < data.size(); i++){
for(int j = 0; j < data[0].size(); j++){
if(j < data[0].size()-1 && i < data.size()-1 && j > 1 && i > 1){ //if we are not at the edge
int nsum = NeighborhoodSum(i, j);
//if current cell is at the last count, set it to 0. if it's not at a stay position increment
if(data[i][j] == (rule.c[rule.c.size() - 1] - 1)) nextData[i][j] = 0;
else if(!CheckCondition(data[i][j], rule.s) && data[i][j]){
nextData[i][j] += 1;
}
else if(CheckCondition(nsum, rule.b) && !data[i][j]){
nextData[i][j] = 1;
}
}
}
}
data = nextData;
return data;
}
示例12: ODM_ReadAndConfig_AGC_TAB_5G_8192C
void
ODM_ReadAndConfig_AGC_TAB_5G_8192C(
IN PDM_ODM_T pDM_Odm
)
{
u4Byte hex = 0;
u4Byte i = 0;
u2Byte count = 0;
pu4Byte ptr_array = NULL;
u1Byte platform = pDM_Odm->SupportPlatform;
u1Byte interface = pDM_Odm->SupportInterface;
u1Byte board = pDM_Odm->BoardType;
u4Byte ArrayLen = sizeof(Array_AGC_TAB_5G_8192C)/sizeof(u4Byte);
pu4Byte Array = Array_AGC_TAB_5G_8192C;
hex += board;
hex += interface << 8;
hex += platform << 16;
hex += 0xFF000000;
for (i = 0; i < ArrayLen; i += 2 )
{
u4Byte v1 = Array[i];
u4Byte v2 = Array[i+1];
// this line is a line of pure_body
if ( v1 < 0xCDCDCDCD )
{
odm_ConfigBB_AGC_8192C(pDM_Odm, v1, bMaskDWord, v2);
continue;
}
else
{ // this line is the start of branch
if ( !CheckCondition(Array[i], hex) )
{ // don't need the hw_body
i += 2;
v1 = Array[i];
v2 = Array[i+1];
while (v2 != 0xDEAD &&
v2 != 0xCDEF &&
v2 != 0xCDCD)
{
i += 2;
v1 = Array[i];
v2 = Array[i+1];
}
}
}
}
}
示例13: ODM_ReadAndConfig_PHY_REG_MP_8723A
void
ODM_ReadAndConfig_PHY_REG_MP_8723A(
IN PDM_ODM_T pDM_Odm
)
{
u4Byte hex = 0;
u4Byte i = 0;
u2Byte count = 0;
pu4Byte ptr_array = NULL;
u1Byte platform = pDM_Odm->SupportPlatform;
u1Byte interface = pDM_Odm->SupportInterface;
u1Byte board = pDM_Odm->BoardType;
u4Byte ArrayLen = sizeof(Array_PHY_REG_MP_8723A)/sizeof(u4Byte);
pu4Byte Array = Array_PHY_REG_MP_8723A;
hex += board;
hex += interface << 8;
hex += platform << 16;
hex += 0xFF000000;
for (i = 0; i < ArrayLen; i += 2 )
{
u4Byte v1 = Array[i];
u4Byte v2 = Array[i+1];
// This (offset, data) pair meets the condition.
if ( v1 < 0xCDCDCDCD )
{
odm_ConfigBB_PHY_8723A(pDM_Odm, v1, bMaskDWord, v2);
continue;
}
else
{ // This line is the start line of branch.
if ( !CheckCondition(Array[i], hex) )
{ // Discard the following (offset, data) pairs.
i += 2;
v1 = Array[i];
v2 = Array[i+1];
while (v2 != 0xDEAD &&
v2 != 0xCDEF &&
v2 != 0xCDCD)
{
i += 2;
v1 = Array[i];
v2 = Array[i+1];
}
}
}
}
}
示例14: SortInputs
const CraftRecipe* CraftManager::GetRecipe(std::vector<CraftInputSlot> &inputItems)
{
SortInputs(inputItems);
size_t inputCount = inputItems.size();
for(size_t i = 0; i < mRecipes.size(); i++)
{
CraftRecipe *recipe = &mRecipes[i];
if(recipe->mInputCount != inputCount)
continue;
if(CheckCondition(recipe->mConditions, inputItems) == true)
return recipe;
}
return NULL;
}
示例15: CheckPut
// Callback from leveldb_writebatch_iterate()
static void CheckPut(void* ptr,
const char* k, size_t klen,
const char* v, size_t vlen) {
int* state = (int*) ptr;
CheckCondition(*state < 2);
switch (*state) {
case 0:
CheckEqual("bar", k, klen);
CheckEqual("b", v, vlen);
break;
case 1:
CheckEqual("box", k, klen);
CheckEqual("c", v, vlen);
break;
}
(*state)++;
}