예제 #1
0
void levelQueueReader()	{

	Keyword current;
	KeywordQueue kQueue = getKWQueue(NULL);
	current = kQueue->start;
	while(current != NULL)	{
		switch(current->lCommand)	{
			case wave:
					//! only expands waves into create enemies commands if it is at the start of the queue
					if(kQueue->start == current && getWave(getGame(NULL)) == returnPropertyValue(current,waveID))	{
						increaseEnemyNumbersThisWave(returnPropertyValue(current,numberOfEnemies));
						waveCreatorCommand(current);
						current = removeLink(current);
					} else { 
						current = current->prev;
					}
					break;
			case makeEnemy:
					if(createEnemyCommand(current))	{
						current = removeLink(current);
						return;
					} else {
						return;
					}
					break;
			case delay:
					setCreateEnemyGroupDelay(returnPropertyValue(current,dTime));
					current = removeLink(current);
					return;
					break;
			default:
					break;
		}
	}
}
void testStartNextWave()	{

    setCurrWaveNum(getGame(NULL)->currWaveNo+1);
    increaseEnemyNumbersThisWave(10);
    getGame(NULL)->deathCount = 0;
    sput_fail_unless(startNextWave() == 0, "Invalid: 10 enemies have not registered as dead yet");
    getGame(NULL)->deathCount = 10;
    sput_fail_unless(startNextWave() == 1, "Valid: 10 enemies have registered as dead");
}