Skip to content

Commit

Permalink
Inline rank check
Browse files Browse the repository at this point in the history
  • Loading branch information
ramon-bernardo committed May 26, 2024
1 parent a701a70 commit b46b700
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/luascript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9771,8 +9771,7 @@ int LuaScriptInterface::luaPlayerSetGuildLevel(lua_State* L)
}

uint8_t level = getNumber<uint8_t>(L, 2);
auto rank = guild->getRankByLevel(level);
if (rank) {
if (auto rank = guild->getRankByLevel(level)) {
player->setGuildRank(rank);
pushBoolean(L, true);
} else {
Expand Down Expand Up @@ -11875,8 +11874,7 @@ int LuaScriptInterface::luaGuildGetRankById(lua_State* L)
}

uint32_t id = getNumber<uint32_t>(L, 2);
auto rank = guild->getRankById(id);
if (rank) {
if (auto rank = guild->getRankById(id)) {
lua_createtable(L, 0, 3);
setField(L, "id", rank->id);
setField(L, "name", rank->name);
Expand All @@ -11897,8 +11895,7 @@ int LuaScriptInterface::luaGuildGetRankByLevel(lua_State* L)
}

uint8_t level = getNumber<uint8_t>(L, 2);
auto rank = guild->getRankByLevel(level);
if (rank) {
if (auto rank = guild->getRankByLevel(level)) {
lua_createtable(L, 0, 3);
setField(L, "id", rank->id);
setField(L, "name", rank->name);
Expand Down

0 comments on commit b46b700

Please sign in to comment.