Skip to content

Commit af369be

Browse files
authored
Fix bug in team association when no parameter is provided (PR #3961, Fixes #3957)
1 parent 6dcf52e commit af369be

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Server/mods/deathmatch/logic/luadefs/CLuaTeamDefs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ std::uint32_t CLuaTeamDefs::CountPlayersInTeam(CTeam* team) noexcept
127127
return team->CountPlayers();
128128
}
129129

130-
bool CLuaTeamDefs::SetPlayerTeam(CPlayer* player, CTeam* team) noexcept
130+
bool CLuaTeamDefs::SetPlayerTeam(CPlayer* player, std::optional<CTeam*> team) noexcept
131131
{
132-
return CStaticFunctionDefinitions::SetPlayerTeam(player, team);
132+
return CStaticFunctionDefinitions::SetPlayerTeam(player, team.value_or(nullptr));
133133
}
134134

135135
bool CLuaTeamDefs::SetTeamName(CTeam* team, const std::string name)

Server/mods/deathmatch/logic/luadefs/CLuaTeamDefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class CLuaTeamDefs : public CLuaDefs
3030
static std::uint32_t CountPlayersInTeam(CTeam* team) noexcept;
3131

3232
// Team set funcs
33-
static bool SetPlayerTeam(CPlayer* player, CTeam* team) noexcept;
33+
static bool SetPlayerTeam(CPlayer* player, std::optional<CTeam*> team) noexcept;
3434
static bool SetTeamName(CTeam* team, const std::string name);
3535
static bool SetTeamColor(CTeam* team, const std::uint8_t red, const std::uint8_t green, const std::uint8_t blue) noexcept;
3636
static bool SetTeamFriendlyFire(CTeam* team, const bool state) noexcept;

0 commit comments

Comments
 (0)