From 359539293782713d47e51775b65ee91fc89994e4 Mon Sep 17 00:00:00 2001 From: Daniel O'Brien Date: Sat, 16 Nov 2013 21:38:57 +1100 Subject: fixed bug and added SpendExperience() --- source/Bindings.cpp | 127 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 98 insertions(+), 29 deletions(-) (limited to 'source/Bindings.cpp') diff --git a/source/Bindings.cpp b/source/Bindings.cpp index be0bbd8af..a03ee37e0 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 11/16/13 02:20:34. +** Generated automatically by tolua++-1.0.92 on 11/16/13 21:19:32. */ #ifndef __cplusplus @@ -7650,9 +7650,9 @@ static int tolua_AllToLua_cEntity_IsInvisible00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE -/* method: SetExperience of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetExperience00 -static int tolua_AllToLua_cPlayer_SetExperience00(lua_State* tolua_S) +/* method: SetCurrentExperience of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetCurrentExperience00 +static int tolua_AllToLua_cPlayer_SetCurrentExperience00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; @@ -7668,17 +7668,17 @@ static int tolua_AllToLua_cPlayer_SetExperience00(lua_State* tolua_S) cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); short a_XpTotal = ((short) tolua_tonumber(tolua_S,2,0)); #ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetExperience'", NULL); + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetCurrentExperience'", NULL); #endif { - bool tolua_ret = (bool) self->SetExperience(a_XpTotal); + bool tolua_ret = (bool) self->SetCurrentExperience(a_XpTotal); tolua_pushboolean(tolua_S,(bool)tolua_ret); } } return 1; #ifndef TOLUA_RELEASE tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetExperience'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'SetCurrentExperience'.",&tolua_err); return 0; #endif } @@ -7718,9 +7718,75 @@ static int tolua_AllToLua_cPlayer_AddExperience00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE -/* method: XpGetTotal of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_XpGetTotal00 -static int tolua_AllToLua_cPlayer_XpGetTotal00(lua_State* tolua_S) +/* method: SpendExperience of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SpendExperience00 +static int tolua_AllToLua_cPlayer_SpendExperience00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + short a_Xp_delta = ((short) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SpendExperience'", NULL); +#endif + { + short tolua_ret = (short) self->SpendExperience(a_Xp_delta); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SpendExperience'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetXpLifetimeTotal of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetXpLifetimeTotal00 +static int tolua_AllToLua_cPlayer_GetXpLifetimeTotal00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetXpLifetimeTotal'", NULL); +#endif + { + short tolua_ret = (short) self->GetXpLifetimeTotal(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetXpLifetimeTotal'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetCurrentXp of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetCurrentXp00 +static int tolua_AllToLua_cPlayer_GetCurrentXp00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; @@ -7734,25 +7800,25 @@ static int tolua_AllToLua_cPlayer_XpGetTotal00(lua_State* tolua_S) { cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); #ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'XpGetTotal'", NULL); + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetCurrentXp'", NULL); #endif { - short tolua_ret = (short) self->XpGetTotal(); + short tolua_ret = (short) self->GetCurrentXp(); tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); } } return 1; #ifndef TOLUA_RELEASE tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'XpGetTotal'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'GetCurrentXp'.",&tolua_err); return 0; #endif } #endif //#ifndef TOLUA_DISABLE -/* method: XpGetLevel of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_XpGetLevel00 -static int tolua_AllToLua_cPlayer_XpGetLevel00(lua_State* tolua_S) +/* method: GetXpLevel of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetXpLevel00 +static int tolua_AllToLua_cPlayer_GetXpLevel00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; @@ -7766,25 +7832,25 @@ static int tolua_AllToLua_cPlayer_XpGetLevel00(lua_State* tolua_S) { cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); #ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'XpGetLevel'", NULL); + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetXpLevel'", NULL); #endif { - short tolua_ret = (short) self->XpGetLevel(); + short tolua_ret = (short) self->GetXpLevel(); tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); } } return 1; #ifndef TOLUA_RELEASE tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'XpGetLevel'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'GetXpLevel'.",&tolua_err); return 0; #endif } #endif //#ifndef TOLUA_DISABLE -/* method: XpGetPercentage of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_XpGetPercentage00 -static int tolua_AllToLua_cPlayer_XpGetPercentage00(lua_State* tolua_S) +/* method: GetXpPercentage of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetXpPercentage00 +static int tolua_AllToLua_cPlayer_GetXpPercentage00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; @@ -7798,17 +7864,17 @@ static int tolua_AllToLua_cPlayer_XpGetPercentage00(lua_State* tolua_S) { cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); #ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'XpGetPercentage'", NULL); + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetXpPercentage'", NULL); #endif { - float tolua_ret = (float) self->XpGetPercentage(); + float tolua_ret = (float) self->GetXpPercentage(); tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); } } return 1; #ifndef TOLUA_RELEASE tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'XpGetPercentage'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'GetXpPercentage'.",&tolua_err); return 0; #endif } @@ -30417,11 +30483,14 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_constant(tolua_S,"EATING_TICKS",cPlayer::EATING_TICKS); tolua_constant(tolua_S,"MAX_AIR_LEVEL",cPlayer::MAX_AIR_LEVEL); tolua_constant(tolua_S,"DROWNING_TICKS",cPlayer::DROWNING_TICKS); - tolua_function(tolua_S,"SetExperience",tolua_AllToLua_cPlayer_SetExperience00); + tolua_constant(tolua_S,"MIN_EXPERIENCE",cPlayer::MIN_EXPERIENCE); + tolua_function(tolua_S,"SetCurrentExperience",tolua_AllToLua_cPlayer_SetCurrentExperience00); tolua_function(tolua_S,"AddExperience",tolua_AllToLua_cPlayer_AddExperience00); - tolua_function(tolua_S,"XpGetTotal",tolua_AllToLua_cPlayer_XpGetTotal00); - tolua_function(tolua_S,"XpGetLevel",tolua_AllToLua_cPlayer_XpGetLevel00); - tolua_function(tolua_S,"XpGetPercentage",tolua_AllToLua_cPlayer_XpGetPercentage00); + tolua_function(tolua_S,"SpendExperience",tolua_AllToLua_cPlayer_SpendExperience00); + tolua_function(tolua_S,"GetXpLifetimeTotal",tolua_AllToLua_cPlayer_GetXpLifetimeTotal00); + tolua_function(tolua_S,"GetCurrentXp",tolua_AllToLua_cPlayer_GetCurrentXp00); + tolua_function(tolua_S,"GetXpLevel",tolua_AllToLua_cPlayer_GetXpLevel00); + tolua_function(tolua_S,"GetXpPercentage",tolua_AllToLua_cPlayer_GetXpPercentage00); tolua_function(tolua_S,"GetEyeHeight",tolua_AllToLua_cPlayer_GetEyeHeight00); tolua_function(tolua_S,"GetEyePosition",tolua_AllToLua_cPlayer_GetEyePosition00); tolua_function(tolua_S,"IsOnGround",tolua_AllToLua_cPlayer_IsOnGround00); -- cgit v1.2.3