summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-08-22 12:44:56 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-08-22 13:11:38 +0200
commitbfca89de4edded82668376d2388784defbee071b (patch)
treee345a9ec1e5d3e6419191cb3233efdfb70ab0718
parent59b889008760325845aeb04b7ac3fad5e1068c0f (diff)
downloadmanaserv-bfca89de4edded82668376d2388784defbee071b.tar.gz
manaserv-bfca89de4edded82668376d2388784defbee071b.tar.bz2
manaserv-bfca89de4edded82668376d2388784defbee071b.tar.xz
manaserv-bfca89de4edded82668376d2388784defbee071b.zip
Rename some stuff to conform to naming conventions
-rw-r--r--src/game-server/character.cpp6
-rw-r--r--src/game-server/main-game.cpp7
-rw-r--r--src/scripting/luascript.cpp16
-rw-r--r--src/scripting/luascript.hpp9
-rw-r--r--src/scripting/script.cpp14
-rw-r--r--src/scripting/script.hpp12
6 files changed, 31 insertions, 33 deletions
diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp
index 9230458e..1c96818f 100644
--- a/src/game-server/character.cpp
+++ b/src/game-server/character.cpp
@@ -180,7 +180,7 @@ void Character::perform()
void Character::died()
{
Being::died();
- Script::execute_global_event_function("on_chr_death", this);
+ Script::executeGlobalEventFunction("on_chr_death", this);
}
void Character::respawn()
@@ -197,7 +197,7 @@ void Character::respawn()
mTarget = NULL;
// execute respawn script
- if (!Script::execute_global_event_function("on_chr_death_accept", this))
+ if (!Script::executeGlobalEventFunction("on_chr_death_accept", this))
{
// script-controlled respawning didn't work - fall back to
// hardcoded logic
@@ -232,7 +232,7 @@ void Character::useSpecial(int id)
//tell script engine to cast the spell
special->currentMana = 0;
- Script::perform_special_action(id, this);
+ Script::performSpecialAction(id, this);
mSpecialUpdateNeeded = true;
return;
}
diff --git a/src/game-server/main-game.cpp b/src/game-server/main-game.cpp
index 2ae84a06..d7ddefa2 100644
--- a/src/game-server/main-game.cpp
+++ b/src/game-server/main-game.cpp
@@ -157,10 +157,9 @@ static void initializeServer()
MonsterManager::initialize(DEFAULT_MONSTERSDB_FILE);
StatusManager::initialize(DEFAULT_STATUSDB_FILE);
PermissionManager::initialize(DEFAULT_PERMISSION_FILE);
- // Initialize global event script
- LuaScript::load_global_event_script(DEFAULT_GLOBAL_EVENT_SCRIPT_FILE);
- // Initialize special action script
- LuaScript::load_special_actions_script(DEFAULT_SPECIAL_ACTIONS_SCRIPT_FILE);
+
+ LuaScript::loadGlobalEventScript(DEFAULT_GLOBAL_EVENT_SCRIPT_FILE);
+ LuaScript::loadSpecialActionsScript(DEFAULT_SPECIAL_ACTIONS_SCRIPT_FILE);
// --- Initialize the global handlers
// FIXME: Make the global handlers global vars or part of a bigger
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: