From 2cca4d70c8b3908bcd692fffb937c0fa6b5b29a3 Mon Sep 17 00:00:00 2001 From: Howaner Date: Wed, 20 Aug 2014 16:04:18 +0200 Subject: Cleaned up code. --- src/Bindings/LuaState_Call.inc | 847 ------------------------------------- src/Bindings/gen_LuaState_Call.lua | 1 + src/Protocol/Protocol17x.cpp | 1 - 3 files changed, 1 insertion(+), 848 deletions(-) delete mode 100644 src/Bindings/LuaState_Call.inc diff --git a/src/Bindings/LuaState_Call.inc b/src/Bindings/LuaState_Call.inc deleted file mode 100644 index 810b0551b..000000000 --- a/src/Bindings/LuaState_Call.inc +++ /dev/null @@ -1,847 +0,0 @@ -// LuaState_Call.inc - -// This file is auto-generated by gen_LuaState_Call.lua -// Make changes to the generator instead of to this file! - -// This file contains the various overloads for the cLuaState::Call() function -// Each overload handles a different number of parameters / return values - - - - - -/** Call the specified 0-param 0-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function) -{ - if (!PushFunction(a_Function)) - { - return false; - } - if (!CallFunction(0)) - { - return false; - } - return true; -} - - - - - -/** Call the specified 1-param 0-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1) -{ - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - if (!CallFunction(0)) - { - return false; - } - return true; -} - - - - - -/** Call the specified 2-param 0-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2) -{ - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - if (!CallFunction(0)) - { - return false; - } - return true; -} - - - - - -/** Call the specified 3-param 0-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3) -{ - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - if (!CallFunction(0)) - { - return false; - } - return true; -} - - - - - -/** Call the specified 4-param 0-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, ParamT4 a_Param4) -{ - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - Push(a_Param4); - if (!CallFunction(0)) - { - return false; - } - return true; -} - - - - - -/** Call the specified 0-param 1-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - if (!CallFunction(1)) - { - return false; - } - GetStackValue(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; -} - - - - - -/** Call the specified 1-param 1-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - if (!CallFunction(1)) - { - return false; - } - GetStackValue(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; -} - - - - - -/** Call the specified 2-param 1-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - if (!CallFunction(1)) - { - return false; - } - GetStackValue(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; -} - - - - - -/** Call the specified 3-param 1-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - if (!CallFunction(1)) - { - return false; - } - GetStackValue(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; -} - - - - - -/** Call the specified 4-param 1-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, ParamT4 a_Param4, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - Push(a_Param4); - if (!CallFunction(1)) - { - return false; - } - GetStackValue(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; -} - - - - - -/** Call the specified 5-param 1-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, ParamT4 a_Param4, ParamT5 a_Param5, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - Push(a_Param4); - Push(a_Param5); - if (!CallFunction(1)) - { - return false; - } - GetStackValue(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; -} - - - - - -/** Call the specified 6-param 1-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, ParamT4 a_Param4, ParamT5 a_Param5, ParamT6 a_Param6, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - Push(a_Param4); - Push(a_Param5); - Push(a_Param6); - if (!CallFunction(1)) - { - return false; - } - GetStackValue(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; -} - - - - - -/** Call the specified 7-param 1-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, ParamT4 a_Param4, ParamT5 a_Param5, ParamT6 a_Param6, ParamT7 a_Param7, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - Push(a_Param4); - Push(a_Param5); - Push(a_Param6); - Push(a_Param7); - if (!CallFunction(1)) - { - return false; - } - GetStackValue(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; -} - - - - - -/** Call the specified 8-param 1-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, ParamT4 a_Param4, ParamT5 a_Param5, ParamT6 a_Param6, ParamT7 a_Param7, ParamT8 a_Param8, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - Push(a_Param4); - Push(a_Param5); - Push(a_Param6); - Push(a_Param7); - Push(a_Param8); - if (!CallFunction(1)) - { - return false; - } - GetStackValue(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; -} - - - - - -/** Call the specified 9-param 1-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, ParamT4 a_Param4, ParamT5 a_Param5, ParamT6 a_Param6, ParamT7 a_Param7, ParamT8 a_Param8, ParamT9 a_Param9, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - Push(a_Param4); - Push(a_Param5); - Push(a_Param6); - Push(a_Param7); - Push(a_Param8); - Push(a_Param9); - if (!CallFunction(1)) - { - return false; - } - GetStackValue(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; -} - - - - - -/** Call the specified 10-param 1-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, ParamT4 a_Param4, ParamT5 a_Param5, ParamT6 a_Param6, ParamT7 a_Param7, ParamT8 a_Param8, ParamT9 a_Param9, ParamT10 a_Param10, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - Push(a_Param4); - Push(a_Param5); - Push(a_Param6); - Push(a_Param7); - Push(a_Param8); - Push(a_Param9); - Push(a_Param10); - if (!CallFunction(1)) - { - return false; - } - GetStackValue(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; -} - - - - - -/** Call the specified 0-param 2-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1, RetT2 & a_Ret2) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - if (!CallFunction(2)) - { - return false; - } - GetStackValue(-2, a_Ret1); - GetStackValue(-1, a_Ret2); - lua_pop(m_LuaState, 2); - return true; -} - - - - - -/** Call the specified 1-param 2-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1, RetT2 & a_Ret2) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - if (!CallFunction(2)) - { - return false; - } - GetStackValue(-2, a_Ret1); - GetStackValue(-1, a_Ret2); - lua_pop(m_LuaState, 2); - return true; -} - - - - - -/** Call the specified 2-param 2-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1, RetT2 & a_Ret2) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - if (!CallFunction(2)) - { - return false; - } - GetStackValue(-2, a_Ret1); - GetStackValue(-1, a_Ret2); - lua_pop(m_LuaState, 2); - return true; -} - - - - - -/** Call the specified 3-param 2-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1, RetT2 & a_Ret2) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - if (!CallFunction(2)) - { - return false; - } - GetStackValue(-2, a_Ret1); - GetStackValue(-1, a_Ret2); - lua_pop(m_LuaState, 2); - return true; -} - - - - - -/** Call the specified 4-param 2-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, ParamT4 a_Param4, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1, RetT2 & a_Ret2) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - Push(a_Param4); - if (!CallFunction(2)) - { - return false; - } - GetStackValue(-2, a_Ret1); - GetStackValue(-1, a_Ret2); - lua_pop(m_LuaState, 2); - return true; -} - - - - - -/** Call the specified 5-param 2-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, ParamT4 a_Param4, ParamT5 a_Param5, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1, RetT2 & a_Ret2) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - Push(a_Param4); - Push(a_Param5); - if (!CallFunction(2)) - { - return false; - } - GetStackValue(-2, a_Ret1); - GetStackValue(-1, a_Ret2); - lua_pop(m_LuaState, 2); - return true; -} - - - - - -/** Call the specified 6-param 2-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, ParamT4 a_Param4, ParamT5 a_Param5, ParamT6 a_Param6, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1, RetT2 & a_Ret2) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - Push(a_Param4); - Push(a_Param5); - Push(a_Param6); - if (!CallFunction(2)) - { - return false; - } - GetStackValue(-2, a_Ret1); - GetStackValue(-1, a_Ret2); - lua_pop(m_LuaState, 2); - return true; -} - - - - - -/** Call the specified 7-param 2-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, ParamT4 a_Param4, ParamT5 a_Param5, ParamT6 a_Param6, ParamT7 a_Param7, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1, RetT2 & a_Ret2) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - Push(a_Param4); - Push(a_Param5); - Push(a_Param6); - Push(a_Param7); - if (!CallFunction(2)) - { - return false; - } - GetStackValue(-2, a_Ret1); - GetStackValue(-1, a_Ret2); - lua_pop(m_LuaState, 2); - return true; -} - - - - - -/** Call the specified 8-param 2-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, ParamT4 a_Param4, ParamT5 a_Param5, ParamT6 a_Param6, ParamT7 a_Param7, ParamT8 a_Param8, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1, RetT2 & a_Ret2) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - Push(a_Param4); - Push(a_Param5); - Push(a_Param6); - Push(a_Param7); - Push(a_Param8); - if (!CallFunction(2)) - { - return false; - } - GetStackValue(-2, a_Ret1); - GetStackValue(-1, a_Ret2); - lua_pop(m_LuaState, 2); - return true; -} - - - - - -/** Call the specified 9-param 2-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, ParamT4 a_Param4, ParamT5 a_Param5, ParamT6 a_Param6, ParamT7 a_Param7, ParamT8 a_Param8, ParamT9 a_Param9, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1, RetT2 & a_Ret2) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - Push(a_Param4); - Push(a_Param5); - Push(a_Param6); - Push(a_Param7); - Push(a_Param8); - Push(a_Param9); - if (!CallFunction(2)) - { - return false; - } - GetStackValue(-2, a_Ret1); - GetStackValue(-1, a_Ret2); - lua_pop(m_LuaState, 2); - return true; -} - - - - - -/** Call the specified 7-param 3-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, ParamT4 a_Param4, ParamT5 a_Param5, ParamT6 a_Param6, ParamT7 a_Param7, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - Push(a_Param4); - Push(a_Param5); - Push(a_Param6); - Push(a_Param7); - if (!CallFunction(3)) - { - return false; - } - GetStackValue(-3, a_Ret1); - GetStackValue(-2, a_Ret2); - GetStackValue(-1, a_Ret3); - lua_pop(m_LuaState, 3); - return true; -} - - - - - -/** Call the specified 8-param 3-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, ParamT4 a_Param4, ParamT5 a_Param5, ParamT6 a_Param6, ParamT7 a_Param7, ParamT8 a_Param8, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - Push(a_Param4); - Push(a_Param5); - Push(a_Param6); - Push(a_Param7); - Push(a_Param8); - if (!CallFunction(3)) - { - return false; - } - GetStackValue(-3, a_Ret1); - GetStackValue(-2, a_Ret2); - GetStackValue(-1, a_Ret3); - lua_pop(m_LuaState, 3); - return true; -} - - - - - -/** Call the specified 4-param 5-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, ParamT4 a_Param4, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3, RetT4 & a_Ret4, RetT5 & a_Ret5) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - Push(a_Param4); - if (!CallFunction(5)) - { - return false; - } - GetStackValue(-5, a_Ret1); - GetStackValue(-4, a_Ret2); - GetStackValue(-3, a_Ret3); - GetStackValue(-2, a_Ret4); - GetStackValue(-1, a_Ret5); - lua_pop(m_LuaState, 5); - return true; -} - - - - - -/** Call the specified 9-param 5-return Lua function: -Returns true if call succeeded, false if there was an error. */ -template -bool Call(FnT a_Function, ParamT1 a_Param1, ParamT2 a_Param2, ParamT3 a_Param3, ParamT4 a_Param4, ParamT5 a_Param5, ParamT6 a_Param6, ParamT7 a_Param7, ParamT8 a_Param8, ParamT9 a_Param9, const cLuaState::cRet & a_RetMark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3, RetT4 & a_Ret4, RetT5 & a_Ret5) -{ - UNUSED(a_RetMark); - if (!PushFunction(a_Function)) - { - return false; - } - Push(a_Param1); - Push(a_Param2); - Push(a_Param3); - Push(a_Param4); - Push(a_Param5); - Push(a_Param6); - Push(a_Param7); - Push(a_Param8); - Push(a_Param9); - if (!CallFunction(5)) - { - return false; - } - GetStackValue(-5, a_Ret1); - GetStackValue(-4, a_Ret2); - GetStackValue(-3, a_Ret3); - GetStackValue(-2, a_Ret4); - GetStackValue(-1, a_Ret5); - lua_pop(m_LuaState, 5); - return true; -} - - - - - diff --git a/src/Bindings/gen_LuaState_Call.lua b/src/Bindings/gen_LuaState_Call.lua index 17bae82b3..41b3e3068 100644 --- a/src/Bindings/gen_LuaState_Call.lua +++ b/src/Bindings/gen_LuaState_Call.lua @@ -56,6 +56,7 @@ local Combinations = -- Special combinations: {7, 3}, {8, 3}, + {4, 5}, {9, 5}, } diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 31a140c73..0a9d70bcc 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -42,7 +42,6 @@ Implements the 1.7.x protocol classes: #include "../BlockEntities/MobHeadEntity.h" #include "../BlockEntities/FlowerPotEntity.h" #include "Bindings/PluginManager.h" -#include "lua/src/llex.h" -- cgit v1.2.3