#include <C4Teams.h>
Public Types | |
enum | ConfigValue { TEAM_None = 0 , TEAM_Custom = 1 , TEAM_Active = 2 , TEAM_AllowHostilityChange = 3 , TEAM_Dist = 4 , TEAM_AllowTeamSwitch = 5 , TEAM_AutoGenerateTeams = 6 , TEAM_TeamColors = 7 } |
enum | TeamDist { TEAMDIST_First = 0 , TEAMDIST_Free = 0 , TEAMDIST_Host = 1 , TEAMDIST_None = 2 , TEAMDIST_Random = 3 , TEAMDIST_RandomInv = 4 , TEAMDIST_Last = 4 } |
Public Member Functions | |
C4TeamList ()=default | |
~C4TeamList () | |
void | Clear () |
C4TeamList & | operator= (const C4TeamList &rCopy) |
C4Team * | GetTeamByID (int32_t iID) const |
C4Team * | GetGenerateTeamByID (int32_t iID) |
C4Team * | GetTeamByIndex (int32_t iIndex) const |
C4Team * | GetTeamByName (const char *szName) const |
C4Team * | GetTeamByPlayerID (int32_t iID) const |
int32_t | GetLargestTeamID () const |
C4Team * | GetRandomSmallestTeam () const |
int32_t | GetTeamCount () const |
C4Team * | CreateTeam (const char *szName) |
bool | IsMultiTeams () const |
bool | IsCustom () const |
bool | IsHostilityChangeAllowed () const |
bool | IsTeamSwitchAllowed () const |
bool | CanLocalChooseTeam () const |
bool | CanLocalChooseTeam (int32_t idPlayer) const |
bool | CanLocalSeeTeam () const |
bool | IsTeamColors () const |
bool | IsRandomTeam () const |
bool | IsJoin2TeamAllowed (int32_t idTeam, C4PlayerType plrType) |
bool | IsAutoGenerateTeams () const |
bool | IsRuntimeJoinTeamChoice () const |
int32_t | GetMaxScriptPlayers () const |
int32_t | GetForcedTeamSelection (int32_t idForPlayer) const |
StdStrBuf | GetScriptPlayerName () const |
bool | IsTeamVisible () const |
void | EnforceLeagueRules () |
bool | RecheckPlayerInfoTeams (C4PlayerInfo &rNewJoin, bool fByHost) |
void | CompileFunc (StdCompiler *pComp) |
bool | Load (C4Group &hGroup, class C4Scenario *pInitDefault, class C4LangStringTable *pLang) |
bool | Save (C4Group &hGroup) |
void | RecheckPlayers () |
void | RecheckTeams () |
void | EnsureTeamCount () |
void | ReassignAllTeams () |
void | FillTeamDistOptions (C4GUI::ComboBox_FillCB *pFiller) const |
void | SendSetTeamDist (TeamDist eNewDist) |
TeamDist | GetTeamDist () const |
StdStrBuf | GetTeamDistString () const |
bool | HasTeamDistOptions () const |
void | SetTeamDistribution (TeamDist eToVal) |
void | SendSetTeamColors (bool fEnabled) |
void | SetTeamColors (bool fEnabled) |
int32_t | GetStartupTeamCount (int32_t startup_player_count) |
enum C4TeamList::TeamDist |
|
default |
|
inline |
bool C4TeamList::CanLocalChooseTeam | ( | ) | const |
Definition at line 292 of file C4Teams.cpp.
References Control, C4GameControl::isCtrlHost(), TEAMDIST_Free, TEAMDIST_Host, TEAMDIST_None, TEAMDIST_Random, and TEAMDIST_RandomInv.
Referenced by CanLocalChooseTeam().
bool C4TeamList::CanLocalChooseTeam | ( | int32_t | idPlayer | ) | const |
Definition at line 309 of file C4Teams.cpp.
References CanLocalChooseTeam(), GetTeamByIndex(), GetTeamByPlayerID(), and IsAutoGenerateTeams().
bool C4TeamList::CanLocalSeeTeam | ( | ) | const |
Definition at line 327 of file C4Teams.cpp.
References Game, C4Game::IsRunning, and TEAMDIST_RandomInv.
void C4TeamList::Clear | ( | ) |
Definition at line 255 of file C4Teams.cpp.
References StdStrBuf::Clear(), and TEAMDIST_Free.
Referenced by C4GameParameters::Clear(), Load(), operator=(), and ~C4TeamList().
void C4TeamList::CompileFunc | ( | StdCompiler * | pComp | ) |
Definition at line 545 of file C4Teams.cpp.
References GetLargestTeamID(), StdCompiler::isDeserializer(), mkArrayAdaptMap(), mkNamingAdapt(), mkNamingCountAdapt(), mkParAdapt(), mkPtrAdaptNoNull(), StdCompiler::RCT_All, TEAMDIST_Free, TEAMDIST_Host, TEAMDIST_None, TEAMDIST_Random, TEAMDIST_RandomInv, and StdCompiler::Value().
C4Team * C4TeamList::CreateTeam | ( | const char * | szName | ) |
Definition at line 360 of file C4Teams.cpp.
References C4MaxName, C4Team::iID, C4Team::Name, C4Team::RecheckColor(), and SCopy().
void C4TeamList::EnforceLeagueRules | ( | ) |
Definition at line 856 of file C4Teams.cpp.
Referenced by C4GameParameters::EnforceLeagueRules().
void C4TeamList::EnsureTeamCount | ( | ) |
Definition at line 719 of file C4Teams.cpp.
References GetTeamCount(), IsAutoGenerateTeams(), and IsRandomTeam().
Referenced by ReassignAllTeams(), and RecheckTeams().
void C4TeamList::FillTeamDistOptions | ( | C4GUI::ComboBox_FillCB * | pFiller | ) | const |
Definition at line 778 of file C4Teams.cpp.
References C4GUI::ComboBox_FillCB::AddEntry(), IsAutoGenerateTeams(), TEAMDIST_Free, TEAMDIST_Host, TEAMDIST_None, TEAMDIST_Random, and TEAMDIST_RandomInv.
int32_t C4TeamList::GetForcedTeamSelection | ( | int32_t | idForPlayer | ) | const |
Definition at line 863 of file C4Teams.cpp.
References C4Team::GetID(), GetTeamByIndex(), GetTeamByPlayerID(), IsAutoGenerateTeams(), and TEAMID_New.
Referenced by C4Player::Execute().
C4Team * C4TeamList::GetGenerateTeamByID | ( | int32_t | iID | ) |
Definition at line 390 of file C4Teams.cpp.
References GetLargestTeamID(), GetTeamByID(), IsMultiTeams(), and TEAMID_New.
Referenced by C4PlayerInfoList::AddInfo(), C4Player::Init(), C4PlayerInfoList::RecheckAutoGeneratedTeams(), and C4Player::ScenarioAndTeamInit().
int32_t C4TeamList::GetLargestTeamID | ( | ) | const |
Definition at line 427 of file C4Teams.cpp.
References iCnt.
Referenced by CompileFunc(), and GetGenerateTeamByID().
|
inline |
C4Team * C4TeamList::GetRandomSmallestTeam | ( | ) | const |
Definition at line 435 of file C4Teams.cpp.
References C4Team::GetPlayerCount(), iCnt, and UnsyncedRandom().
Referenced by RecheckPlayerInfoTeams(), and RecheckTeams().
StdStrBuf C4TeamList::GetScriptPlayerName | ( | ) | const |
Definition at line 899 of file C4Teams.cpp.
References Game, C4PlayerInfoList::GetActivePlayerInfoByName(), StdStrBuf::getData(), StdStrBuf::getLength(), StdStrBuf::GetSection(), LoadResStr(), C4Game::PlayerInfos, and UnsyncedRandom().
int32_t C4TeamList::GetStartupTeamCount | ( | int32_t | startup_player_count | ) |
Definition at line 913 of file C4Teams.cpp.
References C4Team::GetPlayerCount(), GetTeamByIndex(), GetTeamCount(), IsAutoGenerateTeams(), IsCustom(), and IsRandomTeam().
C4Team * C4TeamList::GetTeamByID | ( | int32_t | iID | ) | const |
Definition at line 383 of file C4Teams.cpp.
References iCnt.
Referenced by C4Player::Execute(), C4Player::FindNewOwner(), GetGenerateTeamByID(), C4PlayerInfo::GetLobbyColor(), C4PlayerInfo::HasTeamWon(), C4Player::Init(), IsJoin2TeamAllowed(), RecheckPlayerInfoTeams(), C4Player::ScenarioAndTeamInit(), C4Player::ScenarioInit(), C4PlayerInfoList::UpdatePlayerAttributes(), and C4GameSave::WriteDescPlayers().
C4Team * C4TeamList::GetTeamByIndex | ( | int32_t | iIndex | ) | const |
Definition at line 404 of file C4Teams.cpp.
Referenced by C4GameOverDlg::C4GameOverDlg(), CanLocalChooseTeam(), C4MainMenu::DoRefillInternal(), GetForcedTeamSelection(), GetStartupTeamCount(), Load(), C4Team::RecheckColor(), RecheckPlayerInfoTeams(), and C4GameSave::WriteDescPlayers().
C4Team * C4TeamList::GetTeamByName | ( | const char * | szName | ) | const |
Definition at line 412 of file C4Teams.cpp.
References iCnt, and SEqual().
C4Team * C4TeamList::GetTeamByPlayerID | ( | int32_t | iID | ) | const |
Definition at line 420 of file C4Teams.cpp.
References iCnt.
Referenced by CanLocalChooseTeam(), GetForcedTeamSelection(), and RecheckPlayerInfoTeams().
|
inline |
Definition at line 158 of file C4Teams.h.
Referenced by C4GameOverDlg::C4GameOverDlg(), EnsureTeamCount(), GetStartupTeamCount(), RecheckPlayerInfoTeams(), and RecheckTeams().
|
inline |
Definition at line 211 of file C4Teams.h.
Referenced by C4PlayerInfo::GetLobbyColor().
StdStrBuf C4TeamList::GetTeamDistString | ( | ) | const |
Definition at line 797 of file C4Teams.cpp.
bool C4TeamList::HasTeamDistOptions | ( | ) | const |
Definition at line 803 of file C4Teams.cpp.
|
inline |
Definition at line 172 of file C4Teams.h.
Referenced by C4GameOverDlg::C4GameOverDlg(), CanLocalChooseTeam(), C4MainMenu::DoRefillInternal(), EnsureTeamCount(), FillTeamDistOptions(), GetForcedTeamSelection(), GetStartupTeamCount(), C4Player::Init(), IsJoin2TeamAllowed(), RecheckPlayerInfoTeams(), RecheckTeams(), C4Player::ScenarioAndTeamInit(), and C4GameSave::WriteDescPlayers().
|
inline |
Definition at line 163 of file C4Teams.h.
Referenced by GetStartupTeamCount(), and IsRuntimeJoinTeamChoice().
|
inline |
Definition at line 164 of file C4Teams.h.
Referenced by C4MainMenu::MenuCommand().
bool C4TeamList::IsJoin2TeamAllowed | ( | int32_t | idTeam, |
C4PlayerType | plrType | ||
) |
Definition at line 534 of file C4Teams.cpp.
References C4PT_Script, GetTeamByID(), IsAutoGenerateTeams(), C4Team::IsFull(), and TEAMID_New.
Referenced by RecheckPlayerInfoTeams(), and C4Player::ScenarioAndTeamInit().
|
inline |
Definition at line 162 of file C4Teams.h.
Referenced by C4PlayerInfoList::AssignTeams(), GetGenerateTeamByID(), C4PlayerInfoList::InitLocal(), IsRuntimeJoinTeamChoice(), C4GameLobby::MainDlg::MainDlg(), C4GameLobby::MainDlg::OnRightTabContext(), RecheckPlayerInfoTeams(), and C4GameSave::WriteDescPlayers().
|
inline |
Definition at line 170 of file C4Teams.h.
References TEAMDIST_Random, and TEAMDIST_RandomInv.
Referenced by EnsureTeamCount(), GetStartupTeamCount(), RecheckPlayerInfoTeams(), RecheckTeams(), and SetTeamDistribution().
|
inline |
Definition at line 173 of file C4Teams.h.
References IsCustom(), and IsMultiTeams().
Referenced by C4Player::Init(), and RecheckPlayerInfoTeams().
|
inline |
Definition at line 169 of file C4Teams.h.
Referenced by C4Team::AddPlayer(), C4PlayerInfo::GetLobbyColor(), and C4PlayerInfoList::UpdatePlayerAttributes().
|
inline |
Definition at line 165 of file C4Teams.h.
Referenced by C4MainMenu::ActivateMain(), and C4MainMenu::MenuCommand().
bool C4TeamList::IsTeamVisible | ( | ) | const |
Definition at line 454 of file C4Teams.cpp.
References C4Network2::isLobbyActive(), Network, and TEAMDIST_RandomInv.
Referenced by C4MessageInput::ProcessInput().
bool C4TeamList::Load | ( | C4Group & | hGroup, |
class C4Scenario * | pInitDefault, | ||
class C4LangStringTable * | pLang | ||
) |
Definition at line 604 of file C4Teams.cpp.
References C4CFN_Teams, Clear(), C4Scenario::Game, GetTeamByIndex(), C4SGame::IsMelee(), C4Group::LoadEntryString(), mkNamingAdapt(), C4Team::RecheckColor(), and C4LangStringTable::ReplaceStrings().
Referenced by C4GameParameters::Load().
C4TeamList & C4TeamList::operator= | ( | const C4TeamList & | rCopy | ) |
Definition at line 273 of file C4Teams.cpp.
References Clear().
void C4TeamList::ReassignAllTeams | ( | ) |
Definition at line 732 of file C4Teams.cpp.
References Control, EnsureTeamCount(), Game, C4PlayerInfoList::GetClientInfoByPlayerID(), C4PlayerInfo::GetID(), C4PlayerInfoList::GetNextPlayerInfoByID(), C4PlayerInfo::GetTeam(), C4PlayerInfo::HasJoinIssued(), C4GameControl::isCtrlHost(), C4Game::PlayerInfos, RecheckPlayerInfoTeams(), RecheckPlayers(), C4PlayerInfo::SetTeam(), and C4ClientPlayerInfos::SetUpdated().
Referenced by RecheckTeams(), and SetTeamDistribution().
bool C4TeamList::RecheckPlayerInfoTeams | ( | C4PlayerInfo & | rNewJoin, |
bool | fByHost | ||
) |
Definition at line 463 of file C4Teams.cpp.
References C4Team::AddPlayer(), C4PT_User, C4Game::fLobby, Game, C4PlayerInfo::GetID(), C4Team::GetID(), C4Team::GetPlayerCount(), GetRandomSmallestTeam(), C4PlayerInfo::GetTeam(), GetTeamByID(), GetTeamByIndex(), GetTeamByPlayerID(), GetTeamCount(), C4PlayerInfo::GetType(), IsAutoGenerateTeams(), C4Network2::isEnabled(), IsJoin2TeamAllowed(), C4Network2::isLobbyActive(), IsMultiTeams(), C4Network2Status::isPastLobby(), IsRandomTeam(), IsRuntimeJoinTeamChoice(), Network, C4PlayerInfo::SetTeam(), C4Network2::Status, TEAMDIST_Free, TEAMDIST_Host, and TEAMID_New.
Referenced by C4PlayerInfoList::AssignTeams(), and ReassignAllTeams().
void C4TeamList::RecheckPlayers | ( | ) |
Definition at line 663 of file C4Teams.cpp.
References iCnt.
Referenced by C4PlayerInfoList::CreateRestoreInfosForJoinedScriptPlayers(), C4Network2Players::HandlePlayerInfo(), C4Network2Players::OnClientPart(), ReassignAllTeams(), and C4PlayerInfoList::RestoreSavegameInfos().
void C4TeamList::RecheckTeams | ( | ) |
Definition at line 669 of file C4Teams.cpp.
References C4Team::AddPlayer(), Control, EnsureTeamCount(), Game, C4PlayerInfoList::GetClientInfoByPlayerID(), C4Team::GetFirstUnjoinedPlayerID(), C4Team::GetPlayerCount(), C4PlayerInfoList::GetPlayerInfoByID(), GetRandomSmallestTeam(), GetTeamCount(), iCnt, IsAutoGenerateTeams(), C4GameControl::isCtrlHost(), IsRandomTeam(), C4Game::PlayerInfos, ReassignAllTeams(), C4Team::RemovePlayerByID(), and C4ClientPlayerInfos::SetUpdated().
Referenced by C4Network2Players::HandlePlayerInfo(), C4Network2Players::OnClientPart(), and SetTeamDistribution().
bool C4TeamList::Save | ( | C4Group & | hGroup | ) |
Definition at line 646 of file C4Teams.cpp.
References C4Group::Add(), C4CFN_Teams, C4Group::DeleteEntry(), and mkNamingAdapt().
void C4TeamList::SendSetTeamColors | ( | bool | fEnabled | ) |
Definition at line 833 of file C4Teams.cpp.
References C4CVT_TeamColors, CDT_Sync, CID_Set, Control, and C4GameControl::DoInput().
void C4TeamList::SendSetTeamDist | ( | TeamDist | eNewDist | ) |
Definition at line 790 of file C4Teams.cpp.
References C4CVT_TeamDistribution, CDT_Sync, CID_Set, Control, C4GameControl::DoInput(), and C4GameControl::isCtrlHost().
void C4TeamList::SetTeamColors | ( | bool | fEnabled | ) |
Definition at line 839 of file C4Teams.cpp.
References Control, Game, C4GameControl::isCtrlHost(), C4Network2::isEnabled(), Network, C4Game::PlayerInfos, C4Network2::Players, C4Network2Players::SendUpdatedPlayers(), and C4PlayerInfoList::UpdatePlayerAttributes().
void C4TeamList::SetTeamDistribution | ( | TeamDist | eToVal | ) |
Definition at line 809 of file C4Teams.cpp.
References Control, Inside(), C4GameControl::isCtrlHost(), C4Network2::isEnabled(), IsRandomTeam(), Network, C4Network2::Players, ReassignAllTeams(), RecheckTeams(), C4Network2Players::SendUpdatedPlayers(), TEAMDIST_First, TEAMDIST_Last, and TEAMDIST_None.