コード例 #1
0
ファイル: Blob.cpp プロジェクト: Antidote/dolphin
const SectorReader::Cache* SectorReader::FindCacheLine(u64 block_num)
{
  auto itr = std::find_if(m_cache.begin(), m_cache.end(),
                          [&](const Cache& entry) { return entry.Contains(block_num); });
  if (itr == m_cache.end())
    return nullptr;

  itr->MarkUsed();
  return &*itr;
}
コード例 #2
0
		bool GetSpace (int iCellsNeeded, int *retx, int *rety)
			{
			int x = 0;
			int y = 0;
			while (!SpaceAvailable(x, y, iCellsNeeded))
				{
				x++;
				if (x >= m_iCols)
					{
					x = 0;
					y++;
					if (y >= m_iRows)
						{
						int i;

						//	If no room, then increase to a larger
						//	number of rows

						int iNewRows = m_iRows + iCellsNeeded;
						bool *pNewCellMap = new bool [m_iCols * iNewRows];
						int iOldCount = m_iCols * m_iRows;
						int iNewCount = m_iCols * iNewRows;
						for (i = 0; i < iOldCount; i++)
							pNewCellMap[i] = m_pCellMap[i];
						for (i = iOldCount; i < iNewCount; i++)
							pNewCellMap[i] = false;

						//	Swap

						delete [] m_pCellMap;
						m_pCellMap = pNewCellMap;
						m_iRows = iNewRows;

						//	Restart a little ways up

						y = Max(0, y - iCellsNeeded);
						}
					}
				}

			for (int y1 = 0; y1 < iCellsNeeded; y1++)
				for (int x1 = 0; x1 < iCellsNeeded; x1++)
					MarkUsed(x + x1, y + y1);

			*retx = x;
			*rety = y;

			return true;
			}
コード例 #3
0
ファイル: a_pickups.cpp プロジェクト: Doom2fan/gzdoom
void AInventory::MarkPrecacheSounds() const
{
	Super::MarkPrecacheSounds();
	PickupSound.MarkUsed();
}