Merge commit 'ceaebd00d88fe70516c7b4ef1fa84d2f5f10d736' into pullstream
This commit is contained in:
commit
651b4ab127
@ -12292,7 +12292,7 @@ end
|
||||
Type = "cTeam",
|
||||
},
|
||||
},
|
||||
Notes = "Registers a new team. Returns the {{cTeam}} instance, nil on error.",
|
||||
Notes = "Registers a new team. Returns the {{cTeam}} instance, nil on error. For example if the team already exists.",
|
||||
},
|
||||
RemoveObjective =
|
||||
{
|
||||
|
@ -377,11 +377,15 @@ cTeam * cScoreboard::RegisterTeam(
|
||||
const AString & a_Prefix, const AString & a_Suffix
|
||||
)
|
||||
{
|
||||
cTeam Team(a_Name, a_DisplayName, a_Prefix, a_Suffix);
|
||||
auto [TeamIterator, TeamExists] = m_Teams.try_emplace(a_Name, a_Name, a_DisplayName, a_Prefix, a_Suffix);
|
||||
|
||||
std::pair<cTeamMap::iterator, bool> Status = m_Teams.insert(cNamedTeam(a_Name, Team));
|
||||
if (!TeamExists && GetTeam(a_Name))
|
||||
{
|
||||
LOGWARNING("Tried to register a team that already exists: %s", a_Name.c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Status.second ? &Status.first->second : nullptr;
|
||||
return &TeamIterator->second;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user