diff options
author | Aaron Marks <nymacro@gmail.com> | 2005-05-10 11:57:53 +0000 |
---|---|---|
committer | Aaron Marks <nymacro@gmail.com> | 2005-05-10 11:57:53 +0000 |
commit | 846784f652e9b30b67c04bfa800be1448c8a15e7 (patch) | |
tree | 1d03f92e34a5fb179bb93471b55d5b49f141484b /src/script.h | |
parent | ef30b72e8ad5379a7c7ee49b0ff680bde15daa66 (diff) | |
download | manaserv-846784f652e9b30b67c04bfa800be1448c8a15e7.tar.gz manaserv-846784f652e9b30b67c04bfa800be1448c8a15e7.tar.bz2 manaserv-846784f652e9b30b67c04bfa800be1448c8a15e7.tar.xz manaserv-846784f652e9b30b67c04bfa800be1448c8a15e7.zip |
Updated scripting interface & added some class documentation.
- Updated Squirrel scripting interface.
- Added registerFunction which will register a function for the specified
scripting VM.
Diffstat (limited to 'src/script.h')
-rw-r--r-- | src/script.h | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/script.h b/src/script.h index ea696b38..4a003611 100644 --- a/src/script.h +++ b/src/script.h @@ -27,31 +27,41 @@ #include <iostream> /* + * Script * Script provides a simple class which is a simple interface - * for defining a scripting backend. + * for defining a scripting backend. Each Script object consists + * of an independant scripting environment. + * + * Requirements of Script Object: + * - Each script object is independant from any other script object. + * - A script is to be executed upon instantiation. + * - A initialization and destruction function should be executed in + * the script if such a function is defined (the interface should + * provide default methods in case they are missing or not needed.) */ class Script { protected: + // Filename of the script corresponding to the script object std::string scriptName; public: - Script(const std::string &file) : - scriptName(file) - { - } + Script(const std::string &file) + : scriptName(file) + { } virtual ~Script() { } - //Initialization - virtual void init() = 0; - //Destruction - virtual void destroy() = 0; + //State update virtual void update() = 0; + + //Execute specified function + virtual bool execute(const std::string &) = 0; + //Script sent raw message virtual void message(char *) = 0; }; -extern Script *script; +extern Script *script; // Global script (temporary? #endif |