src/ai/ai_info.hpp
author truebrain
Mon, 30 Jun 2008 12:15:10 +0000
branchnoai
changeset 11097 6967c52c78c5
parent 10889 ecb77cfc4a10
permissions -rw-r--r--
(svn r13654) [NoAI] -Change [API CHANGE]: moved AISetting::SetCommandDelay to AIController::SetCommandDelay, as it was silly to have it in a seperate class, while it was part of the controller.
/* $Id$ */

/** @file ai_info.hpp AIInfo keeps track of all information of an AI, like Author, Description, ... */

#ifndef AI_INFO
#define AI_INFO

class AIFileInfo {
public:
	friend class AIInfo;
	friend class AILibrary;

	AIFileInfo() : author(NULL), name(NULL), description(NULL), date(NULL), instance_name(NULL) {};
	~AIFileInfo();

	/**
	 * Get the Author of the AI.
	 */
	const char *GetAuthor();

	/**
	 * Get the Name of the AI.
	 */
	const char *GetName();

	/**
	 * Get the description of the AI.
	 */
	const char *GetDescription();

	/**
	 * Get the version of the AI.
	 */
	int GetVersion();

	/**
	 * Get the date of the AI.
	 */
	const char *GetDate();

	/**
	 * Get the name of the instance of the AI to create.
	 */
	const char *GetInstanceName();

	/**
	 * Check if we can start this AI.
	 */
	bool AllowStartup();

	/**
	 * Create an instance of this AI.
	 */
	class AIController *CreateInstance();

	/**
	 * Get the name of the dir this AI is in.
	 */
	const char *GetDirName();

	/**
	 * Get the complete script name of this AI.
	 */
	const char *GetScriptName();

	/**
	 * Check if a given method exists.
	 */
	void CheckMethods(SQInteger *res, const char *name);

	/**
	 * Process the creation of a FileInfo object.
	 */
	static SQInteger Constructor(HSQUIRRELVM vm, AIFileInfo *info);

private:
	Squirrel *engine;
	HSQOBJECT *SQ_instance;
	char *script_name;
	char *dir_name;
	class AISquirrel *base;
	const char *author;
	const char *name;
	const char *description;
	const char *date;
	const char *instance_name;
};

class AIInfo : public AIFileInfo {
public:
	/**
	 * Create an AI, using this AIInfo as start-template.
	 */
	static SQInteger Constructor(HSQUIRRELVM vm);
};

class AILibrary : public AIFileInfo {
public:
	/**
	 * Create an AI, using this AIInfo as start-template.
	 */
	static SQInteger Constructor(HSQUIRRELVM vm);

	static SQInteger Import(HSQUIRRELVM vm);
};

#endif /* AI_INFO */