1
0

GetById => Get

This commit is contained in:
andrew 2014-03-02 16:24:09 +02:00
parent f40f2ad928
commit 0c87341631
4 changed files with 32 additions and 32 deletions

View File

@ -297,16 +297,16 @@ g_APIDesc =
]], ]],
Functions = Functions =
{ {
FullyOccupiesVoxel = { Params = "Type", Return = "bool", Notes = "Returns whether the specified block fully occupies its voxel." }, FullyOccupiesVoxel = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether the specified block fully occupies its voxel." },
GetById = { Params = "Type", Return = "{{cBlockInfo}}", Notes = "Returns the {{cBlockInfo}} structure for the specified type." }, Get = { Params = "Type", Return = "{{cBlockInfo}}", Notes = "(STATIC) Returns the {{cBlockInfo}} structure for the specified type." },
GetLightValue = { Params = "Type", Return = "number", Notes = "Returns how much light the specified block emits on its own." }, GetLightValue = { Params = "Type", Return = "number", Notes = "(STATIC) Returns how much light the specified block emits on its own." },
GetSpreadLightFalloff = { Params = "Type", Return = "number", Notes = "Returns how much light the specified block consumes." }, GetSpreadLightFalloff = { Params = "Type", Return = "number", Notes = "(STATIC) Returns how much light the specified block consumes." },
IsOneHitDig = { Params = "Type", Return = "bool", Notes = "Returns whether the specified block will be destroyed after a single hit." }, IsOneHitDig = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether the specified block will be destroyed after a single hit." },
IsPistonBreakable = { Params = "Type", Return = "bool", Notes = "Returns whether a piston can break the specified block." }, IsPistonBreakable = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether a piston can break the specified block." },
IsSnowable = { Params = "Type", Return = "bool", Notes = "Returns whether the specified block can hold snow atop." }, IsSnowable = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether the specified block can hold snow atop." },
IsSolid = { Params = "Type", Return = "bool", Notes = "Returns whether the specified block is solid." }, IsSolid = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether the specified block is solid." },
IsTransparent = { Params = "Type", Return = "bool", Notes = "Returns whether the specified block is transparent." }, IsTransparent = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether the specified block is transparent." },
RequiresSpecialTool = { Params = "Type", Return = "bool", Notes = "Returns whether the specified block requires a special tool to drop." }, RequiresSpecialTool = { Params = "Type", Return = "bool", Notes = "(STATIC) Returns whether the specified block requires a special tool to drop." },
}, },
Variables = Variables =
{ {

View File

@ -55,7 +55,7 @@ static int tolua_set_AllToLua_g_BlockLightValue(lua_State* tolua_S)
if (tolua_index<0) if (tolua_index<0)
tolua_error(tolua_S,"array indexing out of range.",NULL); tolua_error(tolua_S,"array indexing out of range.",NULL);
#endif #endif
cBlockInfo::GetById(tolua_index).m_LightValue = ((unsigned char) tolua_tonumber(tolua_S,3,0)); cBlockInfo::Get(tolua_index).m_LightValue = ((unsigned char) tolua_tonumber(tolua_S,3,0));
return 0; return 0;
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
@ -99,7 +99,7 @@ static int tolua_set_AllToLua_g_BlockSpreadLightFalloff(lua_State* tolua_S)
if (tolua_index<0) if (tolua_index<0)
tolua_error(tolua_S,"array indexing out of range.",NULL); tolua_error(tolua_S,"array indexing out of range.",NULL);
#endif #endif
cBlockInfo::GetById(tolua_index).m_SpreadLightFalloff = ((unsigned char) tolua_tonumber(tolua_S,3,0)); cBlockInfo::Get(tolua_index).m_SpreadLightFalloff = ((unsigned char) tolua_tonumber(tolua_S,3,0));
return 0; return 0;
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
@ -143,7 +143,7 @@ static int tolua_set_AllToLua_g_BlockTransparent(lua_State* tolua_S)
if (tolua_index<0) if (tolua_index<0)
tolua_error(tolua_S,"array indexing out of range.",NULL); tolua_error(tolua_S,"array indexing out of range.",NULL);
#endif #endif
cBlockInfo::GetById(tolua_index).m_Transparent = ((bool) tolua_toboolean(tolua_S,3,0)); cBlockInfo::Get(tolua_index).m_Transparent = ((bool) tolua_toboolean(tolua_S,3,0));
return 0; return 0;
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
@ -187,7 +187,7 @@ static int tolua_set_AllToLua_g_BlockOneHitDig(lua_State* tolua_S)
if (tolua_index<0) if (tolua_index<0)
tolua_error(tolua_S,"array indexing out of range.",NULL); tolua_error(tolua_S,"array indexing out of range.",NULL);
#endif #endif
cBlockInfo::GetById(tolua_index).m_OneHitDig = ((bool) tolua_toboolean(tolua_S,3,0)); cBlockInfo::Get(tolua_index).m_OneHitDig = ((bool) tolua_toboolean(tolua_S,3,0));
return 0; return 0;
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
@ -231,7 +231,7 @@ static int tolua_set_AllToLua_g_BlockPistonBreakable(lua_State* tolua_S)
if (tolua_index<0 || tolua_index>=256) if (tolua_index<0 || tolua_index>=256)
tolua_error(tolua_S,"array indexing out of range.",NULL); tolua_error(tolua_S,"array indexing out of range.",NULL);
#endif #endif
cBlockInfo::GetById(tolua_index).m_PistonBreakable = ((bool) tolua_toboolean(tolua_S,3,0)); cBlockInfo::Get(tolua_index).m_PistonBreakable = ((bool) tolua_toboolean(tolua_S,3,0));
return 0; return 0;
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
@ -275,7 +275,7 @@ static int tolua_set_AllToLua_g_BlockIsSnowable(lua_State* tolua_S)
if (tolua_index<0 || tolua_index>=256) if (tolua_index<0 || tolua_index>=256)
tolua_error(tolua_S,"array indexing out of range.",NULL); tolua_error(tolua_S,"array indexing out of range.",NULL);
#endif #endif
cBlockInfo::GetById(tolua_index).m_IsSnowable = ((bool) tolua_toboolean(tolua_S,3,0)); cBlockInfo::Get(tolua_index).m_IsSnowable = ((bool) tolua_toboolean(tolua_S,3,0));
return 0; return 0;
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
@ -319,7 +319,7 @@ static int tolua_set_AllToLua_g_BlockRequiresSpecialTool(lua_State* tolua_S)
if (tolua_index<0 || tolua_index>=256) if (tolua_index<0 || tolua_index>=256)
tolua_error(tolua_S,"array indexing out of range.",NULL); tolua_error(tolua_S,"array indexing out of range.",NULL);
#endif #endif
cBlockInfo::GetById(tolua_index).m_RequiresSpecialTool = ((bool) tolua_toboolean(tolua_S,3,0)); cBlockInfo::Get(tolua_index).m_RequiresSpecialTool = ((bool) tolua_toboolean(tolua_S,3,0));
return 0; return 0;
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
@ -363,7 +363,7 @@ static int tolua_set_AllToLua_g_BlockIsSolid(lua_State* tolua_S)
if (tolua_index<0 || tolua_index>=256) if (tolua_index<0 || tolua_index>=256)
tolua_error(tolua_S,"array indexing out of range.",NULL); tolua_error(tolua_S,"array indexing out of range.",NULL);
#endif #endif
cBlockInfo::GetById(tolua_index).m_IsSolid = ((bool) tolua_toboolean(tolua_S,3,0)); cBlockInfo::Get(tolua_index).m_IsSolid = ((bool) tolua_toboolean(tolua_S,3,0));
return 0; return 0;
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
@ -407,7 +407,7 @@ static int tolua_set_AllToLua_g_BlockFullyOccupiesVoxel(lua_State* tolua_S)
if (tolua_index<0 || tolua_index>=256) if (tolua_index<0 || tolua_index>=256)
tolua_error(tolua_S,"array indexing out of range.",NULL); tolua_error(tolua_S,"array indexing out of range.",NULL);
#endif #endif
cBlockInfo::GetById(tolua_index).m_FullyOccupiesVoxel = ((bool) tolua_toboolean(tolua_S,3,0)); cBlockInfo::Get(tolua_index).m_FullyOccupiesVoxel = ((bool) tolua_toboolean(tolua_S,3,0));
return 0; return 0;
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE

View File

@ -29,11 +29,11 @@ cBlockInfo::cBlockInfo()
cBlockInfo & cBlockInfo::GetById(unsigned int a_ID) cBlockInfo & cBlockInfo::Get(BLOCKTYPE a_Type)
{ {
ASSERT(a_ID < 256); ASSERT(a_Type < 256);
return ms_Info[a_ID]; return ms_Info[a_Type];
} }

View File

@ -19,7 +19,7 @@ public:
// tolua_begin // tolua_begin
/** Returns the associated BlockInfo structure. */ /** Returns the associated BlockInfo structure. */
static cBlockInfo & GetById(unsigned int a_ID); static cBlockInfo & Get(BLOCKTYPE a_Type);
/** How much light do the blocks emit on their own? */ /** How much light do the blocks emit on their own? */
@ -50,15 +50,15 @@ public:
bool m_FullyOccupiesVoxel; bool m_FullyOccupiesVoxel;
inline static NIBBLETYPE GetLightValue (unsigned int a_ID) { return GetById(a_ID).m_LightValue; } inline static NIBBLETYPE GetLightValue (BLOCKTYPE a_Type) { return Get(a_Type).m_LightValue; }
inline static NIBBLETYPE GetSpreadLightFalloff(unsigned int a_ID) { return GetById(a_ID).m_SpreadLightFalloff; } inline static NIBBLETYPE GetSpreadLightFalloff(BLOCKTYPE a_Type) { return Get(a_Type).m_SpreadLightFalloff; }
inline static bool IsTransparent (unsigned int a_ID) { return GetById(a_ID).m_Transparent; } inline static bool IsTransparent (BLOCKTYPE a_Type) { return Get(a_Type).m_Transparent; }
inline static bool IsOneHitDig (unsigned int a_ID) { return GetById(a_ID).m_OneHitDig; } inline static bool IsOneHitDig (BLOCKTYPE a_Type) { return Get(a_Type).m_OneHitDig; }
inline static bool IsPistonBreakable (unsigned int a_ID) { return GetById(a_ID).m_PistonBreakable; } inline static bool IsPistonBreakable (BLOCKTYPE a_Type) { return Get(a_Type).m_PistonBreakable; }
inline static bool IsSnowable (unsigned int a_ID) { return GetById(a_ID).m_IsSnowable; } inline static bool IsSnowable (BLOCKTYPE a_Type) { return Get(a_Type).m_IsSnowable; }
inline static bool RequiresSpecialTool (unsigned int a_ID) { return GetById(a_ID).m_RequiresSpecialTool; } inline static bool RequiresSpecialTool (BLOCKTYPE a_Type) { return Get(a_Type).m_RequiresSpecialTool; }
inline static bool IsSolid (unsigned int a_ID) { return GetById(a_ID).m_IsSolid; } inline static bool IsSolid (BLOCKTYPE a_Type) { return Get(a_Type).m_IsSolid; }
inline static bool FullyOccupiesVoxel (unsigned int a_ID) { return GetById(a_ID).m_FullyOccupiesVoxel; } inline static bool FullyOccupiesVoxel (BLOCKTYPE a_Type) { return Get(a_Type).m_FullyOccupiesVoxel; }
// tolua_end // tolua_end