summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/Bindings.cpp58
-rw-r--r--source/Bindings.h2
-rw-r--r--source/BlockID.cpp15
-rw-r--r--source/BlockID.h6
4 files changed, 73 insertions, 8 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index 805a9d65d..8d856cfa5 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 10/09/13 09:54:54.
+** Generated automatically by tolua++-1.0.92 on 10/11/13 10:08:32.
*/
#ifndef __cplusplus
@@ -2541,13 +2541,13 @@ static int tolua_AllToLua_cFile_Rename00(lua_State* tolua_S)
else
#endif
{
- const AString a_OrigFileName = ((const AString) tolua_tocppstring(tolua_S,2,0));
- const AString a_NewFileName = ((const AString) tolua_tocppstring(tolua_S,3,0));
+ const AString a_OrigPath = ((const AString) tolua_tocppstring(tolua_S,2,0));
+ const AString a_NewPath = ((const AString) tolua_tocppstring(tolua_S,3,0));
{
- bool tolua_ret = (bool) cFile::Rename(a_OrigFileName,a_NewFileName);
+ bool tolua_ret = (bool) cFile::Rename(a_OrigPath,a_NewPath);
tolua_pushboolean(tolua_S,(bool)tolua_ret);
- tolua_pushcppstring(tolua_S,(const char*)a_OrigFileName);
- tolua_pushcppstring(tolua_S,(const char*)a_NewFileName);
+ tolua_pushcppstring(tolua_S,(const char*)a_OrigPath);
+ tolua_pushcppstring(tolua_S,(const char*)a_NewPath);
}
}
return 3;
@@ -3015,6 +3015,51 @@ static int tolua_AllToLua_StringToDamageType00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
+/* function: GetIniItemSet */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_GetIniItemSet00
+static int tolua_AllToLua_GetIniItemSet00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ (tolua_isvaluenil(tolua_S,1,&tolua_err) || !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err)) ||
+ !tolua_isstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isstring(tolua_S,3,0,&tolua_err) ||
+ !tolua_isstring(tolua_S,4,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cIniFile* a_IniFile = ((cIniFile*) tolua_tousertype(tolua_S,1,0));
+ const char* a_Section = ((const char*) tolua_tostring(tolua_S,2,0));
+ const char* a_Key = ((const char*) tolua_tostring(tolua_S,3,0));
+ const char* a_Default = ((const char*) tolua_tostring(tolua_S,4,0));
+ {
+ cItem tolua_ret = (cItem) GetIniItemSet(*a_IniFile,a_Section,a_Key,a_Default);
+ {
+#ifdef __cplusplus
+ void* tolua_obj = Mtolua_new((cItem)(tolua_ret));
+ tolua_pushusertype(tolua_S,tolua_obj,"cItem");
+ tolua_register_gc(tolua_S,lua_gettop(tolua_S));
+#else
+ void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem));
+ tolua_pushusertype(tolua_S,tolua_obj,"cItem");
+ tolua_register_gc(tolua_S,lua_gettop(tolua_S));
+#endif
+ }
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'GetIniItemSet'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* function: TrimString */
#ifndef TOLUA_DISABLE_tolua_AllToLua_TrimString00
static int tolua_AllToLua_TrimString00(lua_State* tolua_S)
@@ -29796,6 +29841,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"StringToDimension",tolua_AllToLua_StringToDimension00);
tolua_function(tolua_S,"DamageTypeToString",tolua_AllToLua_DamageTypeToString00);
tolua_function(tolua_S,"StringToDamageType",tolua_AllToLua_StringToDamageType00);
+ tolua_function(tolua_S,"GetIniItemSet",tolua_AllToLua_GetIniItemSet00);
tolua_function(tolua_S,"TrimString",tolua_AllToLua_TrimString00);
tolua_function(tolua_S,"NoCaseCompare",tolua_AllToLua_NoCaseCompare00);
tolua_function(tolua_S,"ReplaceString",tolua_AllToLua_ReplaceString00);
diff --git a/source/Bindings.h b/source/Bindings.h
index d5e1d731d..73f3140e5 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 10/09/13 09:54:54.
+** Generated automatically by tolua++-1.0.92 on 10/11/13 10:08:33.
*/
/* Exported function */
diff --git a/source/BlockID.cpp b/source/BlockID.cpp
index d91524de5..0c1cb3265 100644
--- a/source/BlockID.cpp
+++ b/source/BlockID.cpp
@@ -518,6 +518,21 @@ eDamageType StringToDamageType(const AString & a_DamageTypeString)
+cItem GetIniItemSet(cIniFile & a_IniFile, const char * a_Section, const char * a_Key, const char * a_Default)
+{
+ AString ItemStr = a_IniFile.GetValueSet(a_Section, a_Key, a_Default);
+ cItem res;
+ if (!StringToItem(ItemStr, res))
+ {
+ res.Empty();
+ }
+ return res;
+}
+
+
+
+
+
// This is actually just some code that needs to run at program startup, so it is wrapped into a global var's constructor:
class cBlockPropertiesInitializer
{
diff --git a/source/BlockID.h b/source/BlockID.h
index c2bf8dbdf..28725406d 100644
--- a/source/BlockID.h
+++ b/source/BlockID.h
@@ -746,8 +746,9 @@ enum eExplosionSource
-// fwd: cItem.h:
+// fwd:
class cItem;
+class cIniFile;
@@ -785,6 +786,9 @@ extern AString DamageTypeToString(eDamageType a_DamageType);
/// Translates a damage type string to damage type. Takes either a number or a damage type alias (built-in). Returns -1 on failure
extern eDamageType StringToDamageType(const AString & a_DamageString);
+/// Returns a cItem representing the item described in an IniFile's value; if the value doesn't exist, creates it with the provided default.
+extern cItem GetIniItemSet(cIniFile & a_IniFile, const char * a_Section, const char * a_Key, const char * a_Default);
+
// tolua_end