From e80c5eac4041e6e6b2c1bbc8fe67278768098a7a Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 19 Aug 2013 11:44:11 +0200 Subject: Added cPickup:GetAge() the the Lua API. --- source/Bindings.cpp | 35 ++++++++++++++++++++++++++++++++++- source/Bindings.h | 2 +- source/Entities/Pickup.h | 5 ++--- 3 files changed, 37 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/Bindings.cpp b/source/Bindings.cpp index 3ab85d223..4e98e984c 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 08/19/13 10:28:26. +** Generated automatically by tolua++-1.0.92 on 08/19/13 11:43:38. */ #ifndef __cplusplus @@ -18043,6 +18043,38 @@ static int tolua_AllToLua_cPickup_CollectedBy00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: GetAge of class cPickup */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_GetAge00 +static int tolua_AllToLua_cPickup_GetAge00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPickup",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPickup* self = (const cPickup*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetAge'", NULL); +#endif + { + int tolua_ret = (int) self->GetAge(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetAge'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* get function: m_PrimaryServerVersion of class cRoot */ #ifndef TOLUA_DISABLE_tolua_get_cRoot_m_PrimaryServerVersion static int tolua_get_cRoot_m_PrimaryServerVersion(lua_State* tolua_S) @@ -28399,6 +28431,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,".call",tolua_AllToLua_cPickup_new00_local); tolua_function(tolua_S,"GetItem",tolua_AllToLua_cPickup_GetItem00); tolua_function(tolua_S,"CollectedBy",tolua_AllToLua_cPickup_CollectedBy00); + tolua_function(tolua_S,"GetAge",tolua_AllToLua_cPickup_GetAge00); tolua_endmodule(tolua_S); tolua_cclass(tolua_S,"cRoot","cRoot","",NULL); tolua_beginmodule(tolua_S,"cRoot"); diff --git a/source/Bindings.h b/source/Bindings.h index c0448f943..72a979d0b 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 08/19/13 10:28:26. +** Generated automatically by tolua++-1.0.92 on 08/19/13 11:43:39. */ /* Exported function */ diff --git a/source/Entities/Pickup.h b/source/Entities/Pickup.h index 1f32c97b5..90292dcb8 100644 --- a/source/Entities/Pickup.h +++ b/source/Entities/Pickup.h @@ -37,16 +37,15 @@ public: virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - short GetHealth(void) const { return m_Health; } - /// Returns the number of ticks that this entity has existed - short GetAge(void) const { return (short)(m_Timer / 50); } + int GetAge(void) const { return (int)(m_Timer / 50); } // tolua_export private: Vector3d m_ResultingSpeed; //Can be used to modify the resulting speed for the current tick ;) Vector3d m_WaterSpeed; + /// The number of ticks that the entity has existed / timer between collect and destroy; in msec float m_Timer; cItem m_Item; -- cgit v1.2.3