diff options
Diffstat (limited to 'src/scripting')
-rw-r--r-- | src/scripting/luascript.cpp | 16 | ||||
-rw-r--r-- | src/scripting/luascript.hpp | 9 | ||||
-rw-r--r-- | src/scripting/script.cpp | 14 | ||||
-rw-r--r-- | src/scripting/script.hpp | 12 |
4 files changed, 25 insertions, 26 deletions
diff --git a/src/scripting/luascript.cpp b/src/scripting/luascript.cpp index 922c15d0..ee727060 100644 --- a/src/scripting/luascript.cpp +++ b/src/scripting/luascript.cpp @@ -161,23 +161,23 @@ void LuaScript::getPostCallback(Character *q, const std::string &sender, s->execute(); } -bool LuaScript::load_global_event_script(const std::string &file) +bool LuaScript::loadGlobalEventScript(const std::string &file) { - Script::global_event_script = new LuaScript(); - if (!Script::global_event_script->loadFile(file)) + Script::globalEventScript = new LuaScript(); + if (!Script::globalEventScript->loadFile(file)) { - Script::global_event_script = NULL; + Script::globalEventScript = NULL; return false; } return true; } -bool LuaScript::load_special_actions_script(const std::string &file) +bool LuaScript::loadSpecialActionsScript(const std::string &file) { - Script::special_actions_script = new LuaScript(); - if (!Script::special_actions_script->loadFile(file)) + Script::specialActionsScript = new LuaScript(); + if (!Script::specialActionsScript->loadFile(file)) { - Script::special_actions_script = NULL; + Script::specialActionsScript = NULL; return false; } return true; diff --git a/src/scripting/luascript.hpp b/src/scripting/luascript.hpp index 94851ac7..5e4deea1 100644 --- a/src/scripting/luascript.hpp +++ b/src/scripting/luascript.hpp @@ -63,18 +63,17 @@ class LuaScript: public Script static void getPostCallback(Character *, const std::string &, const std::string &, void *); - void processDeathEvent(Being* thing); + void processDeathEvent(Being *thing); - void processRemoveEvent(Thing* thing); + void processRemoveEvent(Thing *thing); /** * Loads the global event script file */ - static bool load_global_event_script(const std::string &file); - static bool load_special_actions_script(const std::string &file); + static bool loadGlobalEventScript(const std::string &file); + static bool loadSpecialActionsScript(const std::string &file); private: - lua_State *mState; int nbArgs; std::string mCurFunction; diff --git a/src/scripting/script.cpp b/src/scripting/script.cpp index 8aa450b8..3d16a7d1 100644 --- a/src/scripting/script.cpp +++ b/src/scripting/script.cpp @@ -32,8 +32,8 @@ typedef std::map< std::string, Script::Factory > Engines; static Engines *engines = NULL; -Script *Script::global_event_script = NULL; -Script *Script::special_actions_script = NULL; +Script *Script::globalEventScript = NULL; +Script *Script::specialActionsScript = NULL; Script::Script(): mMap(NULL), @@ -108,10 +108,10 @@ void Script::loadNPC(const std::string &name, int id, int x, int y, execute(); } -bool Script::execute_global_event_function(const std::string &function, Being* obj) +bool Script::executeGlobalEventFunction(const std::string &function, Being* obj) { bool isScriptHandled = false; - Script *script = Script::global_event_script; + Script *script = Script::globalEventScript; if (script) { script->setMap(obj->getMap()); @@ -134,7 +134,7 @@ void Script::addDataToSpecial(int id, Special* special) */ if (special) { - Script *script = Script::special_actions_script; + Script *script = Script::specialActionsScript; if (script) { script->prepare("get_special_recharge_cost"); @@ -146,9 +146,9 @@ void Script::addDataToSpecial(int id, Special* special) } -bool Script::perform_special_action(int specialId, Being* caster) +bool Script::performSpecialAction(int specialId, Being* caster) { - Script *script = Script::special_actions_script; + Script *script = Script::specialActionsScript; if (script) { script->prepare("use_special"); diff --git a/src/scripting/script.hpp b/src/scripting/script.hpp index 0e874151..dfba06f0 100644 --- a/src/scripting/script.hpp +++ b/src/scripting/script.hpp @@ -128,21 +128,21 @@ class Script EventListener *getScriptListener() { return &mEventListener; } - virtual void processDeathEvent(Being* thing) = 0; + virtual void processDeathEvent(Being *thing) = 0; - virtual void processRemoveEvent(Thing* thing) = 0; + virtual void processRemoveEvent(Thing *thing) = 0; /** * Runs a function from the global event script file */ - static bool execute_global_event_function(const std::string &function, Being *obj); + static bool executeGlobalEventFunction(const std::string &function, Being *obj); static void addDataToSpecial(int specialId, Special *special); - static bool perform_special_action(int specialId, Being *caster); + static bool performSpecialAction(int specialId, Being *caster); protected: - static Script* global_event_script; // the global event script - static Script* special_actions_script; // the special actions script + static Script *globalEventScript; + static Script *specialActionsScript; std::string mScriptFile; private: |