src/ai/core/ai_controller.hpp
author truelight
Thu, 15 Mar 2007 13:36:45 +0000
branchnoai
changeset 9404 ef9e171617a3
parent 9388 032008c3f6e3
child 9422 33efcc5f1b09
permissions -rw-r--r--
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
-Add: added AIFactory code for squirrel. Now scripts can make theirself
known to the core in a simular way as in C++. Just make sure to add
your AIFactory instance to the GLOBAL space!
-Add: even more function in SquirrelEngine
/* $Id$ */

/** @file ai_controler.hpp declaration of class for AIController class */

#ifndef AI_CONTROLLER_HPP
#define AI_CONTROLLER_HPP

#include "../../stdafx.h"

class AIController {
private:
	uint tick;

public:
	AIController() :
		tick(0)
	{}

	virtual ~AIController() { }

	/**
	 * This function is called every tick.
	 */
	virtual void GameLoop() = 0;

	/**
	 * Increase the internal ticker.
	 */
	void IncreaseTick() { this->tick++; }

	/**
	 * Return the value of the ticker.
	 */
	uint GetTick() { return this->tick; }
};

#endif /* AI_CONTROLLER_HPP */

#ifdef SQUIRREL_CLASS
void SQAIControllerRegister(SquirrelEngine *engine) {
	DefSQClass <AIControllerSquirrel> SQAIController("AIController");
	SQAIController.PreRegister(engine);
	SQAIController.DefSQFunction(engine, &AIControllerSquirrel::GetTick, "GetTick");
	SQAIController.PostRegister(engine);
}
#endif /* SQUIRREL_CLASS */