--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ai/ai_squirrel.hpp Thu Mar 15 22:48:43 2007 +0000
@@ -0,0 +1,56 @@
+/* $Id$ */
+
+/** @file squirrel.hpp declarations of the class for squirrel loader */
+
+#ifndef AI_SQUIRREL_HPP
+#define AI_SQUIRREL_HPP
+
+class AIControllerSquirrel: public AIController {
+private:
+ Squirrel *engine; ///< The Squirrel engine
+ HSQOBJECT SQ_instance; ///< The internal instance of squirrel
+
+ /**
+ * Registers all our classes, so it can be used from Squirrel.
+ */
+ void RegisterClasses();
+
+public:
+ AIControllerSquirrel(const char *script_dir, const char *class_name);
+ ~AIControllerSquirrel();
+
+ /* virtual */ void GameLoop();
+
+ uint GetTick() { return AIController::GetTick(); }
+};
+
+class FSquirrel: public AIFactory<FSquirrel> {
+private:
+ Squirrel *engine; ///< The Squirrel engine
+ const char *current_script; ///< Temporary variable to know which script defines which class
+
+ /**
+ * The constructor for when a script makes an instance of the Factory class.
+ */
+ static SQInteger FactoryConstructor(HSQUIRRELVM vm);
+
+ /**
+ * Scans a dir to see if there are dirs in it which have a file called 'main.nut'.
+ * If found it loads the script.
+ */
+ void ScanDir(const char *dirname);
+
+public:
+ ~FSquirrel();
+
+ /* virtual */ const char *GetAuthor() { return "OpenTTD Dev Team"; }
+ /* virtual */ const char *GetName() { return "Squirrel"; }
+ /* virtual */ const char *GetDescription() { return "Squirrel Module for loading scripts"; }
+ /* virtual */ int GetVersion() { return 0; }
+ /* virtual */ const char *GetDate() { return ""; }
+ /* virtual */ AIController *CreateInstance() { return NULL; }
+ /* virtual */ bool AllowStartup() { return false; }
+ /* virtual */ void Initializer();
+};
+
+#endif /* AI_SQUIRREL_HPP */