1
0
Fork 0

Converted some const char*s and std::strings to AStrings

Added a cPlayer:RemoveFromGroup() so players can be removed from groups programmatically
Added a cClientHandle:SetUsername to be used by Lua. I'm curious what ThuGie can do with his plugin.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@978 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
faketruth 2012-10-18 21:54:56 +00:00
parent c68aa68c69
commit 2a197705ac
8 changed files with 259 additions and 43 deletions

View File

@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 10/14/12 01:26:59.
** Generated automatically by tolua++-1.0.92 on 10/18/12 23:53:20.
*/
#ifndef __cplusplus
@ -3746,6 +3746,40 @@ static int tolua_AllToLua_cClientHandle_GetUsername00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
/* method: SetUsername of class cClientHandle */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_SetUsername00
static int tolua_AllToLua_cClientHandle_SetUsername00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cClientHandle",0,&tolua_err) ||
!tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cClientHandle* self = (cClientHandle*) tolua_tousertype(tolua_S,1,0);
const AString a_Username = ((const AString) tolua_tocppstring(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUsername'", NULL);
#endif
{
self->SetUsername(a_Username);
tolua_pushcppstring(tolua_S,(const char*)a_Username);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'SetUsername'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: GetPing of class cClientHandle */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_GetPing00
static int tolua_AllToLua_cClientHandle_GetPing00(lua_State* tolua_S)
@ -6592,7 +6626,7 @@ static int tolua_AllToLua_cPlayer_AddToGroup00(lua_State* tolua_S)
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) ||
!tolua_isstring(tolua_S,2,0,&tolua_err) ||
!tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
@ -6600,15 +6634,16 @@ static int tolua_AllToLua_cPlayer_AddToGroup00(lua_State* tolua_S)
#endif
{
cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0);
const char* a_GroupName = ((const char*) tolua_tostring(tolua_S,2,0));
const AString a_GroupName = ((const AString) tolua_tocppstring(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddToGroup'", NULL);
#endif
{
self->AddToGroup(a_GroupName);
tolua_pushcppstring(tolua_S,(const char*)a_GroupName);
}
}
return 0;
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'AddToGroup'.",&tolua_err);
@ -6617,6 +6652,40 @@ static int tolua_AllToLua_cPlayer_AddToGroup00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
/* method: RemoveFromGroup of class cPlayer */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_RemoveFromGroup00
static int tolua_AllToLua_cPlayer_RemoveFromGroup00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) ||
!tolua_iscppstring(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);
const AString a_GroupName = ((const AString) tolua_tocppstring(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RemoveFromGroup'", NULL);
#endif
{
self->RemoveFromGroup(a_GroupName);
tolua_pushcppstring(tolua_S,(const char*)a_GroupName);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'RemoveFromGroup'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: CanUseCommand of class cPlayer */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_CanUseCommand00
static int tolua_AllToLua_cPlayer_CanUseCommand00(lua_State* tolua_S)
@ -6625,7 +6694,7 @@ static int tolua_AllToLua_cPlayer_CanUseCommand00(lua_State* tolua_S)
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) ||
!tolua_isstring(tolua_S,2,0,&tolua_err) ||
!tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
@ -6633,16 +6702,17 @@ static int tolua_AllToLua_cPlayer_CanUseCommand00(lua_State* tolua_S)
#endif
{
cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0);
const char* a_Command = ((const char*) tolua_tostring(tolua_S,2,0));
const AString a_Command = ((const AString) tolua_tocppstring(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CanUseCommand'", NULL);
#endif
{
bool tolua_ret = (bool) self->CanUseCommand(a_Command);
tolua_pushboolean(tolua_S,(bool)tolua_ret);
tolua_pushcppstring(tolua_S,(const char*)a_Command);
}
}
return 1;
return 2;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'CanUseCommand'.",&tolua_err);
@ -6659,7 +6729,7 @@ static int tolua_AllToLua_cPlayer_HasPermission00(lua_State* tolua_S)
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) ||
!tolua_isstring(tolua_S,2,0,&tolua_err) ||
!tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
@ -6667,16 +6737,17 @@ static int tolua_AllToLua_cPlayer_HasPermission00(lua_State* tolua_S)
#endif
{
cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0);
const char* a_Permission = ((const char*) tolua_tostring(tolua_S,2,0));
const AString a_Permission = ((const AString) tolua_tocppstring(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasPermission'", NULL);
#endif
{
bool tolua_ret = (bool) self->HasPermission(a_Permission);
tolua_pushboolean(tolua_S,(bool)tolua_ret);
tolua_pushcppstring(tolua_S,(const char*)a_Permission);
}
}
return 1;
return 2;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'HasPermission'.",&tolua_err);
@ -6693,7 +6764,7 @@ static int tolua_AllToLua_cPlayer_IsInGroup00(lua_State* tolua_S)
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) ||
!tolua_isstring(tolua_S,2,0,&tolua_err) ||
!tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
@ -6701,16 +6772,17 @@ static int tolua_AllToLua_cPlayer_IsInGroup00(lua_State* tolua_S)
#endif
{
cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0);
const char* a_Group = ((const char*) tolua_tostring(tolua_S,2,0));
const AString a_Group = ((const AString) tolua_tocppstring(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInGroup'", NULL);
#endif
{
bool tolua_ret = (bool) self->IsInGroup(a_Group);
tolua_pushboolean(tolua_S,(bool)tolua_ret);
tolua_pushcppstring(tolua_S,(const char*)a_Group);
}
}
return 1;
return 2;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'IsInGroup'.",&tolua_err);
@ -19513,7 +19585,7 @@ static int tolua_AllToLua_cBlockArea_GetRelBlockType00(lua_State* tolua_S)
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) ||
!tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
!tolua_isnumber(tolua_S,4,0,&tolua_err) ||
@ -19523,7 +19595,7 @@ static int tolua_AllToLua_cBlockArea_GetRelBlockType00(lua_State* tolua_S)
else
#endif
{
cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0);
int a_RelX = ((int) tolua_tonumber(tolua_S,2,0));
int a_RelY = ((int) tolua_tonumber(tolua_S,3,0));
int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0));
@ -19551,7 +19623,7 @@ static int tolua_AllToLua_cBlockArea_GetBlockType00(lua_State* tolua_S)
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) ||
!tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
!tolua_isnumber(tolua_S,4,0,&tolua_err) ||
@ -19561,7 +19633,7 @@ static int tolua_AllToLua_cBlockArea_GetBlockType00(lua_State* tolua_S)
else
#endif
{
cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0);
int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0));
int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0));
int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0));
@ -19589,7 +19661,7 @@ static int tolua_AllToLua_cBlockArea_GetRelBlockMeta00(lua_State* tolua_S)
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) ||
!tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
!tolua_isnumber(tolua_S,4,0,&tolua_err) ||
@ -19599,7 +19671,7 @@ static int tolua_AllToLua_cBlockArea_GetRelBlockMeta00(lua_State* tolua_S)
else
#endif
{
cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0);
int a_RelX = ((int) tolua_tonumber(tolua_S,2,0));
int a_RelY = ((int) tolua_tonumber(tolua_S,3,0));
int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0));
@ -19627,7 +19699,7 @@ static int tolua_AllToLua_cBlockArea_GetBlockMeta00(lua_State* tolua_S)
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) ||
!tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
!tolua_isnumber(tolua_S,4,0,&tolua_err) ||
@ -19637,7 +19709,7 @@ static int tolua_AllToLua_cBlockArea_GetBlockMeta00(lua_State* tolua_S)
else
#endif
{
cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0);
int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0));
int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0));
int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0));
@ -19665,7 +19737,7 @@ static int tolua_AllToLua_cBlockArea_GetRelBlockLight00(lua_State* tolua_S)
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) ||
!tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
!tolua_isnumber(tolua_S,4,0,&tolua_err) ||
@ -19675,7 +19747,7 @@ static int tolua_AllToLua_cBlockArea_GetRelBlockLight00(lua_State* tolua_S)
else
#endif
{
cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0);
int a_RelX = ((int) tolua_tonumber(tolua_S,2,0));
int a_RelY = ((int) tolua_tonumber(tolua_S,3,0));
int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0));
@ -19703,7 +19775,7 @@ static int tolua_AllToLua_cBlockArea_GetBlockLight00(lua_State* tolua_S)
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) ||
!tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
!tolua_isnumber(tolua_S,4,0,&tolua_err) ||
@ -19713,7 +19785,7 @@ static int tolua_AllToLua_cBlockArea_GetBlockLight00(lua_State* tolua_S)
else
#endif
{
cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0);
int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0));
int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0));
int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0));
@ -19741,7 +19813,7 @@ static int tolua_AllToLua_cBlockArea_GetRelBlockSkyLight00(lua_State* tolua_S)
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) ||
!tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
!tolua_isnumber(tolua_S,4,0,&tolua_err) ||
@ -19751,7 +19823,7 @@ static int tolua_AllToLua_cBlockArea_GetRelBlockSkyLight00(lua_State* tolua_S)
else
#endif
{
cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0);
int a_RelX = ((int) tolua_tonumber(tolua_S,2,0));
int a_RelY = ((int) tolua_tonumber(tolua_S,3,0));
int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0));
@ -19779,7 +19851,7 @@ static int tolua_AllToLua_cBlockArea_GetBlockSkyLight00(lua_State* tolua_S)
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) ||
!tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
!tolua_isnumber(tolua_S,4,0,&tolua_err) ||
@ -19789,7 +19861,7 @@ static int tolua_AllToLua_cBlockArea_GetBlockSkyLight00(lua_State* tolua_S)
else
#endif
{
cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0);
int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0));
int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0));
int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0));
@ -19906,6 +19978,102 @@ static int tolua_AllToLua_cBlockArea_GetSizeZ00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
/* method: GetOriginX of class cBlockArea */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetOriginX00
static int tolua_AllToLua_cBlockArea_GetOriginX00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetOriginX'", NULL);
#endif
{
int tolua_ret = (int) self->GetOriginX();
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'GetOriginX'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: GetOriginY of class cBlockArea */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetOriginY00
static int tolua_AllToLua_cBlockArea_GetOriginY00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetOriginY'", NULL);
#endif
{
int tolua_ret = (int) self->GetOriginY();
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'GetOriginY'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: GetOriginZ of class cBlockArea */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetOriginZ00
static int tolua_AllToLua_cBlockArea_GetOriginZ00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetOriginZ'", NULL);
#endif
{
int tolua_ret = (int) self->GetOriginZ();
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'GetOriginZ'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: GetDataTypes of class cBlockArea */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetDataTypes00
static int tolua_AllToLua_cBlockArea_GetDataTypes00(lua_State* tolua_S)
@ -22341,6 +22509,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"GetPlayer",tolua_AllToLua_cClientHandle_GetPlayer00);
tolua_function(tolua_S,"Kick",tolua_AllToLua_cClientHandle_Kick00);
tolua_function(tolua_S,"GetUsername",tolua_AllToLua_cClientHandle_GetUsername00);
tolua_function(tolua_S,"SetUsername",tolua_AllToLua_cClientHandle_SetUsername00);
tolua_function(tolua_S,"GetPing",tolua_AllToLua_cClientHandle_GetPing00);
tolua_function(tolua_S,"SetViewDistance",tolua_AllToLua_cClientHandle_SetViewDistance00);
tolua_function(tolua_S,"GetViewDistance",tolua_AllToLua_cClientHandle_GetViewDistance00);
@ -22458,6 +22627,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"GetName",tolua_AllToLua_cPlayer_GetName00);
tolua_function(tolua_S,"SetName",tolua_AllToLua_cPlayer_SetName00);
tolua_function(tolua_S,"AddToGroup",tolua_AllToLua_cPlayer_AddToGroup00);
tolua_function(tolua_S,"RemoveFromGroup",tolua_AllToLua_cPlayer_RemoveFromGroup00);
tolua_function(tolua_S,"CanUseCommand",tolua_AllToLua_cPlayer_CanUseCommand00);
tolua_function(tolua_S,"HasPermission",tolua_AllToLua_cPlayer_HasPermission00);
tolua_function(tolua_S,"IsInGroup",tolua_AllToLua_cPlayer_IsInGroup00);
@ -23032,6 +23202,9 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"GetSizeX",tolua_AllToLua_cBlockArea_GetSizeX00);
tolua_function(tolua_S,"GetSizeY",tolua_AllToLua_cBlockArea_GetSizeY00);
tolua_function(tolua_S,"GetSizeZ",tolua_AllToLua_cBlockArea_GetSizeZ00);
tolua_function(tolua_S,"GetOriginX",tolua_AllToLua_cBlockArea_GetOriginX00);
tolua_function(tolua_S,"GetOriginY",tolua_AllToLua_cBlockArea_GetOriginY00);
tolua_function(tolua_S,"GetOriginZ",tolua_AllToLua_cBlockArea_GetOriginZ00);
tolua_function(tolua_S,"GetDataTypes",tolua_AllToLua_cBlockArea_GetDataTypes00);
tolua_function(tolua_S,"HasBlockTypes",tolua_AllToLua_cBlockArea_HasBlockTypes00);
tolua_function(tolua_S,"HasBlockMetas",tolua_AllToLua_cBlockArea_HasBlockMetas00);

