Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in team association when no parameter is provided #3961

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading