summaryrefslogtreecommitdiffstats
path: root/src/Bindings
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Bindings/AllToLua_lua.bat (renamed from src/Bindings/AllToLua_lua.bat.bat)0
-rw-r--r--src/Bindings/CMakeLists.txt135
-rw-r--r--src/Bindings/DeprecatedBindings.cpp61
-rw-r--r--src/Bindings/DeprecatedBindings.h2
-rw-r--r--src/Bindings/LuaFunctions.h2
-rw-r--r--src/Bindings/LuaState.cpp3
-rw-r--r--src/Bindings/ManualBindings.cpp108
-rw-r--r--src/Bindings/ManualBindings.h2
-rw-r--r--src/Bindings/Plugin.h8
-rw-r--r--src/Bindings/PluginLua.cpp2
-rw-r--r--src/Bindings/PluginLua.h2
-rw-r--r--src/Bindings/PluginManager.cpp8
-rw-r--r--src/Bindings/PluginManager.h2
-rw-r--r--src/Bindings/WebPlugin.cpp14
-rw-r--r--src/Bindings/WebPlugin.h6
15 files changed, 231 insertions, 124 deletions
diff --git a/src/Bindings/AllToLua_lua.bat.bat b/src/Bindings/AllToLua_lua.bat
index 81c738f32..81c738f32 100644
--- a/src/Bindings/AllToLua_lua.bat.bat
+++ b/src/Bindings/AllToLua_lua.bat
diff --git a/src/Bindings/CMakeLists.txt b/src/Bindings/CMakeLists.txt
new file mode 100644
index 000000000..2ea2fa8c0
--- /dev/null
+++ b/src/Bindings/CMakeLists.txt
@@ -0,0 +1,135 @@
+cmake_minimum_required (VERSION 2.6)
+project (MCServer)
+
+include_directories ("${PROJECT_SOURCE_DIR}/../")
+include_directories (".")
+
+SET (SRCS
+ Bindings.cpp
+ DeprecatedBindings.cpp
+ LuaChunkStay.cpp
+ LuaState.cpp
+ LuaWindow.cpp
+ ManualBindings.cpp
+ Plugin.cpp
+ PluginLua.cpp
+ PluginManager.cpp
+ WebPlugin.cpp
+)
+
+SET (HDRS
+ Bindings.h
+ DeprecatedBindings.h
+ LuaChunkStay.h
+ LuaFunctions.h
+ LuaState.h
+ LuaWindow.h
+ ManualBindings.h
+ Plugin.h
+ PluginLua.h
+ PluginManager.h
+ WebPlugin.h
+ tolua++.h
+)
+
+# List all the files that are generated as part of the Bindings build process
+set (BINDING_OUTPUTS
+ ${CMAKE_CURRENT_SOURCE_DIR}/Bindings.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/Bindings.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/LuaState_Call.inc
+)
+
+set(BINDING_DEPENDENCIES
+ tolua
+ ../Bindings/virtual_method_hooks.lua
+ ../Bindings/AllToLua.pkg
+ ../Bindings/gen_LuaState_Call.lua
+ ../Bindings/LuaFunctions.h
+ ../Bindings/LuaState_Call.inc
+ ../Bindings/LuaWindow.h
+ ../Bindings/Plugin.h
+ ../Bindings/PluginLua.h
+ ../Bindings/PluginManager.h
+ ../Bindings/WebPlugin.h
+ ../BiomeDef.h
+ ../BlockArea.h
+ ../BlockEntities/BlockEntity.h
+ ../BlockEntities/BlockEntityWithItems.h
+ ../BlockEntities/ChestEntity.h
+ ../BlockEntities/DispenserEntity.h
+ ../BlockEntities/DropSpenserEntity.h
+ ../BlockEntities/DropperEntity.h
+ ../BlockEntities/FurnaceEntity.h
+ ../BlockEntities/HopperEntity.h
+ ../BlockEntities/JukeboxEntity.h
+ ../BlockEntities/NoteEntity.h
+ ../BlockEntities/SignEntity.h
+ ../BlockEntities/MobHeadEntity.h
+ ../BlockEntities/FlowerPotEntity.h
+ ../BlockID.h
+ ../BoundingBox.h
+ ../ChatColor.h
+ ../ChunkDef.h
+ ../ClientHandle.h
+ ../CraftingRecipes.h
+ ../Cuboid.h
+ ../Defines.h
+ ../Enchantments.h
+ ../Entities/EntityEffect.h
+ ../Entities/Entity.h
+ ../Entities/Floater.h
+ ../Entities/Pawn.h
+ ../Entities/Painting.h
+ ../Entities/Pickup.h
+ ../Entities/Player.h
+ ../Entities/ProjectileEntity.h
+ ../Entities/ArrowEntity.h
+ ../Entities/ThrownEggEntity.h
+ ../Entities/ThrownEnderPearlEntity.h
+ ../Entities/ExpBottleEntity.h
+ ../Entities/ThrownSnowballEntity.h
+ ../Entities/FireChargeEntity.h
+ ../Entities/FireworkEntity.h
+ ../Entities/GhastFireballEntity.h
+ ../Entities/TNTEntity.h
+ ../Entities/ExpOrb.h
+ ../Entities/HangingEntity.h
+ ../Entities/ItemFrame.h
+ ../Generating/ChunkDesc.h
+ ../Group.h
+ ../Inventory.h
+ ../Item.h
+ ../ItemGrid.h
+ ../Mobs/Monster.h
+ ../OSSupport/File.h
+ ../Root.h
+ ../Server.h
+ ../StringUtils.h
+ ../Tracer.h
+ ../UI/Window.h
+ ../Vector3.h
+ ../WebAdmin.h
+ ../World.h
+)
+
+if (NOT MSVC)
+ ADD_CUSTOM_COMMAND(
+ # add any new generated bindings here
+ OUTPUT ${BINDING_OUTPUTS}
+
+ # Regenerate bindings:
+ COMMAND tolua -L virtual_method_hooks.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+
+ # add any new generation dependencies here
+ DEPENDS ${BINDING_DEPENDENCIES}
+ )
+endif ()
+set_source_files_properties(Bindings/Bindings.cpp PROPERTIES GENERATED TRUE)
+set_source_files_properties(Bindings/Bindings.h PROPERTIES GENERATED TRUE)
+
+if(NOT MSVC)
+ add_library(Bindings ${SRCS} ${HDRS})
+
+ target_link_libraries(Bindings lua sqlite tolualib polarssl)
+endif()
diff --git a/src/Bindings/DeprecatedBindings.cpp b/src/Bindings/DeprecatedBindings.cpp
index d2e60945d..36243bc92 100644
--- a/src/Bindings/DeprecatedBindings.cpp
+++ b/src/Bindings/DeprecatedBindings.cpp
@@ -25,9 +25,9 @@ static int tolua_get_AllToLua_g_BlockLightValue(lua_State* tolua_S)
#ifndef TOLUA_RELEASE
{
tolua_Error tolua_err;
- if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
+ if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
{
- tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err);
+ tolua_error(tolua_S, "#vinvalid type in array indexing.", &tolua_err);
}
}
#endif
@@ -36,7 +36,7 @@ static int tolua_get_AllToLua_g_BlockLightValue(lua_State* tolua_S)
{
tolua_error(tolua_S, "array indexing out of range.", NULL);
}
- tolua_pushnumber(tolua_S,(lua_Number)cBlockInfo::GetLightValue((BLOCKTYPE)BlockType));
+ tolua_pushnumber(tolua_S, (lua_Number)cBlockInfo::GetLightValue((BLOCKTYPE)BlockType));
return 1;
}
#endif // #ifndef TOLUA_DISABLE
@@ -53,8 +53,8 @@ static int tolua_get_AllToLua_g_BlockSpreadLightFalloff(lua_State* tolua_S)
#ifndef TOLUA_RELEASE
{
tolua_Error tolua_err;
- if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
- tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err);
+ if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
+ tolua_error(tolua_S, "#vinvalid type in array indexing.", &tolua_err);
}
#endif
BlockType = (int)tolua_tonumber(tolua_S, 2, 0);
@@ -79,8 +79,8 @@ static int tolua_get_AllToLua_g_BlockTransparent(lua_State* tolua_S)
#ifndef TOLUA_RELEASE
{
tolua_Error tolua_err;
- if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
- tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err);
+ if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
+ tolua_error(tolua_S, "#vinvalid type in array indexing.", &tolua_err);
}
#endif
BlockType = (int)tolua_tonumber(tolua_S, 2, 0);
@@ -105,8 +105,8 @@ static int tolua_get_AllToLua_g_BlockOneHitDig(lua_State* tolua_S)
#ifndef TOLUA_RELEASE
{
tolua_Error tolua_err;
- if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
- tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err);
+ if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
+ tolua_error(tolua_S, "#vinvalid type in array indexing.", &tolua_err);
}
#endif
BlockType = (int)tolua_tonumber(tolua_S, 2, 0);
@@ -131,8 +131,8 @@ static int tolua_get_AllToLua_g_BlockPistonBreakable(lua_State* tolua_S)
#ifndef TOLUA_RELEASE
{
tolua_Error tolua_err;
- if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
- tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err);
+ if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
+ tolua_error(tolua_S, "#vinvalid type in array indexing.", &tolua_err);
}
#endif
BlockType = (int)tolua_tonumber(tolua_S, 2, 0);
@@ -157,8 +157,8 @@ static int tolua_get_AllToLua_g_BlockIsSnowable(lua_State* tolua_S)
#ifndef TOLUA_RELEASE
{
tolua_Error tolua_err;
- if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
- tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err);
+ if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
+ tolua_error(tolua_S, "#vinvalid type in array indexing.", &tolua_err);
}
#endif
BlockType = (int)tolua_tonumber(tolua_S, 2, 0);
@@ -175,32 +175,6 @@ static int tolua_get_AllToLua_g_BlockIsSnowable(lua_State* tolua_S)
-/* get function: g_BlockRequiresSpecialTool */
-#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockRequiresSpecialTool
-static int tolua_get_AllToLua_g_BlockRequiresSpecialTool(lua_State* tolua_S)
-{
- int BlockType;
- #ifndef TOLUA_RELEASE
- {
- tolua_Error tolua_err;
- if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
- tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err);
- }
- #endif
- BlockType = (int)tolua_tonumber(tolua_S, 2, 0);
- if ((BlockType < 0) || (BlockType > E_BLOCK_MAX_TYPE_ID))
- {
- tolua_error(tolua_S, "array indexing out of range.", NULL);
- }
- tolua_pushboolean(tolua_S, cBlockInfo::RequiresSpecialTool((BLOCKTYPE)BlockType));
- return 1;
-}
-#endif // #ifndef TOLUA_DISABLE
-
-
-
-
-
/* get function: g_BlockIsSolid */
#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockIsSolid
static int tolua_get_AllToLua_g_BlockIsSolid(lua_State* tolua_S)
@@ -209,8 +183,8 @@ static int tolua_get_AllToLua_g_BlockIsSolid(lua_State* tolua_S)
#ifndef TOLUA_RELEASE
{
tolua_Error tolua_err;
- if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
- tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err);
+ if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
+ tolua_error(tolua_S, "#vinvalid type in array indexing.", &tolua_err);
}
#endif
BlockType = (int)tolua_tonumber(tolua_S, 2, 0);
@@ -235,8 +209,8 @@ static int tolua_get_AllToLua_g_BlockFullyOccupiesVoxel(lua_State* tolua_S)
#ifndef TOLUA_RELEASE
{
tolua_Error tolua_err;
- if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
- tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err);
+ if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
+ tolua_error(tolua_S, "#vinvalid type in array indexing.", &tolua_err);
}
#endif
BlockType = (int)tolua_tonumber(tolua_S, 2, 0);
@@ -263,7 +237,6 @@ void DeprecatedBindings::Bind(lua_State * tolua_S)
tolua_array(tolua_S, "g_BlockOneHitDig", tolua_get_AllToLua_g_BlockOneHitDig, NULL);
tolua_array(tolua_S, "g_BlockPistonBreakable", tolua_get_AllToLua_g_BlockPistonBreakable, NULL);
tolua_array(tolua_S, "g_BlockIsSnowable", tolua_get_AllToLua_g_BlockIsSnowable, NULL);
- tolua_array(tolua_S, "g_BlockRequiresSpecialTool", tolua_get_AllToLua_g_BlockRequiresSpecialTool, NULL);
tolua_array(tolua_S, "g_BlockIsSolid", tolua_get_AllToLua_g_BlockIsSolid, NULL);
tolua_array(tolua_S, "g_BlockFullyOccupiesVoxel", tolua_get_AllToLua_g_BlockFullyOccupiesVoxel, NULL);
diff --git a/src/Bindings/DeprecatedBindings.h b/src/Bindings/DeprecatedBindings.h
index 5fc3cfa80..037d50489 100644
--- a/src/Bindings/DeprecatedBindings.h
+++ b/src/Bindings/DeprecatedBindings.h
@@ -4,5 +4,5 @@ struct lua_State;
class DeprecatedBindings
{
public:
- static void Bind( lua_State* tolua_S );
+ static void Bind( lua_State* tolua_S);
};
diff --git a/src/Bindings/LuaFunctions.h b/src/Bindings/LuaFunctions.h
index 629e2d77d..2ea37d7a4 100644
--- a/src/Bindings/LuaFunctions.h
+++ b/src/Bindings/LuaFunctions.h
@@ -9,7 +9,7 @@ inline unsigned int GetTime()
return (unsigned int)time(0);
}
-inline std::string GetChar( std::string & a_Str, unsigned int a_Idx )
+inline std::string GetChar( std::string & a_Str, unsigned int a_Idx)
{
return std::string(1, a_Str[ a_Idx ]);
}
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index 7d918cf2b..e123a87c9 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -1336,9 +1336,8 @@ void cLuaState::LogStack(lua_State * a_LuaState, const char * a_Header)
{
UNUSED(a_Header); // The param seems unused when compiling for release, so the compiler warns
-
// Format string consisting only of %s is used to appease the compiler
- LOGD("%s",(a_Header != NULL) ? a_Header : "Lua C API Stack contents:");
+ LOGD("%s", (a_Header != NULL) ? a_Header : "Lua C API Stack contents:");
for (int i = lua_gettop(a_LuaState); i > 0; i--)
{
AString Value;
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index 530101d47..df9687fc0 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -319,9 +319,9 @@ static int tolua_DoWith(lua_State* tolua_S)
{
public:
cLuaCallback(lua_State* a_LuaState, int a_FuncRef, int a_TableRef)
- : LuaState( a_LuaState )
- , FuncRef( a_FuncRef )
- , TableRef( a_TableRef )
+ : LuaState( a_LuaState)
+ , FuncRef( a_FuncRef)
+ , TableRef( a_TableRef)
{}
private:
@@ -358,7 +358,7 @@ static int tolua_DoWith(lua_State* tolua_S)
luaL_unref(tolua_S, LUA_REGISTRYINDEX, FuncRef);
/* Push return value on stack */
- tolua_pushboolean(tolua_S, bRetVal );
+ tolua_pushboolean(tolua_S, bRetVal);
return 1;
}
@@ -448,7 +448,7 @@ static int tolua_DoWithID(lua_State* tolua_S)
luaL_unref(tolua_S, LUA_REGISTRYINDEX, FuncRef);
/* Push return value on stack */
- tolua_pushboolean(tolua_S, bRetVal );
+ tolua_pushboolean(tolua_S, bRetVal);
return 1;
}
@@ -478,7 +478,7 @@ static int tolua_DoWithXYZ(lua_State* tolua_S)
int ItemX = ((int)tolua_tonumber(tolua_S, 2, 0));
int ItemY = ((int)tolua_tonumber(tolua_S, 3, 0));
int ItemZ = ((int)tolua_tonumber(tolua_S, 4, 0));
- LOG("x %i y %i z %i", ItemX, ItemY, ItemZ );
+ LOG("x %i y %i z %i", ItemX, ItemY, ItemZ);
if (!lua_isfunction( tolua_S, 5))
{
return lua_do_error(tolua_S, "Error in function call '#funcname#': Expected a function for parameter #4");
@@ -506,9 +506,9 @@ static int tolua_DoWithXYZ(lua_State* tolua_S)
{
public:
cLuaCallback(lua_State* a_LuaState, int a_FuncRef, int a_TableRef)
- : LuaState( a_LuaState )
- , FuncRef( a_FuncRef )
- , TableRef( a_TableRef )
+ : LuaState( a_LuaState)
+ , FuncRef( a_FuncRef)
+ , TableRef( a_TableRef)
{}
private:
@@ -544,7 +544,7 @@ static int tolua_DoWithXYZ(lua_State* tolua_S)
luaL_unref(tolua_S, LUA_REGISTRYINDEX, FuncRef);
/* Push return value on stack */
- tolua_pushboolean(tolua_S, bRetVal );
+ tolua_pushboolean(tolua_S, bRetVal);
return 1;
}
@@ -601,9 +601,9 @@ static int tolua_ForEachInChunk(lua_State * tolua_S)
{
public:
cLuaCallback(lua_State* a_LuaState, int a_FuncRef, int a_TableRef)
- : LuaState( a_LuaState )
- , FuncRef( a_FuncRef )
- , TableRef( a_TableRef )
+ : LuaState( a_LuaState)
+ , FuncRef( a_FuncRef)
+ , TableRef( a_TableRef)
{}
private:
@@ -640,7 +640,7 @@ static int tolua_ForEachInChunk(lua_State * tolua_S)
luaL_unref(tolua_S, LUA_REGISTRYINDEX, FuncRef);
/* Push return value on stack */
- tolua_pushboolean(tolua_S, bRetVal );
+ tolua_pushboolean(tolua_S, bRetVal);
return 1;
}
@@ -656,12 +656,12 @@ template<
static int tolua_ForEach(lua_State * tolua_S)
{
int NumArgs = lua_gettop(tolua_S) - 1; /* This includes 'self' */
- if( NumArgs != 1 && NumArgs != 2)
+ if ((NumArgs != 1) && (NumArgs != 2))
{
return lua_do_error(tolua_S, "Error in function call '#funcname#': Requires 1 or 2 arguments, got %i", NumArgs);
}
- Ty1 * self = (Ty1 *) tolua_tousertype(tolua_S, 1, NULL);
+ Ty1 * self = (Ty1 *)tolua_tousertype(tolua_S, 1, NULL);
if (self == NULL)
{
return lua_do_error(tolua_S, "Error in function call '#funcname#': Not called on an object instance");
@@ -694,16 +694,16 @@ static int tolua_ForEach(lua_State * tolua_S)
{
public:
cLuaCallback(lua_State* a_LuaState, int a_FuncRef, int a_TableRef)
- : LuaState( a_LuaState )
- , FuncRef( a_FuncRef )
- , TableRef( a_TableRef )
+ : LuaState( a_LuaState)
+ , FuncRef( a_FuncRef)
+ , TableRef( a_TableRef)
{}
private:
virtual bool Item(Ty2 * a_Item) override
{
lua_rawgeti( LuaState, LUA_REGISTRYINDEX, FuncRef); /* Push function reference */
- tolua_pushusertype( LuaState, a_Item, Ty2::GetClassStatic() );
+ tolua_pushusertype( LuaState, a_Item, Ty2::GetClassStatic());
if (TableRef != LUA_REFNIL)
{
lua_rawgeti( LuaState, LUA_REGISTRYINDEX, TableRef); /* Push table reference */
@@ -733,7 +733,7 @@ static int tolua_ForEach(lua_State * tolua_S)
luaL_unref(tolua_S, LUA_REGISTRYINDEX, FuncRef);
/* Push return value on stack */
- tolua_pushboolean(tolua_S, bRetVal );
+ tolua_pushboolean(tolua_S, bRetVal);
return 1;
}
@@ -958,7 +958,7 @@ tolua_lerror:
static int tolua_cWorld_TryGetHeight(lua_State * tolua_S)
{
// Exported manually, because tolua would require the out-only param a_Height to be used when calling
- // Takes (a_World,) a_BlockX, a_BlockZ
+ // Takes a_World, a_BlockX, a_BlockZ
// Returns Height, IsValid
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
@@ -1360,7 +1360,7 @@ static int tolua_cPluginManager_AddHook(lua_State * tolua_S)
static int tolua_cPluginManager_ForEachCommand(lua_State * tolua_S)
{
int NumArgs = lua_gettop(tolua_S) - 1; /* This includes 'self' */
- if( NumArgs != 1)
+ if (NumArgs != 1)
{
LOGWARN("Error in function call 'ForEachCommand': Requires 1 argument, got %i", NumArgs);
return 0;
@@ -1390,8 +1390,8 @@ static int tolua_cPluginManager_ForEachCommand(lua_State * tolua_S)
{
public:
cLuaCallback(lua_State * a_LuaState, int a_FuncRef)
- : LuaState( a_LuaState )
- , FuncRef( a_FuncRef )
+ : LuaState( a_LuaState)
+ , FuncRef( a_FuncRef)
{}
private:
@@ -1437,7 +1437,7 @@ static int tolua_cPluginManager_ForEachCommand(lua_State * tolua_S)
static int tolua_cPluginManager_ForEachConsoleCommand(lua_State * tolua_S)
{
int NumArgs = lua_gettop(tolua_S) - 1; /* This includes 'self' */
- if( NumArgs != 1)
+ if (NumArgs != 1)
{
LOGWARN("Error in function call 'ForEachConsoleCommand': Requires 1 argument, got %i", NumArgs);
return 0;
@@ -1467,8 +1467,8 @@ static int tolua_cPluginManager_ForEachConsoleCommand(lua_State * tolua_S)
{
public:
cLuaCallback(lua_State * a_LuaState, int a_FuncRef)
- : LuaState( a_LuaState )
- , FuncRef( a_FuncRef )
+ : LuaState( a_LuaState)
+ , FuncRef( a_FuncRef)
{}
private:
@@ -1926,28 +1926,28 @@ static int tolua_cPluginLua_AddWebTab(lua_State * tolua_S)
int Reference = LUA_REFNIL;
if (
- tolua_isstring(tolua_S, 2, 0, &tolua_err ) &&
- lua_isfunction(tolua_S, 3 )
+ tolua_isstring(tolua_S, 2, 0, &tolua_err) &&
+ lua_isfunction(tolua_S, 3)
)
{
Reference = luaL_ref(tolua_S, LUA_REGISTRYINDEX);
- Title = ((std::string) tolua_tocppstring(tolua_S,2,0));
+ Title = ((std::string)tolua_tocppstring(tolua_S, 2, 0));
}
else
{
return tolua_do_error(tolua_S, "#ferror calling function '#funcname#'", &tolua_err);
}
- if( Reference != LUA_REFNIL )
+ if (Reference != LUA_REFNIL)
{
- if( !self->AddWebTab( Title.c_str(), tolua_S, Reference ) )
+ if (!self->AddWebTab(Title.c_str(), tolua_S, Reference))
{
- luaL_unref( tolua_S, LUA_REGISTRYINDEX, Reference );
+ luaL_unref(tolua_S, LUA_REGISTRYINDEX, Reference);
}
}
else
{
- LOGERROR("ERROR: cPluginLua:AddWebTab invalid function reference in 2nd argument (Title: \"%s\")", Title.c_str() );
+ LOGWARNING("cPluginLua:AddWebTab: invalid function reference in 2nd argument (Title: \"%s\")", Title.c_str());
}
return 0;
@@ -1963,7 +1963,7 @@ static int tolua_cPluginLua_AddTab(lua_State* tolua_S)
LOGWARN("WARNING: Using deprecated function AddTab()! Use AddWebTab() instead. (plugin \"%s\" in folder \"%s\")",
self->GetName().c_str(), self->GetDirectory().c_str()
);
- return tolua_cPluginLua_AddWebTab( tolua_S );
+ return tolua_cPluginLua_AddWebTab( tolua_S);
}
@@ -2011,12 +2011,12 @@ static int tolua_md5(lua_State* tolua_S)
-static int tolua_push_StringStringMap(lua_State* tolua_S, std::map< std::string, std::string >& a_StringStringMap )
+static int tolua_push_StringStringMap(lua_State* tolua_S, std::map< std::string, std::string >& a_StringStringMap)
{
lua_newtable(tolua_S);
int top = lua_gettop(tolua_S);
- for( std::map< std::string, std::string >::iterator it = a_StringStringMap.begin(); it != a_StringStringMap.end(); ++it )
+ for (std::map<std::string, std::string>::iterator it = a_StringStringMap.begin(); it != a_StringStringMap.end(); ++it)
{
const char* key = it->first.c_str();
const char* value = it->second.c_str();
@@ -2060,11 +2060,11 @@ static int tolua_get_HTTPRequest_FormData(lua_State* tolua_S)
lua_newtable(tolua_S);
int top = lua_gettop(tolua_S);
- for( std::map< std::string, HTTPFormData >::iterator it = FormData.begin(); it != FormData.end(); ++it )
+ for (std::map<std::string, HTTPFormData>::iterator it = FormData.begin(); it != FormData.end(); ++it)
{
- lua_pushstring(tolua_S, it->first.c_str() );
- tolua_pushusertype(tolua_S, &(it->second), "HTTPFormData" );
- // lua_pushlstring(tolua_S, it->second.Value.c_str(), it->second.Value.size() ); // Might contain binary data
+ lua_pushstring(tolua_S, it->first.c_str());
+ tolua_pushusertype(tolua_S, &(it->second), "HTTPFormData");
+ // lua_pushlstring(tolua_S, it->second.Value.c_str(), it->second.Value.size()); // Might contain binary data
lua_settable(tolua_S, top);
}
@@ -2109,12 +2109,12 @@ static int tolua_cWebPlugin_GetTabNames(lua_State * tolua_S)
lua_newtable(tolua_S);
int index = 1;
cWebPlugin::TabNameList::const_iterator iter = TabNames.begin();
- while(iter != TabNames.end())
+ while (iter != TabNames.end())
{
const AString & FancyName = iter->first;
const AString & WebName = iter->second;
- tolua_pushstring( tolua_S, WebName.c_str() ); // Because the WebName is supposed to be unique, use it as key
- tolua_pushstring( tolua_S, FancyName.c_str() );
+ tolua_pushstring( tolua_S, WebName.c_str()); // Because the WebName is supposed to be unique, use it as key
+ tolua_pushstring( tolua_S, FancyName.c_str());
//
lua_rawset(tolua_S, -3);
++iter;
@@ -2591,7 +2591,7 @@ static int tolua_cBlockArea_LoadFromSchematicFile(lua_State * tolua_S)
}
AString Filename = tolua_tostring(tolua_S, 2, 0);
- bool res = cSchematicFileSerializer::LoadFromSchematicFile(*self,Filename);
+ bool res = cSchematicFileSerializer::LoadFromSchematicFile(*self, Filename);
tolua_pushboolean(tolua_S, res);
return 1;
}
@@ -2651,7 +2651,7 @@ static int tolua_cBlockArea_SaveToSchematicFile(lua_State * tolua_S)
return 0;
}
AString Filename = tolua_tostring(tolua_S, 2, 0);
- bool res = cSchematicFileSerializer::SaveToSchematicFile(*self,Filename);
+ bool res = cSchematicFileSerializer::SaveToSchematicFile(*self, Filename);
tolua_pushboolean(tolua_S, res);
return 1;
}
@@ -3065,13 +3065,13 @@ void ManualBindings::Bind(lua_State * tolua_S)
tolua_function(tolua_S, "AddWebTab", tolua_cPluginLua_AddWebTab);
tolua_endmodule(tolua_S);
- tolua_cclass(tolua_S,"HTTPRequest","HTTPRequest","",NULL);
- tolua_beginmodule(tolua_S,"HTTPRequest");
- // tolua_variable(tolua_S,"Method",tolua_get_HTTPRequest_Method,tolua_set_HTTPRequest_Method);
- // tolua_variable(tolua_S,"Path",tolua_get_HTTPRequest_Path,tolua_set_HTTPRequest_Path);
- tolua_variable(tolua_S,"FormData",tolua_get_HTTPRequest_FormData,0);
- tolua_variable(tolua_S,"Params",tolua_get_HTTPRequest_Params,0);
- tolua_variable(tolua_S,"PostParams",tolua_get_HTTPRequest_PostParams,0);
+ tolua_cclass(tolua_S, "HTTPRequest", "HTTPRequest", "", NULL);
+ tolua_beginmodule(tolua_S, "HTTPRequest");
+ // tolua_variable(tolua_S, "Method", tolua_get_HTTPRequest_Method, tolua_set_HTTPRequest_Method);
+ // tolua_variable(tolua_S, "Path", tolua_get_HTTPRequest_Path, tolua_set_HTTPRequest_Path);
+ tolua_variable(tolua_S, "FormData", tolua_get_HTTPRequest_FormData, 0);
+ tolua_variable(tolua_S, "Params", tolua_get_HTTPRequest_Params, 0);
+ tolua_variable(tolua_S, "PostParams", tolua_get_HTTPRequest_PostParams, 0);
tolua_endmodule(tolua_S);
tolua_beginmodule(tolua_S, "cWebAdmin");
diff --git a/src/Bindings/ManualBindings.h b/src/Bindings/ManualBindings.h
index f38e26267..36161c6a2 100644
--- a/src/Bindings/ManualBindings.h
+++ b/src/Bindings/ManualBindings.h
@@ -4,5 +4,5 @@ struct lua_State;
class ManualBindings
{
public:
- static void Bind( lua_State* tolua_S );
+ static void Bind( lua_State* tolua_S);
};
diff --git a/src/Bindings/Plugin.h b/src/Bindings/Plugin.h
index fc8aa1cdb..39d53674b 100644
--- a/src/Bindings/Plugin.h
+++ b/src/Bindings/Plugin.h
@@ -33,7 +33,7 @@ class cPlugin
public:
// tolua_end
- cPlugin( const AString & a_PluginDirectory );
+ cPlugin( const AString & a_PluginDirectory);
virtual ~cPlugin();
virtual void OnDisable(void) {}
@@ -115,10 +115,10 @@ public:
virtual bool HandleConsoleCommand(const AStringVector & a_Split, cCommandOutputCallback & a_Output) = 0;
/// All bound commands are to be removed, do any language-dependent cleanup here
- virtual void ClearCommands(void) {} ;
+ virtual void ClearCommands(void) {}
/// All bound console commands are to be removed, do any language-dependent cleanup here
- virtual void ClearConsoleCommands(void) {} ;
+ virtual void ClearConsoleCommands(void) {}
// tolua_begin
const AString & GetName(void) const { return m_Name; }
@@ -141,7 +141,7 @@ public:
E_SQUIRREL, // OBSOLETE, but kept in place to remind us of the horrors lurking in the history
};
PluginLanguage GetLanguage() { return m_Language; }
- void SetLanguage( PluginLanguage a_Language ) { m_Language = a_Language; }
+ void SetLanguage( PluginLanguage a_Language) { m_Language = a_Language; }
private:
PluginLanguage m_Language;
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp
index 5fa8adc66..0f3f25d75 100644
--- a/src/Bindings/PluginLua.cpp
+++ b/src/Bindings/PluginLua.cpp
@@ -1655,7 +1655,7 @@ int cPluginLua::CallFunctionFromForeignState(
-AString cPluginLua::HandleWebRequest(const HTTPRequest * a_Request )
+AString cPluginLua::HandleWebRequest(const HTTPRequest * a_Request)
{
cCSLock Lock(m_CriticalSection);
std::string RetVal = "";
diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h
index b2979a210..2cea644c1 100644
--- a/src/Bindings/PluginLua.h
+++ b/src/Bindings/PluginLua.h
@@ -144,7 +144,7 @@ public:
virtual const AString GetWebTitle(void) const {return GetName(); }
// cWebPlugin and WebAdmin stuff
- virtual AString HandleWebRequest(const HTTPRequest * a_Request ) override;
+ virtual AString HandleWebRequest(const HTTPRequest * a_Request) override;
bool AddWebTab(const AString & a_Title, lua_State * a_LuaState, int a_FunctionReference); // >> EXPORTED IN MANUALBINDINGS <<
/** Binds the command to call the function specified by a Lua function reference. Simply adds to CommandMap. */
diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp
index 2c0ce701b..088b92a6d 100644
--- a/src/Bindings/PluginManager.cpp
+++ b/src/Bindings/PluginManager.cpp
@@ -72,7 +72,7 @@ void cPluginManager::FindPlugins(void)
{
PluginMap::iterator thiz = itr;
++thiz;
- m_Plugins.erase( itr );
+ m_Plugins.erase( itr);
itr = thiz;
continue;
}
@@ -1432,11 +1432,11 @@ cPluginManager::CommandResult cPluginManager::HandleCommand(cPlayer * a_Player,
-cPlugin * cPluginManager::GetPlugin( const AString & a_Plugin ) const
+cPlugin * cPluginManager::GetPlugin( const AString & a_Plugin) const
{
- for( PluginMap::const_iterator itr = m_Plugins.begin(); itr != m_Plugins.end(); ++itr )
+ for (PluginMap::const_iterator itr = m_Plugins.begin(); itr != m_Plugins.end(); ++itr)
{
- if (itr->second == NULL ) continue;
+ if (itr->second == NULL) continue;
if (itr->second->GetName().compare(a_Plugin) == 0)
{
return itr->second;
diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h
index cffd8d04b..44a94e316 100644
--- a/src/Bindings/PluginManager.h
+++ b/src/Bindings/PluginManager.h
@@ -163,7 +163,7 @@ public:
typedef std::map< AString, cPlugin * > PluginMap;
typedef std::list< cPlugin * > PluginList;
- cPlugin * GetPlugin( const AString & a_Plugin ) const; // tolua_export
+ cPlugin * GetPlugin( const AString & a_Plugin) const; // tolua_export
const PluginMap & GetAllPlugins() const; // >> EXPORTED IN MANUALBINDINGS <<
// tolua_begin
diff --git a/src/Bindings/WebPlugin.cpp b/src/Bindings/WebPlugin.cpp
index 57ed9f6a4..1178c127a 100644
--- a/src/Bindings/WebPlugin.cpp
+++ b/src/Bindings/WebPlugin.cpp
@@ -45,12 +45,12 @@ cWebPlugin::~cWebPlugin()
std::list<std::pair<AString, AString> > cWebPlugin::GetTabNames(void)
{
std::list< std::pair< AString, AString > > NameList;
- for( TabList::iterator itr = GetTabs().begin(); itr != GetTabs().end(); ++itr )
+ for (TabList::iterator itr = GetTabs().begin(); itr != GetTabs().end(); ++itr)
{
std::pair< AString, AString > StringPair;
StringPair.first = (*itr)->Title;
StringPair.second = (*itr)->SafeTitle;
- NameList.push_back( StringPair );
+ NameList.push_back( StringPair);
}
return NameList;
}
@@ -69,7 +69,7 @@ std::pair< AString, AString > cWebPlugin::GetTabNameForRequest(const HTTPRequest
sWebPluginTab * Tab = NULL;
if (Split.size() > 2) // If we got the tab name, show that page
{
- for( TabList::iterator itr = GetTabs().begin(); itr != GetTabs().end(); ++itr )
+ for (TabList::iterator itr = GetTabs().begin(); itr != GetTabs().end(); ++itr)
{
if ((*itr)->SafeTitle.compare(Split[2]) == 0) // This is the one!
{
@@ -80,7 +80,7 @@ std::pair< AString, AString > cWebPlugin::GetTabNameForRequest(const HTTPRequest
}
else // Otherwise show the first tab
{
- if( GetTabs().size() > 0 )
+ if (GetTabs().size() > 0)
Tab = *GetTabs().begin();
}
@@ -100,14 +100,14 @@ std::pair< AString, AString > cWebPlugin::GetTabNameForRequest(const HTTPRequest
AString cWebPlugin::SafeString(const AString & a_String)
{
AString RetVal;
- for( unsigned int i = 0; i < a_String.size(); ++i )
+ for (unsigned int i = 0; i < a_String.size(); ++i)
{
char c = a_String[i];
- if( c == ' ' )
+ if (c == ' ')
{
c = '_';
}
- RetVal.push_back( c );
+ RetVal.push_back( c);
}
return RetVal;
}
diff --git a/src/Bindings/WebPlugin.h b/src/Bindings/WebPlugin.h
index 3587ac637..46bc0cd2d 100644
--- a/src/Bindings/WebPlugin.h
+++ b/src/Bindings/WebPlugin.h
@@ -19,9 +19,9 @@ public:
// tolua_begin
virtual const AString GetWebTitle(void) const = 0;
- virtual AString HandleWebRequest(const HTTPRequest * a_Request ) = 0;
+ virtual AString HandleWebRequest(const HTTPRequest * a_Request) = 0;
- static AString SafeString( const AString & a_String );
+ static AString SafeString( const AString & a_String);
// tolua_end
struct sWebPluginTab
@@ -37,7 +37,7 @@ public:
typedef std::list< std::pair<AString, AString> > TabNameList;
TabNameList GetTabNames(); // >> EXPORTED IN MANUALBINDINGS <<
- std::pair< AString, AString > GetTabNameForRequest(const HTTPRequest* a_Request );
+ std::pair< AString, AString > GetTabNameForRequest(const HTTPRequest* a_Request);
private:
TabList m_Tabs;