/*
*	main.cp
*	----------------------------------------
*	A part of "Intelligent AI"
*	© 2001 SCC Team 064
*	----------------------------------------
*
*	This file:
*		€ Contains the int main(); function, with which it starts/ends the
*		   main program function loop.
*/


#include "MacInput.h"
#include "Project.h"


int main (void)
{
	unsigned long cycleCounter = 0;
	int runTimes;			// Keeps track of how many times the simulation is run.

	initGeneral();			// Initializes General Variables to default values (function
							// 	contained in initialize.cp).
	do
	{
		pDone = false;
		gQuit = false;
		
		if (SetUpWindow () && InitGL() )
		{
			initStartLocations();
			initialInterface();		// Begins introductory interface functions 
									// 	(this function is contained in shell.cp).
			initSimState();		// Initializes the Simulation State & associated 
									// variables (function contained in initialize.cp).

			while (!pDone && !gQuit)
			{
				runSimulation();	// Activates main Simulation Loop (function contained 
									// in simulation.cp).
				EventDSLoop();
				CameraManip();
				UpdateWorld (gpWindow);

				cycleCounter++;
			}
		}
		runTimes++;				// Increments the number of times the simulation has been
									// performed, this program run.
		exitInterface(cycleCounter);	// Begins end-of-simulation interface procedures 
											// (function contained in shell.cp).
//	finalReport(runTimes);	// Outputs a Final Report for the program run, including
								// the number of times the simulation has been executed,
								// and other general data.
		CleanUp ();
	} while (runTimes < 1000000);
	return 0;
}
