Beispiel #1
0
// Function to be mapped over curRHT to generate next level in nextRHT.
void generateNextLevel(void* key, void* value) {
    uint64* state = (uint64*)key;
    uint8* level = (uint8*)value;
    if(*level == CUR_LEVEL) {
        uint64 nbrs[PERM_LEN-1];
        genAll(*state, nbrs);
        uint8 nextLevel = CUR_LEVEL + 1;
        int i;
        for(i=0; i<PERM_LEN-1; i++) {
            RoomyHashTable_insert(nextRHT, &(nbrs[i]), &nextLevel);
        }
    }
}
void Chunk::update()
{
	if (shouldUpdate)
	{
		switch (m_genMethod)
		{
		case RANDOM:
			genRand(randBand(randEngine));
			break;
		case SPHERE:
			genSphere();
			break;
		case ALL:
			genAll();
			break;
		default:
			Debug_Log(" ERROR? : genMethod = NONE");
			break;
		}
	}
	shouldUpdate = false;
}