From 64442b05f8aa39918f5cb75503c7f57b0bd62827 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 18 Oct 2020 16:37:07 +0100 Subject: cBlockInfo: further cleanup (#5001) * cBlockInfo: further cleanup + Use switch statements instead of lookup in dynamically initialised arrays - Remove some deprecated bindings * Update Stubs removing references to BlockInfoArray --- src/Bindings/DeprecatedBindings.cpp | 121 ------------------------------------ 1 file changed, 121 deletions(-) (limited to 'src/Bindings') diff --git a/src/Bindings/DeprecatedBindings.cpp b/src/Bindings/DeprecatedBindings.cpp index 3704551eb..d2400e7d1 100644 --- a/src/Bindings/DeprecatedBindings.cpp +++ b/src/Bindings/DeprecatedBindings.cpp @@ -292,32 +292,6 @@ tolua_lerror: -static int tolua_cBlockInfo_Get(lua_State * tolua_S) -{ - cLuaState L(tolua_S); - if ( - !L.CheckParamStaticSelf("cBlockInfo") || - !L.CheckParamNumber(2) - ) - { - return 0; - } - - BLOCKTYPE BlockType{}; - L.GetStackValue(2, BlockType); - - LOGWARNING("cBlockInfo:Get() is deprecated, use the static querying functions instead"); - L.LogStackTrace(0); - - cBlockInfo & BlockInfo = const_cast(cBlockInfo::Get(BlockType)); - L.Push(&BlockInfo); - return 1; -} - - - - - static int tolua_cBlockInfo_GetPlaceSound(lua_State * tolua_S) { cLuaState L(tolua_S); @@ -339,85 +313,6 @@ static int tolua_cBlockInfo_GetPlaceSound(lua_State * tolua_S) -static int tolua_get_cBlockInfo_m_PlaceSound(lua_State * tolua_S) -{ - cLuaState L(tolua_S); - if (!L.CheckParamSelf("const cBlockInfo")) - { - return 0; - } - - L.Push(""); - LOGWARNING("cBlockInfo.m_PlaceSound is deprecated"); - L.LogStackTrace(0); - return 1; -} - - - - - -static int tolua_set_cBlockInfo_m_PlaceSound(lua_State * tolua_S) -{ - cLuaState L(tolua_S); - if (!L.CheckParamSelf("cBlockInfo")) - { - return 0; - } - - LOGWARNING("cBlockInfo.m_PlaceSound is deprecated"); - L.LogStackTrace(0); - return 0; -} - - - - - -/** cBlockInfo variables: access the corresponding getter function instead of the variable. -\tparam VariableType The type of the variable being accessed. -\tparam GetterFunction The function called to get the value returned to lua. */ -template -static int tolua_get_cBlockInfo(lua_State * tolua_S) -{ - cLuaState L(tolua_S); - if (!L.CheckParamSelf("const cBlockInfo")) - { - return 0; - } - - const cBlockInfo * Self = nullptr; - L.GetStackValue(1, Self); - - L.Push(GetterFunction(Self->m_BlockType)); - LOGWARNING("cBlockInfo variables are deprecated, use the static functions instead."); - L.LogStackTrace(0); - - return 1; -} - - - - - -/** cBlockInfo variables: Print deprecation message on assignment. */ -static int tolua_set_cBlockInfo(lua_State * tolua_S) -{ - cLuaState L(tolua_S); - if (!L.CheckParamSelf("cBlockInfo")) - { - return 0; - } - - LOGWARNING("cBlockInfo variables are deprecated in favour of the static functions."); - L.LogStackTrace(0); - return 0; -} - - - - - static int tolua_get_cItem_m_Lore(lua_State * tolua_S) { // Maintain legacy m_Lore variable as Lore table split by ` (grave-accent) @@ -785,23 +680,7 @@ void DeprecatedBindings::Bind(lua_State * tolua_S) tolua_function(tolua_S, "StringToMobType", tolua_AllToLua_StringToMobType00); tolua_beginmodule(tolua_S, "cBlockInfo"); - tolua_function(tolua_S, "Get", tolua_cBlockInfo_Get); tolua_function(tolua_S, "GetPlaceSound", tolua_cBlockInfo_GetPlaceSound); - tolua_variable(tolua_S, "m_PlaceSound", tolua_get_cBlockInfo_m_PlaceSound, tolua_set_cBlockInfo_m_PlaceSound); - tolua_variable(tolua_S, "m_LightValue", tolua_get_cBlockInfo, tolua_set_cBlockInfo); - tolua_variable(tolua_S, "m_SpreadLightFalloff", tolua_get_cBlockInfo, tolua_set_cBlockInfo); - tolua_variable(tolua_S, "m_Transparent", tolua_get_cBlockInfo, tolua_set_cBlockInfo); - tolua_variable(tolua_S, "m_OneHitDig", tolua_get_cBlockInfo, tolua_set_cBlockInfo); - tolua_variable(tolua_S, "m_PistonBreakable", tolua_get_cBlockInfo, tolua_set_cBlockInfo); - tolua_variable(tolua_S, "m_IsRainBlocker", tolua_get_cBlockInfo, tolua_set_cBlockInfo); - tolua_variable(tolua_S, "m_IsSkylightDispersant", tolua_get_cBlockInfo, tolua_set_cBlockInfo); - tolua_variable(tolua_S, "m_IsSnowable", tolua_get_cBlockInfo, tolua_set_cBlockInfo); - tolua_variable(tolua_S, "m_IsSolid", tolua_get_cBlockInfo, tolua_set_cBlockInfo); - tolua_variable(tolua_S, "m_UseableBySpectator", tolua_get_cBlockInfo, tolua_set_cBlockInfo); - tolua_variable(tolua_S, "m_FullyOccupiesVoxel", tolua_get_cBlockInfo, tolua_set_cBlockInfo); - tolua_variable(tolua_S, "m_CanBeTerraformed", tolua_get_cBlockInfo, tolua_set_cBlockInfo); - tolua_variable(tolua_S, "m_BlockHeight", tolua_get_cBlockInfo, tolua_set_cBlockInfo); - tolua_variable(tolua_S, "m_Hardness", tolua_get_cBlockInfo, tolua_set_cBlockInfo); tolua_endmodule(tolua_S); tolua_beginmodule(tolua_S, "cItem"); -- cgit v1.2.3