From af369be7969cf5cf4ea0e0bb35877b85136332ea Mon Sep 17 00:00:00 2001 From: Nico <122193236+Nico8340@users.noreply.github.com> Date: Thu, 16 Jan 2025 02:22:08 +0100 Subject: [PATCH] Fix bug in team association when no parameter is provided (PR #3961, Fixes #3957) --- Server/mods/deathmatch/logic/luadefs/CLuaTeamDefs.cpp | 4 ++-- Server/mods/deathmatch/logic/luadefs/CLuaTeamDefs.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaTeamDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaTeamDefs.cpp index df445b5a2b..65c3fad376 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaTeamDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaTeamDefs.cpp @@ -127,9 +127,9 @@ std::uint32_t CLuaTeamDefs::CountPlayersInTeam(CTeam* team) noexcept return team->CountPlayers(); } -bool CLuaTeamDefs::SetPlayerTeam(CPlayer* player, CTeam* team) noexcept +bool CLuaTeamDefs::SetPlayerTeam(CPlayer* player, std::optional team) noexcept { - return CStaticFunctionDefinitions::SetPlayerTeam(player, team); + return CStaticFunctionDefinitions::SetPlayerTeam(player, team.value_or(nullptr)); } bool CLuaTeamDefs::SetTeamName(CTeam* team, const std::string name) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaTeamDefs.h b/Server/mods/deathmatch/logic/luadefs/CLuaTeamDefs.h index 7b6c6f21c2..985cc4576e 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaTeamDefs.h +++ b/Server/mods/deathmatch/logic/luadefs/CLuaTeamDefs.h @@ -30,7 +30,7 @@ class CLuaTeamDefs : public CLuaDefs static std::uint32_t CountPlayersInTeam(CTeam* team) noexcept; // Team set funcs - static bool SetPlayerTeam(CPlayer* player, CTeam* team) noexcept; + static bool SetPlayerTeam(CPlayer* player, std::optional team) noexcept; static bool SetTeamName(CTeam* team, const std::string name); static bool SetTeamColor(CTeam* team, const std::uint8_t red, const std::uint8_t green, const std::uint8_t blue) noexcept; static bool SetTeamFriendlyFire(CTeam* team, const bool state) noexcept;