From 2fa455ff7870dc09d75bb89a897c7c1d26eb9020 Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Tue, 14 Aug 2007 16:34:34 +0000 Subject: Made it possible to load scripts from strings instead of files. --- src/scripting/script.hpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/scripting/script.hpp') diff --git a/src/scripting/script.hpp b/src/scripting/script.hpp index 8ab89c2..136ae9f 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,14 +44,20 @@ 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. -- cgit