1
0
Fork 0

En masse NULL -> nullptr replace

This commit is contained in:
Tiger Wang 2014-10-20 21:55:07 +01:00 committed by archshift
parent 2ac3a807b7
commit a26541a7c3
211 changed files with 1767 additions and 1745 deletions

View File

@ -45,7 +45,7 @@ class cListAllocationPool : public cAllocationPool<T>
for (size_t i = 0; i < NumElementsInReserve; i++)
{
void * space = malloc(sizeof(T));
if (space == NULL)
if (space == nullptr)
{
m_Callbacks->OnStartUsingReserve();
break;
@ -68,7 +68,7 @@ class cListAllocationPool : public cAllocationPool<T>
if (m_FreeList.size() <= NumElementsInReserve)
{
void * space = malloc(sizeof(T));
if (space != NULL)
if (space != nullptr)
{
return new(space) T;
}
@ -90,7 +90,7 @@ class cListAllocationPool : public cAllocationPool<T>
}
virtual void Free(T * a_ptr) override
{
if (a_ptr == NULL)
if (a_ptr == nullptr)
{
return;
}

View File

@ -29,7 +29,7 @@ static int tolua_get_AllToLua_g_BlockLightValue(lua_State* tolua_S)
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_error(tolua_S, "array indexing out of range.", nullptr);
}
tolua_pushnumber(tolua_S, (lua_Number)cBlockInfo::GetLightValue((BLOCKTYPE)BlockType));
return 1;
@ -55,7 +55,7 @@ static int tolua_get_AllToLua_g_BlockSpreadLightFalloff(lua_State* tolua_S)
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_error(tolua_S, "array indexing out of range.", nullptr);
}
tolua_pushnumber(tolua_S, (lua_Number)cBlockInfo::GetSpreadLightFalloff((BLOCKTYPE)BlockType));
return 1;
@ -81,7 +81,7 @@ static int tolua_get_AllToLua_g_BlockTransparent(lua_State* tolua_S)
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_error(tolua_S, "array indexing out of range.", nullptr);
}
tolua_pushboolean(tolua_S, cBlockInfo::IsTransparent((BLOCKTYPE)BlockType));
return 1;
@ -107,7 +107,7 @@ static int tolua_get_AllToLua_g_BlockOneHitDig(lua_State* tolua_S)
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_error(tolua_S, "array indexing out of range.", nullptr);
}
tolua_pushboolean(tolua_S, cBlockInfo::IsOneHitDig((BLOCKTYPE)BlockType));
return 1;
@ -133,7 +133,7 @@ static int tolua_get_AllToLua_g_BlockPistonBreakable(lua_State* tolua_S)
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_error(tolua_S, "array indexing out of range.", nullptr);
}
tolua_pushboolean(tolua_S, cBlockInfo::IsPistonBreakable((BLOCKTYPE)BlockType));
return 1;
@ -159,7 +159,7 @@ static int tolua_get_AllToLua_g_BlockIsSnowable(lua_State* tolua_S)
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_error(tolua_S, "array indexing out of range.", nullptr);
}
tolua_pushboolean(tolua_S, cBlockInfo::IsSnowable((BLOCKTYPE)BlockType));
return 1;
@ -185,7 +185,7 @@ static int tolua_get_AllToLua_g_BlockIsSolid(lua_State* tolua_S)
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_error(tolua_S, "array indexing out of range.", nullptr);
}
tolua_pushboolean(tolua_S, (bool)cBlockInfo::IsSolid((BLOCKTYPE)BlockType));
return 1;
@ -211,7 +211,7 @@ static int tolua_get_AllToLua_g_BlockFullyOccupiesVoxel(lua_State* tolua_S)
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_error(tolua_S, "array indexing out of range.", nullptr);
}
tolua_pushboolean(tolua_S, (bool)cBlockInfo::FullyOccupiesVoxel((BLOCKTYPE)BlockType));
return 1;
@ -224,16 +224,16 @@ static int tolua_get_AllToLua_g_BlockFullyOccupiesVoxel(lua_State* tolua_S)
void DeprecatedBindings::Bind(lua_State * tolua_S)
{
tolua_beginmodule(tolua_S, NULL);
tolua_beginmodule(tolua_S, nullptr);
tolua_array(tolua_S, "g_BlockLightValue", tolua_get_AllToLua_g_BlockLightValue, NULL);
tolua_array(tolua_S, "g_BlockSpreadLightFalloff", tolua_get_AllToLua_g_BlockSpreadLightFalloff, NULL);
tolua_array(tolua_S, "g_BlockTransparent", tolua_get_AllToLua_g_BlockTransparent, NULL);
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_BlockIsSolid", tolua_get_AllToLua_g_BlockIsSolid, NULL);
tolua_array(tolua_S, "g_BlockFullyOccupiesVoxel", tolua_get_AllToLua_g_BlockFullyOccupiesVoxel, NULL);
tolua_array(tolua_S, "g_BlockLightValue", tolua_get_AllToLua_g_BlockLightValue, nullptr);
tolua_array(tolua_S, "g_BlockSpreadLightFalloff", tolua_get_AllToLua_g_BlockSpreadLightFalloff, nullptr);
tolua_array(tolua_S, "g_BlockTransparent", tolua_get_AllToLua_g_BlockTransparent, nullptr);
tolua_array(tolua_S, "g_BlockOneHitDig", tolua_get_AllToLua_g_BlockOneHitDig, nullptr);
tolua_array(tolua_S, "g_BlockPistonBreakable", tolua_get_AllToLua_g_BlockPistonBreakable, nullptr);
tolua_array(tolua_S, "g_BlockIsSnowable", tolua_get_AllToLua_g_BlockIsSnowable, nullptr);
tolua_array(tolua_S, "g_BlockIsSolid", tolua_get_AllToLua_g_BlockIsSolid, nullptr);
tolua_array(tolua_S, "g_BlockFullyOccupiesVoxel", tolua_get_AllToLua_g_BlockFullyOccupiesVoxel, nullptr);
tolua_endmodule(tolua_S);
}

View File

@ -13,7 +13,7 @@
cLuaChunkStay::cLuaChunkStay(cPluginLua & a_Plugin) :
m_Plugin(a_Plugin),
m_LuaState(NULL)
m_LuaState(nullptr)
{
}

View File

