예제 #1
0
void cAnimationManager::StartShake(ESHAKETYPE shakeType, cWindow * window)
{
	RollBack();

	m_shakeType = shakeType;
	m_OrgX		= (long)window->GetAbsX();
	m_OrgY		= (long)window->GetAbsY();
	m_CurIdx	= 0;
	m_pWindow	= window;
	m_bShaking	= TRUE;
	m_dwLastShakingPosChangedTime = gCurTime;
}
예제 #2
0
파일: RdbTab.cpp 프로젝트: nightstyles/focp
uint32 CRdbTable::Update(CDataTable::CIterator& oIt, CRecord* pRecord, CSqlParameter* pSetAttr,
						 CRecordSet* pRollBack, uint32* pModifiedCount,
						 bool bNeedDetach, CSqlFilter& oFilter)
{
	if(pRollBack && pModifiedCount[0] >= pRollBack->GetRecordCount())
		return 1;//Roll back lack;
	CKernelIndexItem& oKernelItem = *oIt.GetValue();
	CRdbRecord oDbRecord(m_pTableSpace, m_pTabDef, &oKernelItem);
	CRecord& oSetRecord = pSetAttr->m_oRecord;
	uint32 nSetCount = pSetAttr->m_nParaCount;
	CRecord* pRollRecord = NULL;
	if(pRollBack)
	{
		pRollRecord = pRollBack->GetRecord(pModifiedCount[0]);
		pRollRecord->SetRowId(oKernelItem.nRowId);
	}
	if(bNeedDetach)
	{
		for(uint32 i=0; i<m_nIndexCount; ++i)
		{
			CAbstractIndex* pIndex = m_pIndexTable[i];
			if(!pIndex)
				continue;
			CIndexDefine* pIndexDefine = pIndex->m_pIdxDef;
			uint32 nQualifier = pIndexDefine->m_pBaseAttr->nQualifier;
			uint32 j, nFieldCount = pIndexDefine->m_nFieldCount;
			CSqlParameterSet* pCond = NULL;
			CSqlParameter* pCondPara = NULL;
			CRecord* pCondRecord = NULL;
			if(nQualifier == RDB_UNIQUE_INDEX)
			{
				pCond = new CSqlParameterSet(m_pTabDef);
				pCondPara = (CSqlParameter*)pCond->AddPara();
				pCondRecord = &pCondPara->m_oRecord;
			}
			pIndex->DetachRecord(pRecord);
			for(j=0; j<nFieldCount; ++j)
			{
				uint32 nFieldNo = pIndexDefine->m_pFields[j];
				CField* pOrigValue = pRecord->GetField(nFieldNo);

				if(pRollRecord)
					pRollRecord->GetField(nFieldNo)->SetFromField(pOrigValue);

				if(IS_SET_FIELD(pSetAttr, nFieldNo))
				{
					CField* pSetValue = oSetRecord.GetField(nFieldNo);
					if(pCond)
					{
						pCondPara->SetField(nFieldNo, RDB_SQLPARA_OPERATOR_EQUAL);
						pCondRecord->GetField(nFieldNo)->SetFromField(pSetValue);
					}
					pOrigValue->SetFromField(pSetValue);
				}
				else if(pCond)
				{
					pCondPara->SetField(nFieldNo, RDB_SQLPARA_OPERATOR_EQUAL);
					pCondRecord->GetField(nFieldNo)->SetFromField(pOrigValue);
				}
			}
			if(pCond)
			{
				uint32 bExist = 0;
				pIndex->Exist(pCond, bExist);
				if(bExist)
				{
					pIndex->AttachRecord(pRollRecord);
					RollBack(oDbRecord, pRollBack, pModifiedCount[0], i, oFilter, pSetAttr);
					return 1;
				}
			}
			pIndex->AttachRecord(pRecord);
		}
	}
	for(uint32 i=0; i<nSetCount; ++i)
	{
		uint32 nOperator, nFieldNo;
		pSetAttr->GetPara(i, &nOperator, &nFieldNo);
		CRdbField* pRdbField = oDbRecord.GetField(nFieldNo);
		if(pRollRecord && !IS_SET_FIELD0(oFilter, nFieldNo))
			pRdbField->GetField(pRollRecord->GetField(nFieldNo));
		pRdbField->SetField(oSetRecord.GetField(nFieldNo));
	}
	return 0;
}