summaryrefslogtreecommitdiffstats
path: root/src/Bindings
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-22 19:30:31 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-22 19:30:31 +0200
commit18a0b60c12daec4c04fd3cb9c4422e69de4fcbf2 (patch)
tree089b3be905aa030367925762c58bd30b08f5f3f6 /src/Bindings
parentMerge branch 'master' into saplingsandleaves (diff)
parentUpdated prefabs to current Gallery content. (diff)
downloadcuberite-18a0b60c12daec4c04fd3cb9c4422e69de4fcbf2.tar
cuberite-18a0b60c12daec4c04fd3cb9c4422e69de4fcbf2.tar.gz
cuberite-18a0b60c12daec4c04fd3cb9c4422e69de4fcbf2.tar.bz2
cuberite-18a0b60c12daec4c04fd3cb9c4422e69de4fcbf2.tar.lz
cuberite-18a0b60c12daec4c04fd3cb9c4422e69de4fcbf2.tar.xz
cuberite-18a0b60c12daec4c04fd3cb9c4422e69de4fcbf2.tar.zst
cuberite-18a0b60c12daec4c04fd3cb9c4422e69de4fcbf2.zip
Diffstat (limited to '')
-rw-r--r--src/Bindings/DeprecatedBindings.h2
-rw-r--r--src/Bindings/LuaFunctions.h2
-rw-r--r--src/Bindings/ManualBindings.cpp82
-rw-r--r--src/Bindings/ManualBindings.h2
-rw-r--r--src/Bindings/Plugin.h4
-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
11 files changed, 63 insertions, 63 deletions
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/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index 4047adc3a..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;
}
@@ -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:
@@ -1938,16 +1938,16 @@ static int tolua_cPluginLua_AddWebTab(lua_State * tolua_S)
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;
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..3882b7474 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) {}
@@ -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;