Skip to content

Commit

Permalink
Fix bug in team association when no parameter is provided (PR multith…
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico8340 authored Jan 16, 2025
1 parent 6dcf52e commit af369be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Server/mods/deathmatch/logic/luadefs/CLuaTeamDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CTeam*> team) noexcept
{
return CStaticFunctionDefinitions::SetPlayerTeam(player, team);
return CStaticFunctionDefinitions::SetPlayerTeam(player, team.value_or(nullptr));
}

bool CLuaTeamDefs::SetTeamName(CTeam* team, const std::string name)
Expand Down
2 changes: 1 addition & 1 deletion Server/mods/deathmatch/logic/luadefs/CLuaTeamDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<CTeam*> 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;
Expand Down

0 comments on commit af369be

Please sign in to comment.