From 391916f685afe93d9afb021b81f8d5b5789822bc Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sun, 6 Nov 2011 21:02:23 +0100 Subject: Merged three global script states into one These scripts could trivially share one script state, since the methods called on them from the server are not overlapping. This does leave them open to access each other's global variables, but that's the problem with global variables. The one remaining global script file name is now configurable, so that it may also be set to a script in a different scripting language. The two related script options are: script_mainFile (default: scripts/main.lua) script_defaultEngine (default: lua) - renamed from defaultScriptEngine Reviewed-by: jurkan Reviewed-by: Yohann Ferreira --- src/scripting/script.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/scripting/script.h') diff --git a/src/scripting/script.h b/src/scripting/script.h index e2ab3afa..a7737512 100644 --- a/src/scripting/script.h +++ b/src/scripting/script.h @@ -135,26 +135,30 @@ class Script virtual void processRemoveEvent(Thing *thing) = 0; + /** + * Loads the global event script file + */ + static bool loadGlobalEventScript(const std::string &file); + /** * Runs a function from the global event script file */ static bool executeGlobalEventFunction(const std::string &function, Being *obj); static void addDataToSpecial(int specialId, Special *special); static bool performSpecialAction(int specialId, Being *caster); - static bool performCraft(Being* crafter, std::list recipe); + static bool performCraft(Being *crafter, const std::list &recipe); static std::string determineEngineByFilename(const std::string &filename); protected: - static Script *globalEventScript; - static Script *specialActionsScript; - static Script *craftScript; std::string mScriptFile; private: MapComposite *mMap; EventListener mEventListener; /**< Tracking of being deaths. */ + static Script *globalEventScript; + friend struct ScriptEventDispatch; }; -- cgit v1.2.3-60-g2f50