diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-08-14 16:34:34 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-08-14 16:34:34 +0000 |
commit | 2fa455ff7870dc09d75bb89a897c7c1d26eb9020 (patch) | |
tree | 8417c6fd49f862f00234683e3a06a8d50a4f281c /src/scripting/script.hpp | |
parent | a88aa0a9af24962f8eea11e039fcf34dade66037 (diff) | |
download | manaserv-2fa455ff7870dc09d75bb89a897c7c1d26eb9020.tar.gz manaserv-2fa455ff7870dc09d75bb89a897c7c1d26eb9020.tar.bz2 manaserv-2fa455ff7870dc09d75bb89a897c7c1d26eb9020.tar.xz manaserv-2fa455ff7870dc09d75bb89a897c7c1d26eb9020.zip |
Made it possible to load scripts from strings instead of files.
Diffstat (limited to 'src/scripting/script.hpp')
-rw-r--r-- | src/scripting/script.hpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/scripting/script.hpp b/src/scripting/script.hpp index 8ab89c25..136ae9ff 100644 --- a/src/scripting/script.hpp +++ b/src/scripting/script.hpp @@ -36,7 +36,7 @@ class Script { public: - typedef Script *(*Factory)(std::string const &); + typedef Script *(*Factory)(); /** * Registers a new scripting engine. @@ -44,15 +44,21 @@ class Script static void registerEngine(std::string const &, Factory); /** - * Creates a new script. + * Creates a new script context for a given engine. */ - static Script *create(std::string const &engine, std::string const &file); + static Script *create(std::string const &engine); Script(): mMap(NULL) {} virtual ~Script() {} /** + * Loads a chunk of text into the script context and executes + * its global statements. + */ + virtual void load(char const *) = 0; + + /** * Called every tick for the script to manage its data. * Calls the "update" function of the script by default. */ |