void Model::Update(float deltaTime) { if(IsUpToDate()) { return; } UpdateTransform(); IObject::Update(deltaTime); }
bool FRegistryKey::IsUpToDate(HKEY hRootKey, const FString &Path, bool bRemoveDifferences) const { bool bRes = false; HKEY hKey; if (RegOpenKeyEx(hRootKey, *Path, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { bRes = IsUpToDate(hKey, bRemoveDifferences); RegCloseKey(hKey); } return bRes; }
/// Fill the map with data for this AI player's turn void CvTacticalAnalysisMap::Refresh() { if(!IsUpToDate()) { //can happen in the first turn ... if (m_pCells.size()!=GC.getMap().numPlots()) Init(m_ePlayer); m_iTurnBuilt = GC.getGame().getGameTurn(); m_iTacticalRange = ((GC.getAI_TACTICAL_RECRUIT_RANGE() + GC.getGame().getCurrentEra()) * 3) / 5; // Have this increase as game goes on m_iUnitStrengthMultiplier = GC.getAI_TACTICAL_MAP_UNIT_STRENGTH_MULTIPLIER() * m_iTacticalRange; AI_PERF_FORMAT("AI-perf.csv", ("Tactical Analysis Map, Turn %d, %s", GC.getGame().getGameTurn(), m_pPlayer->getCivilizationShortDescription()) ); m_DominanceZones.clear(); AddTemporaryZones(); for(int iI = 0; iI < GC.getMap().numPlots(); iI++) { CvAssertMsg((iI < m_iNumPlots), "Plot to be accessed exceeds allocation!"); CvPlot* pPlot = GC.getMap().plotByIndexUnchecked(iI); if(pPlot == NULL) { // Erase this cell m_pCells[iI].Clear(); } else { if(PopulateCell(iI, pPlot)) { AddToDominanceZones(iI, &m_pCells[iI]); } } } //barbarians don't care about tactical dominance if(m_ePlayer!=BARBARIAN_PLAYER) { EstablishZoneNeighborhood(); CalculateMilitaryStrengths(); PrioritizeZones(); LogZones(); } BuildEnemyUnitList(); MarkCellsNearEnemy(); } }
void CAeonView::Insert (const CTableDimensions &PrimaryDims, CHexeProcess &Process, const CRowKey &PrimaryKey, CDatum dData, CDatum dOldData, SEQUENCENUMBER RowID, bool *retbRecoveryFailed, CString *retsError) // Insert // // Insert a row // // NOTE: We cannot fail here because callers should have called CanInsert // (above). { int i; CString sError; *retbRecoveryFailed = false; // If this is a primary view then all we have to do is insert the row if (!IsSecondaryView()) { m_pRows->Insert(PrimaryKey, dData, RowID); if (!m_Recovery.Insert(PrimaryKey, dData, RowID, retsError)) *retbRecoveryFailed = true; } // Otherwise, it's more complicated. else { // If this view is not yet up to date then we skip insertion (we will // insert all rows later). if (!IsUpToDate()) return; // If we are updating an existing row, then we need to remove the old // value. Note that it is OK if OldKey and NewKey end up being the // same; we just end up overwriting it. if (!dOldData.IsNil()) { // Generate a key for the old value. If all key values are non-nil // then we update the old value. TArray<CRowKey> OldKeys; if (CreateSecondaryKeys(Process, ComputeColumns(Process, dOldData), RowID, &OldKeys)) { // Now delete the old value (by writing out Nil) for (i = 0; i < OldKeys.GetCount(); i++) { m_pRows->Insert(OldKeys[i], CDatum(), RowID); if (!m_Recovery.Insert(OldKeys[i], CDatum(), RowID, retsError)) *retbRecoveryFailed = true; } } } // Save the new value (only if not Nil) if (!dData.IsNil()) { // Compute columns dData = ComputeColumns(Process, dData); // Generate a key for the new value. If all key values are non-nil // then we insert the row into the secondary view. TArray<CRowKey> NewKeys; if (CreateSecondaryKeys(Process, dData, RowID, &NewKeys)) { // Generate data for secondary key CDatum dViewData; CreateSecondaryData(PrimaryDims, PrimaryKey, dData, RowID, &dViewData); // Insert it for (i = 0; i < NewKeys.GetCount(); i++) { m_pRows->Insert(NewKeys[i], dViewData, RowID); if (!m_Recovery.Insert(NewKeys[i], dViewData, RowID, retsError)) *retbRecoveryFailed = true; } } } } }