src/ai/squirrel/squirrel.hpp
author truelight
Wed, 14 Mar 2007 09:30:22 +0000
branchnoai
changeset 9375 8bbd77b18de4
parent 9373 d03563181088
child 9377 3f1327677bcd
permissions -rw-r--r--
(svn r9163) [NoAI] -Codechange: put AddMethod in his own function, so calling often is easier
/* $Id$ */

/** @file squirrel.hpp declarations of the class for squirrel loader */

#ifndef SQUIRREL_HPP
#define SQUIRREL_HPP

#include "../core/ai_controller.hpp"
#include "../core/ai_base.hpp"
#include <squirrel.h>

class Squirrel: public AIController {
private:
	HSQUIRRELVM vm;  ///< The Virtual Machine for squirrel

	/**
	 * Add a single method to a class (in creation) in Squirrel.
	 */
	void SQAddMethod(const char *name, SQFUNCTION proc, uint nparam, const char *params);

	/**
	 * Registers all our classes, so it can be used from Squirrel.
	 */
	void RegisterClasses();

	/**
	 * Constructor for Squirrel AIController. We assign the real 'this' value to
	 *  the instance pointer, so we can easy look up this->
	 */
	static SQInteger SQConstructor(HSQUIRRELVM vm);

	/**
	 * A wrapper around the AIController class, as that can't be automated.
	 */
	static SQInteger SQGetTick(HSQUIRRELVM vm);

public:
	Squirrel(const char *script_dir);
	~Squirrel();

	/* virtual */ void GameLoop();
};

#endif /* SQUIRREL_HPP */