diff options
author | Mattes D <github@xoft.cz> | 2014-08-20 18:09:13 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-08-20 18:09:13 +0200 |
commit | 15a20b1d2aa1229c75bd626af46a0a968aefff96 (patch) | |
tree | 8b6573b695bd6fc3aff0536f5d4047b0abc8d22c /src | |
parent | RankMgr: Fixed an ignored return value in the API. (diff) | |
download | cuberite-15a20b1d2aa1229c75bd626af46a0a968aefff96.tar cuberite-15a20b1d2aa1229c75bd626af46a0a968aefff96.tar.gz cuberite-15a20b1d2aa1229c75bd626af46a0a968aefff96.tar.bz2 cuberite-15a20b1d2aa1229c75bd626af46a0a968aefff96.tar.lz cuberite-15a20b1d2aa1229c75bd626af46a0a968aefff96.tar.xz cuberite-15a20b1d2aa1229c75bd626af46a0a968aefff96.tar.zst cuberite-15a20b1d2aa1229c75bd626af46a0a968aefff96.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/ManualBindings_RankManager.cpp | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/src/Bindings/ManualBindings_RankManager.cpp b/src/Bindings/ManualBindings_RankManager.cpp index be8ad12c8..bc31ea687 100644 --- a/src/Bindings/ManualBindings_RankManager.cpp +++ b/src/Bindings/ManualBindings_RankManager.cpp @@ -399,11 +399,11 @@ static int tolua_cRankManager_GetRankGroups(lua_State * L) -/** Binds cRankManager::GetRankVisuals */ -static int tolua_cRankManager_GetRankVisuals(lua_State * L) +/** Binds cRankManager::GetRankPermissions */ +static int tolua_cRankManager_GetRankPermissions(lua_State * L) { // function signature: - // cRankManager:GetRankVisuals(RankName) -> MsgPrefix, MsgSuffix, MsgNameColorCode + // cRankManager:GetRankPermissions(RankName) -> arraytable of permissions cLuaState S(L); if ( @@ -419,26 +419,23 @@ static int tolua_cRankManager_GetRankVisuals(lua_State * L) AString RankName; S.GetStackValue(2, RankName); - // Get the visuals: - AString MsgPrefix, MsgSuffix, MsgNameColorCode; - cRoot::Get()->GetRankManager().GetRankVisuals(RankName, MsgPrefix, MsgSuffix, MsgNameColorCode); + // Get the permissions: + AStringVector Permissions = cRoot::Get()->GetRankManager().GetRankPermissions(RankName); // Push the results: - S.Push(MsgPrefix); - S.Push(MsgSuffix); - S.Push(MsgNameColorCode); - return 3; + S.Push(Permissions); + return 1; } -/** Binds cRankManager::GetRankPermissions */ -static int tolua_cRankManager_GetRankPermissions(lua_State * L) +/** Binds cRankManager::GetRankVisuals */ +static int tolua_cRankManager_GetRankVisuals(lua_State * L) { // function signature: - // cRankManager:GetRankPermissions(RankName) -> arraytable of permissions + // cRankManager:GetRankVisuals(RankName) -> MsgPrefix, MsgSuffix, MsgNameColorCode cLuaState S(L); if ( @@ -454,12 +451,19 @@ static int tolua_cRankManager_GetRankPermissions(lua_State * L) AString RankName; S.GetStackValue(2, RankName); - // Get the permissions: - AStringVector Permissions = cRoot::Get()->GetRankManager().GetRankPermissions(RankName); + // Get the visuals: + AString MsgPrefix, MsgSuffix, MsgNameColorCode; + if (!cRoot::Get()->GetRankManager().GetRankVisuals(RankName, MsgPrefix, MsgSuffix, MsgNameColorCode)) + { + // No such rank, return nothing: + return 0; + } // Push the results: - S.Push(Permissions); - return 1; + S.Push(MsgPrefix); + S.Push(MsgSuffix); + S.Push(MsgNameColorCode); + return 3; } @@ -886,8 +890,8 @@ void ManualBindings::BindRankManager(lua_State * tolua_S) tolua_function(tolua_S, "GetPlayerPermissions", tolua_cRankManager_GetPlayerPermissions); tolua_function(tolua_S, "GetPlayerRankName", tolua_cRankManager_GetPlayerRankName); tolua_function(tolua_S, "GetRankGroups", tolua_cRankManager_GetRankGroups); - tolua_function(tolua_S, "GetRankVisuals", tolua_cRankManager_GetRankVisuals); tolua_function(tolua_S, "GetRankPermissions", tolua_cRankManager_GetRankPermissions); + tolua_function(tolua_S, "GetRankVisuals", tolua_cRankManager_GetRankVisuals); tolua_function(tolua_S, "GroupExists", tolua_cRankManager_GroupExists); tolua_function(tolua_S, "IsGroupInRank", tolua_cRankManager_IsGroupInRank); tolua_function(tolua_S, "IsPermissionInGroup", tolua_cRankManager_IsPermissionInGroup); |