@ -46,7 +46,7 @@ const cLuaState::cRet cLuaState::Return = {};
// cLuaState:
cLuaState::cLuaState(const AString & a_SubsystemName) :
m_LuaState(NULL),
m_LuaState(nullptr),
m_IsOwned(false),
m_SubsystemName(a_SubsystemName),
m_NumCurrentFunctionArgs(-1)
@ -90,7 +90,7 @@ cLuaState::~cLuaState()
void cLuaState::Create(void)
{
if (m_LuaState != NULL)
if (m_LuaState != nullptr)
{
LOGWARNING("%s: Trying to create an already-existing LuaState, ignoring.", __FUNCTION__);
return;
@ -119,7 +119,7 @@ void cLuaState::RegisterAPILibs(void)
void cLuaState::Close(void)
{
if (m_LuaState == NULL)
if (m_LuaState == nullptr)
{
LOGWARNING("%s: Trying to close an invalid LuaState, ignoring.", __FUNCTION__);
return;
@ -134,7 +134,7 @@ void cLuaState::Close(void)
return;
}
lua_close(m_LuaState);
m_LuaState = NULL;
m_LuaState = nullptr;
m_IsOwned = false;
}
@ -144,7 +144,7 @@ void cLuaState::Close(void)
void cLuaState::Attach(lua_State * a_State)
{
if (m_LuaState != NULL)
if (m_LuaState != nullptr)
{
LOGINFO("%s: Already contains a LuaState (0x%p), will be closed / detached.", __FUNCTION__, m_LuaState);
if (m_IsOwned)
@ -166,7 +166,7 @@ void cLuaState::Attach(lua_State * a_State)
void cLuaState::Detach(void)
{
if (m_LuaState == NULL)
if (m_LuaState == nullptr)
{
return;
}
@ -179,7 +179,7 @@ void cLuaState::Detach(void)
Close();
return;
}
m_LuaState = NULL;
m_LuaState = nullptr;
}
@ -869,7 +869,7 @@ void cLuaState::GetStackValue(int a_StackPos, AString & a_Value)
{
size_t len = 0;
const char * data = lua_tolstring(m_LuaState, a_StackPos, &len);
if (data != NULL)
if (data != nullptr)
{
a_Value.assign(data, len);
}
@ -919,7 +919,7 @@ void cLuaState::GetStackValue(int a_StackPos, pBoundingBox & a_ReturnedVal)
{
if (lua_isnil(m_LuaState, a_StackPos))
{
a_ReturnedVal = NULL;
a_ReturnedVal = nullptr;
return;
}
tolua_Error err;
@ -937,7 +937,7 @@ void cLuaState::GetStackValue(int a_StackPos, pWorld & a_ReturnedVal)
{
if (lua_isnil(m_LuaState, a_StackPos))
{
a_ReturnedVal = NULL;
a_ReturnedVal = nullptr;
return;
}
tolua_Error err;
@ -1002,7 +1002,7 @@ bool cLuaState::CheckParamUserTable(int a_StartParam, const char * a_UserTable,
lua_Debug entry;
VERIFY(lua_getstack(m_LuaState, 0, &entry));
VERIFY(lua_getinfo (m_LuaState, "n", &entry));
AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != NULL) ? entry.name : "?");
AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != nullptr) ? entry.name : "?");
tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err);
return false;
} // for i - Param
@ -1035,7 +1035,7 @@ bool cLuaState::CheckParamUserType(int a_StartParam, const char * a_UserType, in
lua_Debug entry;
VERIFY(lua_getstack(m_LuaState, 0, &entry));
VERIFY(lua_getinfo (m_LuaState, "n", &entry));
AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != NULL) ? entry.name : "?");
AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != nullptr) ? entry.name : "?");
tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err);
return false;
} // for i - Param
@ -1068,7 +1068,7 @@ bool cLuaState::CheckParamTable(int a_StartParam, int a_EndParam)
lua_Debug entry;
VERIFY(lua_getstack(m_LuaState, 0, &entry));
VERIFY(lua_getinfo (m_LuaState, "n", &entry));
AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != NULL) ? entry.name : "?");
AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != nullptr) ? entry.name : "?");
tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err);
return false;
} // for i - Param
@ -1101,7 +1101,7 @@ bool cLuaState::CheckParamNumber(int a_StartParam, int a_EndParam)
lua_Debug entry;
VERIFY(lua_getstack(m_LuaState, 0, &entry));
VERIFY(lua_getinfo (m_LuaState, "n", &entry));
AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != NULL) ? entry.name : "?");
AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != nullptr) ? entry.name : "?");
tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err);
return false;
} // for i - Param
@ -1134,7 +1134,7 @@ bool cLuaState::CheckParamString(int a_StartParam, int a_EndParam)
lua_Debug entry;
VERIFY(lua_getstack(m_LuaState, 0, &entry));
VERIFY(lua_getinfo (m_LuaState, "n", &entry));
AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != NULL) ? entry.name : "?");
AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != nullptr) ? entry.name : "?");
tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err);
return false;
} // for i - Param
@ -1167,7 +1167,7 @@ bool cLuaState::CheckParamFunction(int a_StartParam, int a_EndParam)
VERIFY(lua_getstack(m_LuaState, 0, &entry));
VERIFY(lua_getinfo (m_LuaState, "n", &entry));
luaL_error(m_LuaState, "Error in function '%s' parameter #%d. Function expected, got %s",
(entry.name != NULL) ? entry.name : "?", i, GetTypeText(i).c_str()
(entry.name != nullptr) ? entry.name : "?", i, GetTypeText(i).c_str()
);
return false;
} // for i - Param
@ -1200,7 +1200,7 @@ bool cLuaState::CheckParamFunctionOrNil(int a_StartParam, int a_EndParam)
VERIFY(lua_getstack(m_LuaState, 0, &entry));
VERIFY(lua_getinfo (m_LuaState, "n", &entry));
luaL_error(m_LuaState, "Error in function '%s' parameter #%d. Function expected, got %s",
(entry.name != NULL) ? entry.name : "?", i, GetTypeText(i).c_str()
(entry.name != nullptr) ? entry.name : "?", i, GetTypeText(i).c_str()
);
return false;
} // for i - Param
@ -1224,7 +1224,7 @@ bool cLuaState::CheckParamEnd(int a_Param)
lua_Debug entry;
VERIFY(lua_getstack(m_LuaState, 0, &entry));
VERIFY(lua_getinfo (m_LuaState, "n", &entry));
AString ErrMsg = Printf("#ferror in function '%s': Too many arguments.", (entry.name != NULL) ? entry.name : "?");
AString ErrMsg = Printf("#ferror in function '%s': Too many arguments.", (entry.name != nullptr) ? entry.name : "?");
tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err);
return false;
}
@ -1403,7 +1403,7 @@ int cLuaState::CopyStackFrom(cLuaState & a_SrcLuaState, int a_SrcStart, int a_Sr
case LUA_TUSERDATA:
{
// Get the class name:
const char * type = NULL;
const char * type = nullptr;
if (lua_getmetatable(a_SrcLuaState, i) == 0)
{
LOGWARNING("%s: Unknown class in pos %d, cannot copy.", __FUNCTION__, i);
@ -1415,7 +1415,7 @@ int cLuaState::CopyStackFrom(cLuaState & a_SrcLuaState, int a_SrcStart, int a_Sr
lua_pop(a_SrcLuaState, 1); // Stack -1
// Copy the value:
void * ud = tolua_touserdata(a_SrcLuaState, i, NULL);
void * ud = tolua_touserdata(a_SrcLuaState, i, nullptr);
tolua_pushusertype(m_LuaState, ud, type);
break;
}
@ -1441,7 +1441,7 @@ void cLuaState::ToString(int a_StackPos, AString & a_String)
{
size_t len;
const char * s = lua_tolstring(m_LuaState, a_StackPos, &len);
if (s != NULL)
if (s != nullptr)
{
a_String.assign(s, len);
}
@ -1463,7 +1463,7 @@ void cLuaState::LogStack(const char * a_Header)
void cLuaState::LogStack(lua_State * a_LuaState, const char * a_Header)
{
// Format string consisting only of %s is used to appease the compiler
LOG("%s", (a_Header != NULL) ? a_Header : "Lua C API Stack contents:");
LOG("%s", (a_Header != nullptr) ? a_Header : "Lua C API Stack contents:");
for (int i = lua_gettop(a_LuaState); i > 0; i--)
{
AString Value;
@ -1500,7 +1500,7 @@ int cLuaState::ReportFnCallErrors(lua_State * a_LuaState)
// cLuaState::cRef:
cLuaState::cRef::cRef(void) :
m_LuaState(NULL),
m_LuaState(nullptr),
m_Ref(LUA_REFNIL)
{
}
@ -1510,7 +1510,7 @@ cLuaState::cRef::cRef(void) :
cLuaState::cRef::cRef(cLuaState & a_LuaState, int a_StackPos) :
m_LuaState(NULL),
m_LuaState(nullptr),
m_Ref(LUA_REFNIL)
{
RefStack(a_LuaState, a_StackPos);
@ -1522,7 +1522,7 @@ cLuaState::cRef::cRef(cLuaState & a_LuaState, int a_StackPos) :
cLuaState::cRef::~cRef()
{
if (m_LuaState != NULL)
if (m_LuaState != nullptr)
{
UnRef();
}
@ -1535,7 +1535,7 @@ cLuaState::cRef::~cRef()
void cLuaState::cRef::RefStack(cLuaState & a_LuaState, int a_StackPos)
{
ASSERT(a_LuaState.IsValid());
if (m_LuaState != NULL)
if (m_LuaState != nullptr)
{
UnRef();
}
@ -1556,7 +1556,7 @@ void cLuaState::cRef::UnRef(void)
{
luaL_unref(*m_LuaState, LUA_REGISTRYINDEX, m_Ref);
}
m_LuaState = NULL;
m_LuaState = nullptr;
m_Ref = LUA_REFNIL;
}

View File

@ -164,7 +164,7 @@ public:
void Detach(void);
/** Returns true if the m_LuaState is valid */
bool IsValid(void) const { return (m_LuaState != NULL); }
bool IsValid(void) const { return (m_LuaState != nullptr); }
/** Adds the specified path to package.<a_PathVariable> */
void AddPackagePath(const AString & a_PathVariable, const AString & a_Path);
@ -318,10 +318,10 @@ public:
void ToString(int a_StackPos, AString & a_String);
/** Logs all the elements' types on the API stack, with an optional header for the listing. */
void LogStack(const char * a_Header = NULL);
void LogStack(const char * a_Header = nullptr);
/** Logs all the elements' types on the API stack, with an optional header for the listing. */
static void LogStack(lua_State * a_LuaState, const char * a_Header = NULL);
static void LogStack(lua_State * a_LuaState, const char * a_Header = nullptr);
protected:

View File

@ -18,7 +18,7 @@
cLuaWindow::cLuaWindow(cWindow::WindowType a_WindowType, int a_SlotsX, int a_SlotsY, const AString & a_Title) :
super(a_WindowType, a_Title),
m_Contents(a_SlotsX, a_SlotsY),
m_Plugin(NULL),
m_Plugin(nullptr),
m_LuaRef(LUA_REFNIL),
m_OnClosingFnRef(LUA_REFNIL),
m_OnSlotChangedFnRef(LUA_REFNIL)
@ -70,7 +70,7 @@ cLuaWindow::~cLuaWindow()
void cLuaWindow::SetLuaRef(cPluginLua * a_Plugin, int a_LuaRef)
{
// Either m_Plugin is not set or equal to the passed plugin; only one plugin can use one cLuaWindow object
ASSERT((m_Plugin == NULL) || (m_Plugin == a_Plugin));
ASSERT((m_Plugin == nullptr) || (m_Plugin == a_Plugin));
ASSERT(m_LuaRef == LUA_REFNIL);
m_Plugin = a_Plugin;
m_LuaRef = a_LuaRef;
@ -82,7 +82,7 @@ void cLuaWindow::SetLuaRef(cPluginLua * a_Plugin, int a_LuaRef)
bool cLuaWindow::IsLuaReferenced(void) const
{
return ((m_Plugin != NULL) && (m_LuaRef != LUA_REFNIL));
return ((m_Plugin != nullptr) && (m_LuaRef != LUA_REFNIL));
}
@ -92,7 +92,7 @@ bool cLuaWindow::IsLuaReferenced(void) const
void cLuaWindow::SetOnClosing(cPluginLua * a_Plugin, int a_FnRef)
{
// Either m_Plugin is not set or equal to the passed plugin; only one plugin can use one cLuaWindow object
ASSERT((m_Plugin == NULL) || (m_Plugin == a_Plugin));
ASSERT((m_Plugin == nullptr) || (m_Plugin == a_Plugin));
// If there already was a function, unreference it first
if (m_OnClosingFnRef != LUA_REFNIL)
@ -112,7 +112,7 @@ void cLuaWindow::SetOnClosing(cPluginLua * a_Plugin, int a_FnRef)
void cLuaWindow::SetOnSlotChanged(cPluginLua * a_Plugin, int a_FnRef)
{
// Either m_Plugin is not set or equal to the passed plugin; only one plugin can use one cLuaWindow object
ASSERT((m_Plugin == NULL) || (m_Plugin == a_Plugin));
ASSERT((m_Plugin == nullptr) || (m_Plugin == a_Plugin));
// If there already was a function, unreference it first
if (m_OnSlotChangedFnRef != LUA_REFNIL)
@ -134,7 +134,7 @@ bool cLuaWindow::ClosedByPlayer(cPlayer & a_Player, bool a_CanRefuse)
// First notify the plugin through the registered callback:
if (m_OnClosingFnRef != LUA_REFNIL)
{
ASSERT(m_Plugin != NULL);
ASSERT(m_Plugin != nullptr);
if (m_Plugin->CallbackWindowClosing(m_OnClosingFnRef, *this, a_Player, a_CanRefuse))
{
// The callback disagrees (the higher levels check the CanRefuse flag compliance)
@ -153,7 +153,7 @@ void cLuaWindow::Destroy(void)
{
super::Destroy();
if ((m_LuaRef != LUA_REFNIL) && (m_Plugin != NULL))
if ((m_LuaRef != LUA_REFNIL) && (m_Plugin != nullptr))
{
// The object is referenced by Lua, un-reference it
m_Plugin->Unreference(m_LuaRef);

View File

@ -145,13 +145,13 @@ static AString GetLogMessage(lua_State * tolua_S)
tolua_Error err;
if (tolua_isusertype(tolua_S, 1, "cCompositeChat", false, &err))
{
return ((cCompositeChat *)tolua_tousertype(tolua_S, 1, NULL))->ExtractText();
return ((cCompositeChat *)tolua_tousertype(tolua_S, 1, nullptr))->ExtractText();
}
else
{
size_t len = 0;
const char * str = lua_tolstring(tolua_S, 1, &len);
if (str != NULL)
if (str != nullptr)
{
return AString(str, len);
}
@ -170,7 +170,7 @@ static int tolua_LOG(lua_State * tolua_S)
tolua_Error err;
if (tolua_isusertype(tolua_S, 1, "cCompositeChat", false, &err))
{
LogLevel = cCompositeChat::MessageTypeToLogLevel(((cCompositeChat *)tolua_tousertype(tolua_S, 1, NULL))->GetMessageType());
LogLevel = cCompositeChat::MessageTypeToLogLevel(((cCompositeChat *)tolua_tousertype(tolua_S, 1, nullptr))->GetMessageType());
}
// Log the message:
@ -264,7 +264,7 @@ static cPluginLua * GetLuaPlugin(lua_State * L)
{
LOGWARNING("%s: cannot get plugin instance, what have you done to my Lua state?", __FUNCTION__);
lua_pop(L, 1);
return NULL;
return nullptr;
}
cPluginLua * Plugin = (cPluginLua *)lua_topointer(L, -1);
lua_pop(L, 1);
@ -312,10 +312,10 @@ static int tolua_DoWith(lua_State* tolua_S)
return lua_do_error(tolua_S, "Error in function call '#funcname#': Requires 2 or 3 arguments, got %i", NumArgs);
}
Ty1 * self = (Ty1 *) tolua_tousertype(tolua_S, 1, NULL);
Ty1 * self = (Ty1 *) tolua_tousertype(tolua_S, 1, nullptr);
const char * ItemName = tolua_tocppstring(tolua_S, 2, "");
if ((ItemName == NULL) || (ItemName[0] == 0))
if ((ItemName == nullptr) || (ItemName[0] == 0))
{
return lua_do_error(tolua_S, "Error in function call '#funcname#': Expected a non-empty string for parameter #1", NumArgs);
}
@ -406,7 +406,7 @@ static int tolua_DoWithID(lua_State* tolua_S)
return lua_do_error(tolua_S, "Error in function call '#funcname#': Requires 2 or 3 arguments, got %i", NumArgs);
}
Ty1 * self = (Ty1 *)tolua_tousertype(tolua_S, 1, NULL);
Ty1 * self = (Ty1 *)tolua_tousertype(tolua_S, 1, nullptr);
int ItemID = (int)tolua_tonumber(tolua_S, 2, 0);
if (!lua_isfunction(tolua_S, 3))
@ -496,7 +496,7 @@ static int tolua_DoWithXYZ(lua_State* tolua_S)
return lua_do_error(tolua_S, "Error in function call '#funcname#': Requires 4 or 5 arguments, got %i", NumArgs);
}
Ty1 * self = (Ty1 *) tolua_tousertype(tolua_S, 1, NULL);
Ty1 * self = (Ty1 *) tolua_tousertype(tolua_S, 1, nullptr);
if (!lua_isnumber(tolua_S, 2) || !lua_isnumber(tolua_S, 3) || !lua_isnumber(tolua_S, 4))
{
return lua_do_error(tolua_S, "Error in function call '#funcname#': Expected a number for parameters #1, #2 and #3");
@ -591,7 +591,7 @@ static int tolua_ForEachInChunk(lua_State * tolua_S)
return lua_do_error(tolua_S, "Error in function call '#funcname#': Requires 3 or 4 arguments, got %i", NumArgs);
}
Ty1 * self = (Ty1 *) tolua_tousertype(tolua_S, 1, NULL);
Ty1 * self = (Ty1 *) tolua_tousertype(tolua_S, 1, nullptr);
if (!lua_isnumber(tolua_S, 2) || !lua_isnumber(tolua_S, 3))
{
return lua_do_error(tolua_S, "Error in function call '#funcname#': Expected a number for parameters #1 and #2");
@ -694,10 +694,10 @@ static int tolua_ForEachInBox(lua_State * tolua_S)
}
// Get the params:
Ty1 * Self = NULL;
cBoundingBox * Box = NULL;
Ty1 * Self = nullptr;
cBoundingBox * Box = nullptr;
L.GetStackValues(1, Self, Box);
if ((Self == NULL) || (Box == NULL))
if ((Self == nullptr) || (Box == nullptr))
{
LOGWARNING("Invalid world (%p) or boundingbox (%p)", Self, Box);
L.LogStackTrace();
@ -760,8 +760,8 @@ static int tolua_ForEach(lua_State * tolua_S)
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);
if (self == NULL)
Ty1 * self = (Ty1 *)tolua_tousertype(tolua_S, 1, nullptr);
if (self == nullptr)
{
return lua_do_error(tolua_S, "Error in function call '#funcname#': Not called on an object instance");
}
@ -857,14 +857,14 @@ static int tolua_cWorld_GetBlockInfo(lua_State * tolua_S)
else
#endif
{
cWorld * self = (cWorld *) tolua_tousertype (tolua_S, 1, NULL);
cWorld * self = (cWorld *) tolua_tousertype (tolua_S, 1, nullptr);
int BlockX = (int) tolua_tonumber (tolua_S, 2, 0);
int BlockY = (int) tolua_tonumber (tolua_S, 3, 0);
int BlockZ = (int) tolua_tonumber (tolua_S, 4, 0);
#ifndef TOLUA_RELEASE
if (self == NULL)
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'GetBlockInfo'", NULL);
tolua_error(tolua_S, "invalid 'self' in function 'GetBlockInfo'", nullptr);
}
#endif
{
@ -912,14 +912,14 @@ static int tolua_cWorld_GetBlockTypeMeta(lua_State * tolua_S)
else
#endif
{
cWorld * self = (cWorld *) tolua_tousertype (tolua_S, 1, NULL);
cWorld * self = (cWorld *) tolua_tousertype (tolua_S, 1, nullptr);
int BlockX = (int) tolua_tonumber (tolua_S, 2, 0);
int BlockY = (int) tolua_tonumber (tolua_S, 3, 0);
int BlockZ = (int) tolua_tonumber (tolua_S, 4, 0);
#ifndef TOLUA_RELEASE
if (self == NULL)
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'GetBlockTypeMeta'", NULL);
tolua_error(tolua_S, "invalid 'self' in function 'GetBlockTypeMeta'", nullptr);
}
#endif
{
@ -964,14 +964,14 @@ static int tolua_cWorld_GetSignLines(lua_State * tolua_S)
else
#endif
{
cWorld * self = (cWorld *) tolua_tousertype (tolua_S, 1, NULL);
cWorld * self = (cWorld *) tolua_tousertype (tolua_S, 1, nullptr);
int BlockX = (int) tolua_tonumber (tolua_S, 2, 0);
int BlockY = (int) tolua_tonumber (tolua_S, 3, 0);
int BlockZ = (int) tolua_tonumber (tolua_S, 4, 0);
#ifndef TOLUA_RELEASE
if (self == NULL)
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'GetSignLines'", NULL);
tolua_error(tolua_S, "invalid 'self' in function 'GetSignLines'", nullptr);
}
#endif
{
@ -1022,7 +1022,7 @@ static int tolua_cWorld_SetSignLines(lua_State * tolua_S)
else
#endif
{
cWorld * self = (cWorld *) tolua_tousertype (tolua_S, 1, NULL);
cWorld * self = (cWorld *) tolua_tousertype (tolua_S, 1, nullptr);
int BlockX = (int) tolua_tonumber (tolua_S, 2, 0);
int BlockY = (int) tolua_tonumber (tolua_S, 3, 0);
int BlockZ = (int) tolua_tonumber (tolua_S, 4, 0);
@ -1030,11 +1030,11 @@ static int tolua_cWorld_SetSignLines(lua_State * tolua_S)
const AString Line2 = tolua_tocppstring(tolua_S, 6, 0);
const AString Line3 = tolua_tocppstring(tolua_S, 7, 0);
const AString Line4 = tolua_tocppstring(tolua_S, 8, 0);
cPlayer * Player = (cPlayer *)tolua_tousertype (tolua_S, 9, NULL);
cPlayer * Player = (cPlayer *)tolua_tousertype (tolua_S, 9, nullptr);
#ifndef TOLUA_RELEASE
if (self == NULL)
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'SetSignLines' / 'UpdateSign'", NULL);
tolua_error(tolua_S, "invalid 'self' in function 'SetSignLines' / 'UpdateSign'", nullptr);
}
#endif
{
@ -1071,13 +1071,13 @@ static int tolua_cWorld_TryGetHeight(lua_State * tolua_S)
else
#endif
{
cWorld * self = (cWorld *) tolua_tousertype (tolua_S, 1, NULL);
cWorld * self = (cWorld *) tolua_tousertype (tolua_S, 1, nullptr);
int BlockX = (int) tolua_tonumber (tolua_S, 2, 0);
int BlockZ = (int) tolua_tonumber (tolua_S, 3, 0);
#ifndef TOLUA_RELEASE
if (self == NULL)
if (self == nullptr)
{
tolua_error(tolua_S, "Invalid 'self' in function 'TryGetHeight'", NULL);
tolua_error(tolua_S, "Invalid 'self' in function 'TryGetHeight'", nullptr);
}
#endif
{
@ -1136,15 +1136,15 @@ static int tolua_cWorld_QueueTask(lua_State * tolua_S)
// Retrieve the cPlugin from the LuaState:
cPluginLua * Plugin = GetLuaPlugin(tolua_S);
if (Plugin == NULL)
if (Plugin == nullptr)
{
// An error message has been already printed in GetLuaPlugin()
return 0;
}
// Retrieve the args:
cWorld * self = (cWorld *)tolua_tousertype(tolua_S, 1, NULL);
if (self == NULL)
cWorld * self = (cWorld *)tolua_tousertype(tolua_S, 1, nullptr);
if (self == nullptr)
{
return lua_do_error(tolua_S, "Error in function call '#funcname#': Not called on an object instance");
}
@ -1200,7 +1200,7 @@ static int tolua_cWorld_ScheduleTask(lua_State * tolua_S)
// Retrieve the cPlugin from the LuaState:
cPluginLua * Plugin = GetLuaPlugin(tolua_S);
if (Plugin == NULL)
if (Plugin == nullptr)
{
// An error message has been already printed in GetLuaPlugin()
return 0;
@ -1216,8 +1216,8 @@ static int tolua_cWorld_ScheduleTask(lua_State * tolua_S)
{
return 0;
}
cWorld * World = (cWorld *)tolua_tousertype(tolua_S, 1, NULL);
if (World == NULL)
cWorld * World = (cWorld *)tolua_tousertype(tolua_S, 1, nullptr);
if (World == nullptr)
{
return lua_do_error(tolua_S, "Error in function call '#funcname#': Not called on an object instance");
}
@ -1241,7 +1241,7 @@ static int tolua_cWorld_ScheduleTask(lua_State * tolua_S)
static int tolua_cPluginManager_GetAllPlugins(lua_State * tolua_S)
{
cPluginManager * self = (cPluginManager *)tolua_tousertype(tolua_S, 1, NULL);
cPluginManager * self = (cPluginManager *)tolua_tousertype(tolua_S, 1, nullptr);
const cPluginManager::PluginMap & AllPlugins = self->GetAllPlugins();
@ -1252,7 +1252,7 @@ static int tolua_cPluginManager_GetAllPlugins(lua_State * tolua_S)
{
const cPlugin* Plugin = iter->second;
tolua_pushstring(tolua_S, iter->first.c_str());
if (Plugin != NULL)
if (Plugin != nullptr)
{
tolua_pushusertype(tolua_S, (void *)Plugin, "const cPlugin");
}
@ -1274,7 +1274,7 @@ static int tolua_cPluginManager_GetAllPlugins(lua_State * tolua_S)
static int tolua_cPluginManager_GetCurrentPlugin(lua_State * S)
{
cPluginLua * Plugin = GetLuaPlugin(S);
if (Plugin == NULL)
if (Plugin == nullptr)
{
// An error message has already been printed in GetLuaPlugin()
return 0;
@ -1305,7 +1305,7 @@ static int tolua_cPluginManager_AddHook_FnRef(cPluginManager * a_PluginManager,
// Retrieve the cPlugin from the LuaState:
cPluginLua * Plugin = GetLuaPlugin(S);
if (Plugin == NULL)
if (Plugin == nullptr)
{
// An error message has been already printed in GetLuaPlugin()
return 0;
@ -1344,8 +1344,8 @@ static int tolua_cPluginManager_AddHook_DefFn(cPluginManager * a_PluginManager,
// The arg types have already been checked
// Retrieve and check the cPlugin parameter
cPluginLua * Plugin = (cPluginLua *)tolua_tousertype(S, a_ParamIdx, NULL);
if (Plugin == NULL)
cPluginLua * Plugin = (cPluginLua *)tolua_tousertype(S, a_ParamIdx, nullptr);
if (Plugin == nullptr)
{
LOGWARNING("cPluginManager.AddHook(): Invalid Plugin parameter, expected a valid cPlugin object. Hook not added");
S.LogStackTrace();
@ -1370,7 +1370,7 @@ static int tolua_cPluginManager_AddHook_DefFn(cPluginManager * a_PluginManager,
// Get the standard name for the callback function:
const char * FnName = cPluginLua::GetHookFnName(HookType);
if (FnName == NULL)
if (FnName == nullptr)
{
LOGWARNING("cPluginManager.AddHook(): Unknown hook type (%d). Hook not added.", HookType);
S.LogStackTrace();
@ -1417,8 +1417,8 @@ static int tolua_cPluginManager_AddHook(lua_State * tolua_S)
if (tolua_isusertype(S, 1, "cPluginManager", 0, &err))
{
// Style 2 or 3, retrieve the PlgMgr instance
PlgMgr = (cPluginManager *)tolua_tousertype(S, 1, NULL);
if (PlgMgr == NULL)
PlgMgr = (cPluginManager *)tolua_tousertype(S, 1, nullptr);
if (PlgMgr == nullptr)
{
LOGWARNING("Malformed plugin, use cPluginManager.AddHook(HOOK_TYPE, CallbackFunction). Fixing the call for you.");
S.LogStackTrace();
@ -1465,8 +1465,8 @@ static int tolua_cPluginManager_ForEachCommand(lua_State * tolua_S)
return 0;
}
cPluginManager * self = (cPluginManager *)tolua_tousertype(tolua_S, 1, NULL);
if (self == NULL)
cPluginManager * self = (cPluginManager *)tolua_tousertype(tolua_S, 1, nullptr);
if (self == nullptr)
{
LOGWARN("Error in function call 'ForEachCommand': Not called on an object instance");
return 0;
@ -1542,8 +1542,8 @@ static int tolua_cPluginManager_ForEachConsoleCommand(lua_State * tolua_S)
return 0;
}
cPluginManager * self = (cPluginManager *)tolua_tousertype(tolua_S, 1, NULL);
if (self == NULL)
cPluginManager * self = (cPluginManager *)tolua_tousertype(tolua_S, 1, nullptr);
if (self == nullptr)
{
LOGWARN("Error in function call 'ForEachConsoleCommand': Not called on an object instance");
return 0;
@ -1617,7 +1617,7 @@ static int tolua_cPluginManager_BindCommand(lua_State * L)
cPluginManager.BindCommand(Command, Permission, Function, HelpString) -- without the "self" param
*/
cPluginLua * Plugin = GetLuaPlugin(L);
if (Plugin == NULL)
if (Plugin == nullptr)
{
return 0;
}
@ -1687,7 +1687,7 @@ static int tolua_cPluginManager_BindConsoleCommand(lua_State * L)
// Get the plugin identification out of LuaState:
cPluginLua * Plugin = GetLuaPlugin(L);
if (Plugin == NULL)
if (Plugin == nullptr)
{
return 0;
}
@ -1775,7 +1775,7 @@ static int tolua_cPluginManager_CallPlugin(lua_State * tolua_S)
// If requesting calling the current plugin, refuse:
cPluginLua * ThisPlugin = GetLuaPlugin(L);
if (ThisPlugin == NULL)
if (ThisPlugin == nullptr)
{
return 0;
}
@ -1843,14 +1843,14 @@ static int tolua_cWorld_ChunkStay(lua_State * tolua_S)
}
cPluginLua * Plugin = GetLuaPlugin(tolua_S);
if (Plugin == NULL)
if (Plugin == nullptr)
{
return 0;
}
// Read the params:
cWorld * World = (cWorld *)tolua_tousertype(tolua_S, 1, NULL);
if (World == NULL)
cWorld * World = (cWorld *)tolua_tousertype(tolua_S, 1, nullptr);
if (World == nullptr)
{
LOGWARNING("World:ChunkStay(): invalid world parameter");
L.LogStackTrace();
@ -1862,7 +1862,7 @@ static int tolua_cWorld_ChunkStay(lua_State * tolua_S)
if (!ChunkStay->AddChunks(2))
{
delete ChunkStay;
ChunkStay = NULL;
ChunkStay = nullptr;
return 0;
}
@ -1889,8 +1889,8 @@ static int tolua_cPlayer_GetPermissions(lua_State * tolua_S)
}
// Get the params:
cPlayer * self = (cPlayer *)tolua_tousertype(tolua_S, 1, NULL);
if (self == NULL)
cPlayer * self = (cPlayer *)tolua_tousertype(tolua_S, 1, nullptr);
if (self == nullptr)
{
LOGWARNING("%s: invalid self (%p)", __FUNCTION__, self);
return 0;
@ -1911,15 +1911,15 @@ static int tolua_cPlayer_OpenWindow(lua_State * tolua_S)
// Retrieve the plugin instance from the Lua state
cPluginLua * Plugin = GetLuaPlugin(tolua_S);
if (Plugin == NULL)
if (Plugin == nullptr)
{
return 0;
}
// Get the parameters:
cPlayer * self = (cPlayer *)tolua_tousertype(tolua_S, 1, NULL);
cWindow * wnd = (cWindow *)tolua_tousertype(tolua_S, 2, NULL);
if ((self == NULL) || (wnd == NULL))
cPlayer * self = (cPlayer *)tolua_tousertype(tolua_S, 1, nullptr);
cWindow * wnd = (cWindow *)tolua_tousertype(tolua_S, 2, nullptr);
if ((self == nullptr) || (wnd == nullptr))
{
LOGWARNING("%s: invalid self (%p) or wnd (%p)", __FUNCTION__, self, wnd);
return 0;
@ -1992,15 +1992,15 @@ static int tolua_SetObjectCallback(lua_State * tolua_S)
// Retrieve the plugin instance from the Lua state
cPluginLua * Plugin = GetLuaPlugin(tolua_S);
if (Plugin == NULL)
if (Plugin == nullptr)
{
// Warning message has already been printed by GetLuaPlugin(), bail out silently
return 0;
}
// Get the parameters - self and the function reference:
OBJTYPE * self = (OBJTYPE *)tolua_tousertype(tolua_S, 1, NULL);
if (self == NULL)
OBJTYPE * self = (OBJTYPE *)tolua_tousertype(tolua_S, 1, nullptr);
if (self == nullptr)
{
LOGWARNING("%s: invalid self (%p)", __FUNCTION__, self);
return 0;
@ -2023,7 +2023,7 @@ static int tolua_SetObjectCallback(lua_State * tolua_S)
static int tolua_cPluginLua_AddWebTab(lua_State * tolua_S)
{
cPluginLua * self = (cPluginLua *)tolua_tousertype(tolua_S, 1, NULL);
cPluginLua * self = (cPluginLua *)tolua_tousertype(tolua_S, 1, nullptr);
tolua_Error tolua_err;
tolua_err.array = 0;
@ -2067,7 +2067,7 @@ static int tolua_cPluginLua_AddWebTab(lua_State * tolua_S)
static int tolua_cPluginLua_AddTab(lua_State* tolua_S)
{
cPluginLua * self = (cPluginLua *) tolua_tousertype(tolua_S, 1, NULL);
cPluginLua * self = (cPluginLua *) tolua_tousertype(tolua_S, 1, nullptr);
LOGWARN("WARNING: Using deprecated function AddTab()! Use AddWebTab() instead. (plugin \"%s\" in folder \"%s\")",
self->GetName().c_str(), self->GetDirectory().c_str()
);
@ -2087,7 +2087,7 @@ static int tolua_cPlugin_Call(lua_State * tolua_S)
L.LogStackTrace();
// Retrieve the params: plugin and the function name to call
cPluginLua * TargetPlugin = (cPluginLua *) tolua_tousertype(tolua_S, 1, NULL);
cPluginLua * TargetPlugin = (cPluginLua *) tolua_tousertype(tolua_S, 1, nullptr);
AString FunctionName = tolua_tostring(tolua_S, 2, "");
// Call the function:
@ -2142,7 +2142,7 @@ static int tolua_push_StringStringMap(lua_State* tolua_S, std::map< std::string,
static int tolua_get_HTTPRequest_Params(lua_State* tolua_S)
{
HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S, 1, NULL);
HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S, 1, nullptr);
return tolua_push_StringStringMap(tolua_S, self->Params);
}
@ -2152,7 +2152,7 @@ static int tolua_get_HTTPRequest_Params(lua_State* tolua_S)
static int tolua_get_HTTPRequest_PostParams(lua_State* tolua_S)
{
HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S, 1, NULL);
HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S, 1, nullptr);
return tolua_push_StringStringMap(tolua_S, self->PostParams);
}
@ -2162,7 +2162,7 @@ static int tolua_get_HTTPRequest_PostParams(lua_State* tolua_S)
static int tolua_get_HTTPRequest_FormData(lua_State* tolua_S)
{
HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S, 1, NULL);
HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S, 1, nullptr);
std::map< std::string, HTTPFormData >& FormData = self->FormData;
lua_newtable(tolua_S);
@ -2185,7 +2185,7 @@ static int tolua_get_HTTPRequest_FormData(lua_State* tolua_S)
static int tolua_cWebAdmin_GetPlugins(lua_State * tolua_S)
{
cWebAdmin * self = (cWebAdmin *)tolua_tousertype(tolua_S, 1, NULL);
cWebAdmin * self = (cWebAdmin *)tolua_tousertype(tolua_S, 1, nullptr);
const cWebAdmin::PluginList & AllPlugins = self->GetPlugins();
@ -2266,7 +2266,7 @@ static int tolua_AllToLua_cWebAdmin_GetURLEncodedString(lua_State * tolua_S)
static int tolua_cWebPlugin_GetTabNames(lua_State * tolua_S)
{
cWebPlugin* self = (cWebPlugin*) tolua_tousertype(tolua_S, 1, NULL);
cWebPlugin* self = (cWebPlugin*) tolua_tousertype(tolua_S, 1, nullptr);
const cWebPlugin::TabNameList & TabNames = self->GetTabNames();
@ -2302,8 +2302,8 @@ static int tolua_cClientHandle_SendPluginMessage(lua_State * L)
{
return 0;
}
cClientHandle * Client = (cClientHandle *)tolua_tousertype(L, 1, NULL);
if (Client == NULL)
cClientHandle * Client = (cClientHandle *)tolua_tousertype(L, 1, nullptr);
if (Client == nullptr)
{
LOGWARNING("ClientHandle is nil in cClientHandle:SendPluginMessage()");
S.LogStackTrace();
@ -2548,11 +2548,11 @@ static int Lua_ItemGrid_GetSlotCoords(lua_State * L)
}
{
const cItemGrid * self = (const cItemGrid *)tolua_tousertype(L, 1, NULL);
const cItemGrid * self = (const cItemGrid *)tolua_tousertype(L, 1, nullptr);
int SlotNum = (int)tolua_tonumber(L, 2, 0);
if (self == NULL)
if (self == nullptr)
{
tolua_error(L, "invalid 'self' in function 'cItemGrid:GetSlotCoords'", NULL);
tolua_error(L, "invalid 'self' in function 'cItemGrid:GetSlotCoords'", nullptr);
return 0;
}
int X, Y;
@ -2689,7 +2689,7 @@ static int tolua_cLineBlockTracer_Trace(lua_State * tolua_S)
}
// Trace:
cWorld * World = (cWorld *)tolua_tousertype(L, idx, NULL);
cWorld * World = (cWorld *)tolua_tousertype(L, idx, nullptr);
cLuaBlockTracerCallbacks Callbacks(L, idx + 1);
double StartX = tolua_tonumber(L, idx + 2, 0);
double StartY = tolua_tonumber(L, idx + 3, 0);
@ -2719,8 +2719,8 @@ static int tolua_cRoot_GetFurnaceRecipe(lua_State * tolua_S)
}
// Check the input param:
cItem * Input = (cItem *)tolua_tousertype(L, 2, NULL);
if (Input == NULL)
cItem * Input = (cItem *)tolua_tousertype(L, 2, nullptr);
if (Input == nullptr)
{
LOGWARNING("cRoot:GetFurnaceRecipe: the Input parameter is nil or missing.");
return 0;
@ -2729,7 +2729,7 @@ static int tolua_cRoot_GetFurnaceRecipe(lua_State * tolua_S)
// Get the recipe for the input
cFurnaceRecipe * FR = cRoot::Get()->GetFurnaceRecipe();
const cFurnaceRecipe::cRecipe * Recipe = FR->GetRecipeFrom(*Input);
if (Recipe == NULL)
if (Recipe == nullptr)
{
// There is no such furnace recipe for this input, return no value
return 0;
@ -2760,10 +2760,10 @@ static int tolua_cHopperEntity_GetOutputBlockPos(lua_State * tolua_S)
{
return 0;
}
cHopperEntity * self = (cHopperEntity *)tolua_tousertype(tolua_S, 1, NULL);
if (self == NULL)
cHopperEntity * self = (cHopperEntity *)tolua_tousertype(tolua_S, 1, nullptr);
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'cHopperEntity::GetOutputBlockPos()'", NULL);
tolua_error(tolua_S, "invalid 'self' in function 'cHopperEntity::GetOutputBlockPos()'", nullptr);
return 0;
}
@ -2800,10 +2800,10 @@ static int tolua_cBlockArea_GetBlockTypeMeta(lua_State * tolua_S)
return 0;
}
cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, NULL);
if (self == NULL)
cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, nullptr);
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'cBlockArea:GetRelBlockTypeMeta'", NULL);
tolua_error(tolua_S, "invalid 'self' in function 'cBlockArea:GetRelBlockTypeMeta'", nullptr);
return 0;
}
int BlockX = (int)tolua_tonumber(tolua_S, 2, 0);
@ -2834,10 +2834,10 @@ static int tolua_cBlockArea_GetOrigin(lua_State * tolua_S)
return 0;
}
cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, NULL);
if (self == NULL)
cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, nullptr);
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'cBlockArea:GetOrigin'", NULL);
tolua_error(tolua_S, "invalid 'self' in function 'cBlockArea:GetOrigin'", nullptr);
return 0;
}
@ -2866,10 +2866,10 @@ static int tolua_cBlockArea_GetRelBlockTypeMeta(lua_State * tolua_S)
return 0;
}
cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, NULL);
if (self == NULL)
cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, nullptr);
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'cBlockArea:GetRelBlockTypeMeta'", NULL);
tolua_error(tolua_S, "invalid 'self' in function 'cBlockArea:GetRelBlockTypeMeta'", nullptr);
return 0;
}
int BlockX = (int)tolua_tonumber(tolua_S, 2, 0);
@ -2900,10 +2900,10 @@ static int tolua_cBlockArea_GetSize(lua_State * tolua_S)
return 0;
}
cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, NULL);
if (self == NULL)
cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, nullptr);
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'cBlockArea:GetSize'", NULL);
tolua_error(tolua_S, "invalid 'self' in function 'cBlockArea:GetSize'", nullptr);
return 0;
}
@ -2931,10 +2931,10 @@ static int tolua_cBlockArea_GetCoordRange(lua_State * tolua_S)
return 0;
}
cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, NULL);
if (self == NULL)
cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, nullptr);
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'cBlockArea:GetSize'", NULL);
tolua_error(tolua_S, "invalid 'self' in function 'cBlockArea:GetSize'", nullptr);
return 0;
}
@ -2962,10 +2962,10 @@ static int tolua_cBlockArea_LoadFromSchematicFile(lua_State * tolua_S)
{
return 0;
}
cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, NULL);
if (self == NULL)
cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, nullptr);
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'cBlockArea::LoadFromSchematicFile'", NULL);
tolua_error(tolua_S, "invalid 'self' in function 'cBlockArea::LoadFromSchematicFile'", nullptr);
return 0;
}
@ -2992,10 +2992,10 @@ static int tolua_cBlockArea_LoadFromSchematicString(lua_State * tolua_S)
{
return 0;
}
cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, NULL);
if (self == NULL)
cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, nullptr);
if (self == nullptr)
{
tolua_error(tolua_S, "invalid 'self' in function 'cBlockArea::LoadFromSchematicFile'", NULL);
t