Basic style fixes.
This commit is contained in:
parent
7a9f9ab744
commit
5e198c6730
@ -33,9 +33,7 @@
|
||||
|
||||
|
||||
|
||||
/****************************
|
||||
* Better error reporting for Lua
|
||||
**/
|
||||
// Better error reporting for Lua
|
||||
static int tolua_do_error(lua_State* L, const char * a_pMsg, tolua_Error * a_pToLuaError)
|
||||
{
|
||||
// Retrieve current function name
|
||||
@ -81,10 +79,7 @@ static int lua_do_error(lua_State* L, const char * a_pFormat, ...)
|
||||
|
||||
|
||||
|
||||
/****************************
|
||||
* Lua bound functions with special return types
|
||||
**/
|
||||
|
||||
// Lua bound functions with special return types
|
||||
static int tolua_StringSplit(lua_State * tolua_S)
|
||||
{
|
||||
cLuaState LuaState(tolua_S);
|
||||
@ -557,10 +552,12 @@ static int tolua_DoWithXYZ(lua_State* tolua_S)
|
||||
|
||||
|
||||
|
||||
template< class Ty1,
|
||||
class Ty2,
|
||||
bool (Ty1::*Func1)(int, int, cItemCallback<Ty2> &) >
|
||||
static int tolua_ForEachInChunk(lua_State* tolua_S)
|
||||
template<
|
||||
class Ty1,
|
||||
class Ty2,
|
||||
bool (Ty1::*Func1)(int, int, cItemCallback<Ty2> &)
|
||||
>
|
||||
static int tolua_ForEachInChunk(lua_State * tolua_S)
|
||||
{
|
||||
int NumArgs = lua_gettop(tolua_S) - 1; /* This includes 'self' */
|
||||
if ((NumArgs != 3) && (NumArgs != 4))
|
||||
@ -651,9 +648,11 @@ static int tolua_ForEachInChunk(lua_State* tolua_S)
|
||||
|
||||
|
||||
|
||||
template< class Ty1,
|
||||
class Ty2,
|
||||
bool (Ty1::*Func1)(cItemCallback<Ty2> &) >
|
||||
template<
|
||||
class Ty1,
|
||||
class Ty2,
|
||||
bool (Ty1::*Func1)(cItemCallback<Ty2> &)
|
||||
>
|
||||
static int tolua_ForEach(lua_State * tolua_S)
|
||||
{
|
||||
int NumArgs = lua_gettop(tolua_S) - 1; /* This includes 'self' */
|
||||
|
@ -42,10 +42,7 @@ public:
|
||||
// Called each tick
|
||||
virtual void Tick(float a_Dt) = 0;
|
||||
|
||||
/**
|
||||
* On all these functions, return true if you want to override default behavior and not call other plugins on that callback.
|
||||
* You can also return false, so default behavior is used.
|
||||
**/
|
||||
/** Calls the specified hook with the params given. Returns the bool that the hook callback returns.*/
|
||||
virtual bool OnBlockSpread (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, eSpreadSource a_Source) = 0;
|
||||
virtual bool OnBlockToPickups (cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups) = 0;
|
||||
virtual bool OnChat (cPlayer * a_Player, AString & a_Message) = 0;
|
||||
@ -152,7 +149,7 @@ private:
|
||||
int m_Version;
|
||||
|
||||
AString m_Directory;
|
||||
}; // tolua_export
|
||||
}; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
@ -145,7 +145,7 @@ public:
|
||||
|
||||
// cWebPlugin and WebAdmin stuff
|
||||
virtual AString HandleWebRequest(const HTTPRequest * a_Request ) override;
|
||||
bool AddWebTab(const AString & a_Title, lua_State * a_LuaState, int a_FunctionReference); // >> EXPORTED IN MANUALBINDINGS <<
|
||||
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. */
|
||||
void BindCommand(const AString & a_Command, int a_FnRef);
|
||||
|
@ -1486,7 +1486,7 @@ bool cPluginManager::DisablePlugin(const AString & a_PluginName)
|
||||
if (itr->first.compare(a_PluginName) == 0) // _X 2013_02_01: wtf? Isn't this supposed to be what find() does?
|
||||
{
|
||||
m_DisablePluginList.push_back(itr->second);
|
||||
itr->second = NULL; // Get rid of this thing right away
|
||||
itr->second = NULL; // Get rid of this thing right away
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -51,9 +51,11 @@ class cBlockEntityWithItems;
|
||||
|
||||
|
||||
|
||||
class cPluginManager // tolua_export
|
||||
{ // tolua_export
|
||||
public: // tolua_export
|
||||
// tolua_begin
|
||||
class cPluginManager
|
||||
{
|
||||
public:
|
||||
// tolua_end
|
||||
|
||||
// Called each tick
|
||||
virtual void Tick(float a_Dt);
|
||||
@ -157,15 +159,17 @@ public: // tolua_export
|
||||
|
||||
|
||||
/** Returns the instance of the Plugin Manager (there is only ever one) */
|
||||
static cPluginManager * Get(void); // tolua_export
|
||||
static cPluginManager * Get(void); // tolua_export
|
||||
|
||||
typedef std::map< AString, cPlugin * > PluginMap;
|
||||
typedef std::list< cPlugin * > PluginList;
|
||||
cPlugin * GetPlugin( const AString & a_Plugin ) const; // tolua_export
|
||||
const PluginMap & GetAllPlugins() const; // >> EXPORTED IN MANUALBINDINGS <<
|
||||
cPlugin * GetPlugin( const AString & a_Plugin ) const; // tolua_export
|
||||
const PluginMap & GetAllPlugins() const; // >> EXPORTED IN MANUALBINDINGS <<
|
||||
|
||||
void FindPlugins(); // tolua_export
|
||||
void ReloadPlugins(); // tolua_export
|
||||
// tolua_begin
|
||||
void FindPlugins();
|
||||
void ReloadPlugins();
|
||||
// tolua_end
|
||||
|
||||
/** Adds the plugin to the list of plugins called for the specified hook type. Handles multiple adds as a single add */
|
||||
void AddHook(cPlugin * a_Plugin, int a_HookType);
|
||||
|
@ -64,27 +64,27 @@ std::pair< AString, AString > cWebPlugin::GetTabNameForRequest(const HTTPRequest
|
||||
std::pair< AString, AString > Names;
|
||||
AStringVector Split = StringSplit(a_Request->Path, "/");
|
||||
|
||||
if( Split.size() > 1 )
|
||||
if (Split.size() > 1)
|
||||
{
|
||||
sWebPluginTab* Tab = 0;
|
||||
if( Split.size() > 2 ) // If we got the tab name, show that page
|
||||
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 )
|
||||
{
|
||||
if( (*itr)->SafeTitle.compare( Split[2] ) == 0 ) // This is the one! Rawr
|
||||
if ((*itr)->SafeTitle.compare(Split[2]) == 0) // This is the one!
|
||||
{
|
||||
Tab = *itr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Otherwise show the first tab
|
||||
else // Otherwise show the first tab
|
||||
{
|
||||
if( GetTabs().size() > 0 )
|
||||
Tab = *GetTabs().begin();
|
||||
}
|
||||
|
||||
if( Tab )
|
||||
if (Tab != NULL)
|
||||
{
|
||||
Names.first = Tab->Title;
|
||||
Names.second = Tab->SafeTitle;
|
||||
@ -97,7 +97,7 @@ std::pair< AString, AString > cWebPlugin::GetTabNameForRequest(const HTTPRequest
|
||||
|
||||
|
||||
|
||||
AString cWebPlugin::SafeString( const AString & a_String )
|
||||
AString cWebPlugin::SafeString(const AString & a_String)
|
||||
{
|
||||
AString RetVal;
|
||||
for( unsigned int i = 0; i < a_String.size(); ++i )
|
||||
@ -111,3 +111,7 @@ AString cWebPlugin::SafeString( const AString & a_String )
|
||||
}
|
||||
return RetVal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
/// Note that the coords are chunk-relative!
|
||||
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ);
|
||||
|
||||
/** Called before a block is placed into a world.
|
||||
/** Called before a block is placed into a world.
|
||||
The handler should return true to allow placement, false to refuse.
|
||||
Also, the handler should set a_BlockType and a_BlockMeta to correct values for the newly placed block.
|
||||
Called by cItemHandler::GetPlacementBlockTypeMeta() if the item is a block
|
||||
|
Loading…
Reference in New Issue
Block a user