summaryrefslogtreecommitdiff
path: root/src/scripting
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-11-01 04:07:56 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-11-01 04:07:56 +0100
commit22142fd2cc8dd262ca1202ffeb5f4ef714870c4c (patch)
treeca0a1eaeb781baec2c4e5b22cf9df60fa89f2982 /src/scripting
parent5bd0ddb6e2d1b002372541f911a2764ed2e54e6c (diff)
parenta5895b1655be3e81f451844a911eab8b798fa7ab (diff)
downloadmanaserv-22142fd2cc8dd262ca1202ffeb5f4ef714870c4c.tar.gz
manaserv-22142fd2cc8dd262ca1202ffeb5f4ef714870c4c.tar.bz2
manaserv-22142fd2cc8dd262ca1202ffeb5f4ef714870c4c.tar.xz
manaserv-22142fd2cc8dd262ca1202ffeb5f4ef714870c4c.zip
Merge github.com:mana/manaserv
Conflicts: src/game-server/character.cpp src/scripting/lua.cpp
Diffstat (limited to 'src/scripting')
-rw-r--r--src/scripting/lua.cpp2
-rw-r--r--src/scripting/script.cpp18
-rw-r--r--src/scripting/script.h1
3 files changed, 20 insertions, 1 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index 03d08771..1bb75137 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -477,7 +477,7 @@ static int chr_inv_count(lua_State *s)
}
/**
- * mana.chr_get_level(): int level
+ * mana.chr_get_level(Character*): int level
* Tells the character current level.
*/
static int chr_get_level(lua_State *s)
diff --git a/src/scripting/script.cpp b/src/scripting/script.cpp
index 490abf09..b6121bb8 100644
--- a/src/scripting/script.cpp
+++ b/src/scripting/script.cpp
@@ -20,6 +20,7 @@
#include "scripting/script.h"
+#include "common/configuration.h"
#include "common/resourcemanager.h"
#include "game-server/being.h"
#include "utils/logger.h"
@@ -172,3 +173,20 @@ bool Script::performCraft(Being* crafter, std::list<InventoryItem> recipe)
}
return true;
}
+
+std::string Script::determineEngineByFilename(const std::string &filename)
+{
+ std::string ext = filename.substr(filename.find_last_of(".") + 1);
+
+ if (ext == "lua")
+ {
+ return "lua";
+ }
+ else
+ {
+ // Set to default engine and print warning
+ LOG_WARN("Unknown file extension for script \""
+ + filename + "\", falling back to default script engine");
+ return Configuration::getValue("defaultScriptEngine", "lua");
+ }
+}
diff --git a/src/scripting/script.h b/src/scripting/script.h
index 44a8b7ac..e2ab3afa 100644
--- a/src/scripting/script.h
+++ b/src/scripting/script.h
@@ -143,6 +143,7 @@ class Script
static bool performSpecialAction(int specialId, Being *caster);
static bool performCraft(Being* crafter, std::list<InventoryItem> recipe);
+ static std::string determineEngineByFilename(const std::string &filename);
protected:
static Script *globalEventScript;