summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Bindings/ManualBindings_RankManager.cpp40
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);