View File

@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 10/14/12 01:27:00.
** Generated automatically by tolua++-1.0.92 on 10/18/12 23:53:20.
*/
/* Exported function */

View File

@ -1600,6 +1600,15 @@ const AString & cClientHandle::GetUsername(void) const
void cClientHandle::SetUsername( const AString & a_Username )
{
m_Username = a_Username;
}
void cClientHandle::SetViewDistance(int a_ViewDistance)
{
if (a_ViewDistance < MIN_VIEW_DISTANCE)

View File

@ -121,6 +121,7 @@ public:
void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ);
const AString & GetUsername(void) const; //tolua_export
void SetUsername( const AString & a_Username ); //tolua_export
inline short GetPing() const { return m_Ping; } //tolua_export

View File

@ -11,7 +11,7 @@
typedef std::map< std::string, cGroup* > GroupMap;
typedef std::map< AString, cGroup* > GroupMap;
struct cGroupManager::sGroupManagerState
{
GroupMap Groups;
@ -92,7 +92,7 @@ cGroupManager::cGroupManager()
LOG("-- Done Loading Groups --");
}
cGroup* cGroupManager::GetGroup( const char* a_Name )
cGroup* cGroupManager::GetGroup( const AString & a_Name )
{
GroupMap::iterator itr = m_pState->Groups.find( a_Name );
if( itr != m_pState->Groups.end() )

View File

@ -6,7 +6,7 @@ class cGroupManager
public:
static cGroupManager * GetGroupManager(); //tolua_export
cGroup* GetGroup( const char* a_Name );
cGroup * GetGroup( const AString & a_Name );
private:
friend class cRoot;
cGroupManager();

View File

@ -578,11 +578,11 @@ void cPlayer::SetVisible(bool a_bVisible)
void cPlayer::AddToGroup( const char* a_GroupName )
void cPlayer::AddToGroup( const AString & a_GroupName )
{
cGroup* Group = cRoot::Get()->GetGroupManager()->GetGroup( a_GroupName );
m_Groups.push_back( Group );
LOGD("Added %s to group %s", m_PlayerName.c_str(), a_GroupName );
LOGD("Added %s to group %s", m_PlayerName.c_str(), a_GroupName.c_str() );
ResolveGroups();
ResolvePermissions();
}
@ -591,7 +591,36 @@ void cPlayer::AddToGroup( const char* a_GroupName )
bool cPlayer::CanUseCommand( const char* a_Command )
void cPlayer::RemoveFromGroup( const AString & a_GroupName )
{
bool bRemoved = false;
for( GroupList::iterator itr = m_Groups.begin(); itr != m_Groups.end(); ++itr )
{
if( (*itr)->GetName().compare(a_GroupName ) == 0 )
{
m_Groups.erase( itr );
bRemoved = true;
break;
}
}
if( bRemoved )
{
LOGD("Removed %s from group %s", m_PlayerName.c_str(), a_GroupName.c_str() );
ResolveGroups();
ResolvePermissions();
}
else
{
LOGWARN("Tried to remove %s from group %s but was not in that group", m_PlayerName.c_str(), a_GroupName.c_str() );
}
}
bool cPlayer::CanUseCommand( const AString & a_Command )
{
for( GroupList::iterator itr = m_Groups.begin(); itr != m_Groups.end(); ++itr )
{
@ -604,7 +633,7 @@ bool cPlayer::CanUseCommand( const char* a_Command )
bool cPlayer::HasPermission( const char* a_Permission )
bool cPlayer::HasPermission( const AString & a_Permission )
{
AStringVector Split = StringSplit( a_Permission, "." );
PermissionMap Possibilities = m_ResolvedPermissions;
@ -640,11 +669,11 @@ bool cPlayer::HasPermission( const char* a_Permission )
bool cPlayer::IsInGroup( const char* a_Group )
bool cPlayer::IsInGroup( const AString & a_Group )
{
for( GroupList::iterator itr = m_ResolvedGroups.begin(); itr != m_ResolvedGroups.end(); ++itr )
{
if( strcmp( a_Group, (*itr)->GetName().c_str() ) == 0 )
if( a_Group.compare( (*itr)->GetName().c_str() ) == 0 )
return true;
}
return false;

View File

@ -74,12 +74,16 @@ public:
typedef std::list< cGroup* > GroupList;
typedef std::list< std::string > StringList;
void AddToGroup( const char* a_GroupName ); //tolua_export
bool CanUseCommand( const char* a_Command ); //tolua_export
bool HasPermission( const char* a_Permission ); //tolua_export
/// Adds a player to existing group or creates a new group when it doesn't exist
void AddToGroup( const AString & a_GroupName ); //tolua_export
/// Removes a player from the group, resolves permissions and group inheritance (case sensitive)
void RemoveFromGroup( const AString & a_GroupName ); //tolua_export
bool CanUseCommand( const AString & a_Command ); //tolua_export
bool HasPermission( const AString & a_Permission ); //tolua_export
const GroupList & GetGroups() { return m_Groups; } // >> EXPORTED IN MANUALBINDINGS <<
StringList GetResolvedPermissions(); // >> EXPORTED IN MANUALBINDINGS <<
bool IsInGroup( const char* a_Group ); //tolua_export
bool IsInGroup( const AString & a_Group ); //tolua_export
AString GetColor(void) const; //tolua_export