File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Client/mods/deathmatch/logic/luadefs Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -45,9 +45,14 @@ void CLuaTeamDefs::AddClass(lua_State* luaVM)
4545 lua_registerclass (luaVM, " Team" , " Element" );
4646}
4747
48- CClientTeam* CLuaTeamDefs::GetTeamFromName (const std::string name) noexcept
48+ std::variant< CClientTeam*, bool > CLuaTeamDefs::GetTeamFromName (const std::string name) noexcept
4949{
50- return m_pTeamManager->GetTeam (name.c_str ());
50+ CClientTeam* team = m_pTeamManager->GetTeam (name.c_str ());
51+
52+ if (!team)
53+ return false ;
54+
55+ return team;
5156}
5257
5358std::string CLuaTeamDefs::GetTeamName (CClientTeam* team) noexcept
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ class CLuaTeamDefs : public CLuaDefs
1818 static void AddClass (lua_State* luaVM);
1919
2020private:
21- static CClientTeam* GetTeamFromName (const std::string name) noexcept ;
21+ static std::variant< CClientTeam*, bool > GetTeamFromName (const std::string name) noexcept ;
2222 static std::string GetTeamName (CClientTeam* team) noexcept ;
2323 static CLuaMultiReturn<std::uint8_t , std::uint8_t , std::uint8_t > GetTeamColor (CClientTeam* team) noexcept ;
2424 static bool GetTeamFriendlyFire (CClientTeam* team) noexcept ;
You can’t perform that action at this time.
0 commit comments