OpenClonk
C4PlayerInfo Class Reference

#include <C4PlayerInfo.h>

Public Types

enum  Flags {
  PIF_Joined = 1 << 0 , PIF_Removed = 1 << 2 , PIF_HasRes = 1 << 3 , PIF_JoinIssued = 1 << 4 ,
  PIF_TempFile = 1 << 5 , PIF_InScenarioFile = 1 << 6 , PIF_JoinedForSavegameOnly = 1 << 7 , PIF_Disconnected = 1 << 8 ,
  PIF_Won = 1 << 9 , PIF_VotedOut = 1 << 10 , PIF_AttributesFixed = 1 << 11 , PIF_NoScenarioInit = 1 << 12 ,
  PIF_NoEliminationCheck = 1 << 13 , PIF_Invisible = 1 << 14 , PIF_NoScenarioSave = 1 << 15 , PIF_SyncFlags = PIF_Joined | PIF_Removed | PIF_HasRes | PIF_InScenarioFile | PIF_JoinedForSavegameOnly | PIF_Disconnected | PIF_Won | PIF_VotedOut | PIF_AttributesFixed | PIF_NoScenarioInit | PIF_NoEliminationCheck | PIF_Invisible | PIF_NoScenarioSave ,
  PIF_SavegameTakeoverFlags = PIF_Joined | PIF_Removed | PIF_JoinIssued | PIF_AttributesFixed | PIF_NoScenarioInit | PIF_NoEliminationCheck | PIF_Invisible | PIF_NoScenarioSave
}
 
enum  Attribute { PLRATT_Color =0 , PLRATT_Name =1 , PLRATT_Last =2 }
 
enum  AttributeLevel { PLRAL_Current , PLRAL_Original , PLRAL_Alternate }
 

Public Member Functions

 C4PlayerInfo ()
 
void Clear ()
 
bool LoadFromLocalFile (const char *szFilename)
 
bool SetAsScriptPlayer (const char *szName, uint32_t dwColor, uint32_t dwFlags, C4ID idExtra)
 
void SetJoined (int32_t iNumber)
 
void SetJoinIssued ()
 
void SetRemoved ()
 
void SetID (int32_t iToID)
 
void SetColor (DWORD dwUseClr)
 
void SetOriginalColor (DWORD dwUseClr)
 
void SetFilename (const char *szToFilename)
 
void SetToScenarioFilename (const char *szScenFilename)
 
void SetTempFile ()
 
void SetTeam (int32_t idToTeam)
 
void DeleteTempFile ()
 
void LoadResource ()
 
void DiscardResource ()
 
void SetAssociatedSavegamePlayer (int32_t aidSavegamePlayer)
 
int32_t GetAssociatedSavegamePlayerID () const
 
void SetJoinForSavegameOnly ()
 
bool IsJoinForSavegameOnly ()
 
bool SetSavegameResume (C4PlayerInfo *pSavegameInfo)
 
void SetAuthID (const char *sznAuthID)
 
void SetLeagueData (const char *szAccount, const char *szNewClanTag, int32_t iScore, int32_t iRank, int32_t iRankSymbol, const char *szProgressData)
 
void SetLeaguePerformance (int32_t iNewPerf)
 
void SetLeagueProgressData (const char *szNewProgressData)
 
void SetVotedOut ()
 
void SetLeagueProjectedGain (int32_t iProjectedGain)
 
void ResetLeagueProjectedGain ()
 
void SetForcedName (const char *szNewName)
 
void CompileFunc (StdCompiler *pComp)
 
C4PlayerType GetType () const
 
uint32_t GetColor () const
 
uint32_t GetLobbyColor () const
 
uint32_t GetOriginalColor () const
 
uint32_t GetAlternateColor () const
 
const char * GetName () const
 
const char * GetOriginalName () const
 
const char * GetForcedName () const
 
StdStrBuf GetLobbyName () const
 
const char * GetFilename () const
 
const char * GetLocalJoinFilename () const
 
C4Network2ResGetRes () const
 
bool IsRemoved () const
 
bool HasJoined () const
 
bool IsJoined () const
 
bool HasJoinIssued () const
 
bool HasJoinPending () const
 
bool IsUsingColor () const
 
bool IsUsingName () const
 
bool IsUsingAttribute (Attribute eAttr) const
 
bool IsUsingPlayerFile () const
 
bool IsUsingTeam () const
 
bool IsAttributesFixed () const
 
bool IsInvisible () const
 
bool IsScenarioInitDesired () const
 
bool IsScenarioSaveDesired () const
 
C4ID GetScriptPlayerExtraID () const
 
bool IsNoEliminationCheck () const
 
bool HasAutoGeneratedColor ()
 
bool HasWon () const
 
bool HasTeamWon () const
 
const char * getAuthID () const
 
const char * getLeagueAccount () const
 
int32_t getLeagueScore () const
 
int32_t getLeagueRank () const
 
int32_t getLeagueRankSymbol () const
 
int32_t getLeagueScoreProjected () const
 
int32_t GetInGameNumber () const
 
bool IsLeagueProjectedGainValid () const
 
int32_t GetLeagueProjectedGain () const
 
const char * GetLeagueProgressData () const
 
int32_t GetID () const
 
int32_t GetTeam () const
 
bool IsTempFile () const
 
DWORD GetFlags ()
 
void SetDisconnected ()
 
void SetWinner ()
 
bool LoadBigIcon (C4FacetSurface &fctTarget)
 

Detailed Description

Definition at line 42 of file C4PlayerInfo.h.

Member Enumeration Documentation

◆ Attribute

Enumerator
PLRATT_Color 
PLRATT_Name 
PLRATT_Last 

Definition at line 72 of file C4PlayerInfo.h.

◆ AttributeLevel

Enumerator
PLRAL_Current 
PLRAL_Original 
PLRAL_Alternate 

Definition at line 73 of file C4PlayerInfo.h.

◆ Flags

Enumerator
PIF_Joined 
PIF_Removed 
PIF_HasRes 
PIF_JoinIssued 
PIF_TempFile 
PIF_InScenarioFile 
PIF_JoinedForSavegameOnly 
PIF_Disconnected 
PIF_Won 
PIF_VotedOut 
PIF_AttributesFixed 
PIF_NoScenarioInit 
PIF_NoEliminationCheck 
PIF_Invisible 
PIF_NoScenarioSave 
PIF_SyncFlags 
PIF_SavegameTakeoverFlags 

Definition at line 46 of file C4PlayerInfo.h.

47  {
48  PIF_Joined = 1 << 0, // player has joined the game
49  PIF_Removed = 1 << 2, // player has been removed
50  PIF_HasRes = 1 << 3, // pRes is set
51  PIF_JoinIssued = 1 << 4, // flag for host to mark a player for which the join is issued
52  PIF_TempFile = 1 << 5, // player file is temporary and to be deleted after join recreation
53  PIF_InScenarioFile = 1 << 6, // player file is present within the scenario; res is not to be used
54  PIF_JoinedForSavegameOnly = 1 << 7, // player file has been specified to take over a savegame player; do not join as normal player if association fails
55  PIF_Disconnected = 1 << 8, // the player was removed because his client disconnected
56  PIF_Won = 1 << 9, // player survived until game end (for game evaluation only)
57  PIF_VotedOut = 1 << 10, // player was removed from the round after a successful voting
58  PIF_AttributesFixed = 1 << 11, // player color and name aren't changed on collision
59  PIF_NoScenarioInit = 1 << 12, // do not call ScenariInit for this player
60  PIF_NoEliminationCheck = 1 << 13, // do not eliminate player if crew is empty
61  PIF_Invisible = 1 << 14, // do not show in lobby and menus
62  PIF_NoScenarioSave = 1 << 15, // not saved in SavePlayerInfos.txt if "save as scenario" is performed
63 
64  // flags to be synchronized via network and saved into player info
66 
67  // flags to be copied from savegame-player for takeover
69  };
@ PIF_SavegameTakeoverFlags
Definition: C4PlayerInfo.h:68
@ PIF_JoinedForSavegameOnly
Definition: C4PlayerInfo.h:54
@ PIF_NoEliminationCheck
Definition: C4PlayerInfo.h:60

Constructor & Destructor Documentation

◆ C4PlayerInfo()

C4PlayerInfo::C4PlayerInfo ( )
inline

Definition at line 103 of file C4PlayerInfo.h.

104  : pRes(nullptr), szFilename(), idExtraData(C4ID::None), sLeagueAccount("") { }
static const C4ID None
Definition: C4Id.h:39

Member Function Documentation

◆ Clear()

void C4PlayerInfo::Clear ( )

Definition at line 31 of file C4PlayerInfo.cpp.

32 {
33  // del temp file
35  // clear fields
36  sName.Clear(); szFilename.Clear();
37  pRes = nullptr;
38  ResCore.Clear();
39  // default fields
40  dwColor = dwOriginalColor = 0xffffffff;
41  dwAlternateColor = 0;
42  dwFlags = 0;
43  iID = idSavegamePlayer = idTeam = 0;
44  iInGameNumber = iInGameJoinFrame = iInGamePartFrame = -1;
45  sLeagueAccount = ""; iLeagueScore=iLeagueRank=0;
46  iLeagueProjectedGain = -1;
47  eType = C4PT_User;
48  idExtraData = C4ID::None;
49  iLeaguePerformance = 0;
50  sLeagueProgressData.Clear();
51 }
@ C4PT_User
Definition: C4Constants.h:154
void DeleteTempFile()
void Clear()
Definition: StdBuf.h:466

References C4PT_User, StdStrBuf::Clear(), C4Network2ResCore::Clear(), DeleteTempFile(), and C4ID::None.

Referenced by LoadFromLocalFile(), and SetAsScriptPlayer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CompileFunc()

void C4PlayerInfo::CompileFunc ( StdCompiler pComp)

Definition at line 172 of file C4PlayerInfo.cpp.

173 {
174  // Names
175  pComp->Value(mkNamingAdapt(sName, "Name", ""));
176  pComp->Value(mkNamingAdapt(sForcedName, "ForcedName", ""));
177  pComp->Value(mkNamingAdapt(szFilename, "Filename", ""));
178 
179  // Flags
180  const StdBitfieldEntry<uint16_t> Entries[] =
181  {
182  { "Joined", PIF_Joined },
183  { "Removed", PIF_Removed },
184  { "HasResource", PIF_HasRes },
185  { "JoinIssued", PIF_JoinIssued },
186  { "SavegameJoin", PIF_JoinedForSavegameOnly },
187  { "Disconnected", PIF_Disconnected },
188  { "VotedOut", PIF_VotedOut },
189  { "Won", PIF_Won },
190  { "AttributesFixed", PIF_AttributesFixed },
191  { "NoScenarioInit", PIF_NoScenarioInit },
192  { "NoScenarioSave", PIF_NoScenarioSave },
193  { "NoEliminationCheck", PIF_NoEliminationCheck },
194  { "Invisible", PIF_Invisible},
195  { nullptr, 0 },
196  };
197  uint16_t dwSyncFlags = dwFlags & PIF_SyncFlags; // do not store local flags!
198  pComp->Value(mkNamingAdapt(mkBitfieldAdapt(dwSyncFlags, Entries), "Flags", 0u));
199  if (pComp->isDeserializer()) dwFlags = dwSyncFlags;
200  pComp->Value(mkNamingAdapt(iID, "ID", 0));
201 
202  // type
203  StdEnumEntry<C4PlayerType> PlayerTypes[] =
204  {
205  { "User", C4PT_User },
206  { "Script", C4PT_Script },
207 
208  { nullptr, C4PT_User },
209  };
210  pComp->Value(mkNamingAdapt(mkEnumAdaptT<uint8_t>(eType, PlayerTypes), "Type", C4PT_User));
211 
212  // safety: Do not allow invisible regular players
213  if (pComp->isDeserializer())
214  {
215  if (eType != C4PT_Script) dwFlags &= ~PIF_Invisible;
216  }
217 
218  // load colors
219  pComp->Value(mkNamingAdapt(dwColor, "Color", 0u));
220  pComp->Value(mkNamingAdapt(dwOriginalColor, "OriginalColor", dwColor));
221  // load savegame ID
222  pComp->Value(mkNamingAdapt(mkIntPackAdapt(idSavegamePlayer), "SavgamePlayer", 0));
223  // load team ID
224  pComp->Value(mkNamingAdapt(mkIntPackAdapt(idTeam), "Team", 0));
225  // load authentication ID
226  pComp->Value(mkNamingAdapt(szAuthID, "AUID", ""));
227 
228  // InGame info
229  if (dwFlags & PIF_Joined)
230  {
231  pComp->Value(mkNamingAdapt(iInGameNumber, "GameNumber", -1));
232  pComp->Value(mkNamingAdapt(iInGameJoinFrame, "GameJoinFrame", -1));
233  }
234  else
235  iInGameNumber = iInGameJoinFrame = -1;
236 
237  if (dwFlags & PIF_Removed)
238  pComp->Value(mkNamingAdapt(iInGamePartFrame, "GamePartFrame", -1));
239  else
240  iInGamePartFrame = -1;
241 
242  // script player extra data
243  pComp->Value(mkNamingAdapt(idExtraData, "ExtraData", C4ID::None));
244 
245  // load league info
246  pComp->Value(mkNamingAdapt(sLeagueAccount, "LeagueAccount", ""));
247  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iLeagueScore), "LeagueScore", 0));
248  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iLeagueRank), "LeagueRank", 0));
249  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iLeagueRankSymbol), "LeagueRankSymbol", 0));
250  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iLeagueProjectedGain), "ProjectedGain", -1));
251  pComp->Value(mkNamingAdapt(mkParAdapt(sClanTag, StdCompiler::RCT_All), "ClanTag", ""));
252  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iLeaguePerformance), "LeaguePerformance", 0));
253  pComp->Value(mkNamingAdapt(sLeagueProgressData, "LeagueProgressData", ""));
254 
255  // file resource
256  if (pComp->isDeserializer() && Game.C4S.Head.Replay)
257  {
258  // Replays don't have player resources, drop the flag
259  dwFlags &= ~PIF_HasRes;
260  }
261  if (dwFlags & PIF_HasRes)
262  {
263  // ResCore
264  if (pComp->isSerializer() && pRes)
265  {
266  // ensure ResCore is up-to-date
267  ResCore = pRes->getCore();
268  }
269  pComp->Value(mkNamingAdapt(ResCore, "ResCore"));
270  }
271 
272 }
@ C4PT_Script
Definition: C4Constants.h:155
C4Game Game
Definition: C4Globals.cpp:52
StdBitfieldAdapt< T > mkBitfieldAdapt(T &rVal, const StdBitfieldEntry< T > *pNames)
Definition: StdAdaptors.h:985
StdIntPackAdapt< T > mkIntPackAdapt(T &rVal)
Definition: StdAdaptors.h:791
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:490
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:92
Definition: StdAdaptors.h:883
Definition: StdAdaptors.h:795
C4Scenario C4S
Definition: C4Game.h:74
const C4Network2ResCore & getCore() const
bool Replay
Definition: C4Scenario.h:72
C4SHead Head
Definition: C4Scenario.h:232
void Value(const T &rStruct)
Definition: StdCompiler.h:161
bool isSerializer()
Definition: StdCompiler.h:54
virtual bool isDeserializer()
Definition: StdCompiler.h:53

References C4PT_Script, C4PT_User, C4Game::C4S, Game, C4Network2Res::getCore(), C4Scenario::Head, StdCompiler::isDeserializer(), StdCompiler::isSerializer(), mkBitfieldAdapt(), mkIntPackAdapt(), mkNamingAdapt(), mkParAdapt(), C4ID::None, PIF_AttributesFixed, PIF_Disconnected, PIF_HasRes, PIF_Invisible, PIF_Joined, PIF_JoinedForSavegameOnly, PIF_JoinIssued, PIF_NoEliminationCheck, PIF_NoScenarioInit, PIF_NoScenarioSave, PIF_Removed, PIF_SyncFlags, PIF_VotedOut, PIF_Won, StdCompiler::RCT_All, C4SHead::Replay, and StdCompiler::Value().

Here is the call graph for this function:

◆ DeleteTempFile()

void C4PlayerInfo::DeleteTempFile ( )

Definition at line 53 of file C4PlayerInfo.cpp.

54 {
55  // is temp file?
56  if (!! szFilename && (dwFlags & PIF_TempFile))
57  {
58  // erase it
59  EraseItem(szFilename.getData());
60  // reset flag and filename to prevent double deletion
61  dwFlags &= ~PIF_TempFile;
62  szFilename.Clear();
63  }
64 }
bool EraseItem(const char *szItemName)
Definition: StdFile.cpp:833
const char * getData() const
Definition: StdBuf.h:442

References StdStrBuf::Clear(), EraseItem(), StdStrBuf::getData(), and PIF_TempFile.

Referenced by Clear(), and C4PlayerInfoList::RecreatePlayers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DiscardResource()

void C4PlayerInfo::DiscardResource ( )

Definition at line 309 of file C4PlayerInfo.cpp.

310 {
311  // del any file resource
312  if (pRes)
313  {
314  assert(dwFlags & PIF_HasRes);
315  pRes = nullptr;
316  dwFlags &= ~PIF_HasRes;
317  }
318  else assert(~dwFlags & PIF_HasRes);
319  ResCore.Clear();
320 }

References C4Network2ResCore::Clear(), and PIF_HasRes.

Referenced by C4Network2Reference::InitLocal(), C4PlayerInfoList::RecreatePlayerFiles(), C4PlayerInfoList::SetAsRestoreInfos(), and SetToScenarioFilename().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAlternateColor()

uint32_t C4PlayerInfo::GetAlternateColor ( ) const
inline

Definition at line 156 of file C4PlayerInfo.h.

156 { return dwAlternateColor; } // get secondary original player color

◆ GetAssociatedSavegamePlayerID()

int32_t C4PlayerInfo::GetAssociatedSavegamePlayerID ( ) const
inline

Definition at line 126 of file C4PlayerInfo.h.

127  { return idSavegamePlayer; }

Referenced by C4PlayerInfoList::GetActiveScriptPlayerCount(), GetLobbyColor(), C4PlayerInfoList::GetPlayerInfoBySavegameID(), C4PlayerInfoList::RestoreSavegameInfos(), C4GameLobby::MainDlg::Start(), and C4PlayerInfoList::UpdatePlayerAttributes().

Here is the caller graph for this function:

◆ getAuthID()

const char* C4PlayerInfo::getAuthID ( ) const
inline

Definition at line 183 of file C4PlayerInfo.h.

183 { return szAuthID.getData(); } // returns authentication ID for this player [league]

References StdStrBuf::getData().

Referenced by C4LeagueClient::AuthCheck().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetColor()

uint32_t C4PlayerInfo::GetColor ( ) const
inline

Definition at line 153 of file C4PlayerInfo.h.

153 { return dwColor; } // get player color

Referenced by C4Player::CreateGraphs(), C4Network2Players::GetClientChatColor(), GetLobbyColor(), C4Player::Init(), C4Player::ScenarioInit(), SetSavegameResume(), and C4PlayerInfoList::UpdatePlayerAttributes().

Here is the caller graph for this function:

◆ GetFilename()

const char* C4PlayerInfo::GetFilename ( ) const
inline

Definition at line 161 of file C4PlayerInfo.h.

161 { return szFilename.getData(); } // get filename for local games

References StdStrBuf::getData().

Referenced by C4PlayerInfoList::FindSavegameResumePlayerInfo(), LoadBigIcon(), LoadResource(), C4PlayerInfoList::LocalJoinUnjoinedPlayersInQueue(), C4PlayerInfoList::RecreatePlayerFiles(), C4PlayerList::Save(), and C4PlayerInfoList::SetAsRestoreInfos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetFlags()

DWORD C4PlayerInfo::GetFlags ( )
inline

Definition at line 198 of file C4PlayerInfo.h.

198 { return dwFlags; } // for dbg print only

Referenced by SetSavegameResume().

Here is the caller graph for this function:

◆ GetForcedName()

const char* C4PlayerInfo::GetForcedName ( ) const
inline

Definition at line 159 of file C4PlayerInfo.h.

159 { return sForcedName.getData(); }

References StdStrBuf::getData().

Here is the call graph for this function:

◆ GetID()

◆ GetInGameNumber()

int32_t C4PlayerInfo::GetInGameNumber ( ) const
inline

Definition at line 189 of file C4PlayerInfo.h.

189 { return iInGameNumber; } // returns player number the player had in the game

Referenced by C4Player::FindNewOwner(), C4Player::Init(), and C4PlayerInfoList::RemoveUnassociatedPlayers().

Here is the caller graph for this function:

◆ getLeagueAccount()

const char* C4PlayerInfo::getLeagueAccount ( ) const
inline

Definition at line 184 of file C4PlayerInfo.h.

184 { return sLeagueAccount.getData(); } // returns account name on league server

References StdStrBuf::getData().

Referenced by DisconnectData::CompileFunc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetLeagueProgressData()

const char* C4PlayerInfo::GetLeagueProgressData ( ) const
inline

Definition at line 192 of file C4PlayerInfo.h.

192 { return sLeagueProgressData.getData(); }

References StdStrBuf::getData().

Referenced by C4RoundResultsPlayer::EvaluatePlayer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetLeagueProjectedGain()

int32_t C4PlayerInfo::GetLeagueProjectedGain ( ) const
inline

Definition at line 191 of file C4PlayerInfo.h.

191 { return iLeagueProjectedGain; } // get score gain in primary league if this player's team wins

Referenced by C4Network2::LeagueUpdateProcessReply().

Here is the caller graph for this function:

◆ getLeagueRank()

int32_t C4PlayerInfo::getLeagueRank ( ) const
inline

Definition at line 186 of file C4PlayerInfo.h.

186 { return iLeagueRank; } // returns rank on league server (0 for not assigned)

◆ getLeagueRankSymbol()

int32_t C4PlayerInfo::getLeagueRankSymbol ( ) const
inline

Definition at line 187 of file C4PlayerInfo.h.

187 { return iLeagueRankSymbol; } // returns rank symbol on league server (0 for not assigned)

◆ getLeagueScore()

int32_t C4PlayerInfo::getLeagueScore ( ) const
inline

Definition at line 185 of file C4PlayerInfo.h.

185 { return iLeagueScore; } // returns score number on league server (0 for not assigned)

◆ getLeagueScoreProjected()

int32_t C4PlayerInfo::getLeagueScoreProjected ( ) const
inline

Definition at line 188 of file C4PlayerInfo.h.

188 { return iLeagueScoreProjected; } // returns score on league server in case of win (0 for not assigned)

◆ GetLobbyColor()

uint32_t C4PlayerInfo::GetLobbyColor ( ) const

Definition at line 127 of file C4PlayerInfo.cpp.

128 {
129  // special case if random teams and team colors are enabled in lobby:
130  // Unjoined players do not show their team! Instead, they just display their original color
132  if (Game.Teams.IsTeamColors())
133  if (Game.Teams.GetTeamByID(GetTeam()))
135  return GetOriginalColor();
136  // otherwise, just show the normal player color
137  return GetColor();
138 }
C4TeamList & Teams
Definition: C4Game.h:70
int32_t GetTeam() const
Definition: C4PlayerInfo.h:195
uint32_t GetOriginalColor() const
Definition: C4PlayerInfo.h:155
uint32_t GetColor() const
Definition: C4PlayerInfo.h:153
bool HasJoined() const
Definition: C4PlayerInfo.h:165
int32_t GetAssociatedSavegamePlayerID() const
Definition: C4PlayerInfo.h:126
@ TEAMDIST_RandomInv
Definition: C4Teams.h:112
C4Team * GetTeamByID(int32_t iID) const
Definition: C4Teams.cpp:383
bool IsTeamColors() const
Definition: C4Teams.h:169
TeamDist GetTeamDist() const
Definition: C4Teams.h:211

References Game, GetAssociatedSavegamePlayerID(), GetColor(), GetOriginalColor(), GetTeam(), C4TeamList::GetTeamByID(), C4TeamList::GetTeamDist(), HasJoined(), C4TeamList::IsTeamColors(), C4TeamList::TEAMDIST_RandomInv, and C4Game::Teams.

Referenced by C4Network2Players::GetClientChatColor().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetLobbyName()

StdStrBuf C4PlayerInfo::GetLobbyName ( ) const

Definition at line 140 of file C4PlayerInfo.cpp.

141 {
142  // return player name including colored clan/team tag if known
143  StdStrBuf sResult;
144  if (sLeagueAccount.getLength())
145  {
146  if (sClanTag.getLength())
147  {
148  // gray team tag color used in lobby and game evaluation dialog!
149  sResult.Format("<c afafaf>%s</c> %s", sClanTag.getData(), sLeagueAccount.getData());
150  }
151  else
152  sResult.Ref(sLeagueAccount);
153  }
154  else
155  {
156  // fallback to regular player name
157  sResult.Ref(sForcedName.getLength() ? static_cast<const StdStrBuf &>(sForcedName) : static_cast<const StdStrBuf &>(sName));
158  }
159  return sResult;
160 }
void Ref(const char *pnData)
Definition: StdBuf.h:455
size_t getLength() const
Definition: StdBuf.h:445
void Format(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
Definition: StdBuf.cpp:174

References StdStrBuf::Format(), StdStrBuf::getData(), StdStrBuf::getLength(), and StdStrBuf::Ref().

Here is the call graph for this function:

◆ GetLocalJoinFilename()

const char * C4PlayerInfo::GetLocalJoinFilename ( ) const

Definition at line 119 of file C4PlayerInfo.cpp.

120 {
121  // preferred: by resource
122  if (pRes) return pRes->getFile();
123  // if no resource is known (replay or non-net), return filename
124  return szFilename.getData();
125 }
const char * getFile() const

References StdStrBuf::getData(), and C4Network2Res::getFile().

Referenced by C4PlayerInfoList::RecreatePlayers(), and C4PlayerInfoList::SetAsRestoreInfos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetName()

const char* C4PlayerInfo::GetName ( ) const
inline

Definition at line 157 of file C4PlayerInfo.h.

157 { return sLeagueAccount.getLength() ? sLeagueAccount.getData() : sForcedName.getLength() ? sForcedName.getData() : sName.getData(); } // get player name

References StdStrBuf::getData(), and StdStrBuf::getLength().

Referenced by C4PlayerInfoList::CreateRestoreInfosForJoinedScriptPlayers(), C4PlayerInfoList::FindSavegameResumePlayerInfo(), C4PlayerInfoList::GetActivePlayerInfoByName(), C4PlayerInfoList::GetActivePlayerNames(), C4Team::GetNameWithParticipants(), C4Player::Init(), C4PlayerList::Join(), C4Network2::LeaguePlrAuth(), C4Network2::LeaguePlrAuthCheck(), C4PlayerInfoList::LocalJoinUnjoinedPlayersInQueue(), C4MessageInput::ProcessCommand(), C4PlayerInfoList::RecreatePlayerFiles(), C4PlayerInfoList::RecreatePlayers(), C4PlayerInfoList::RemoveUnassociatedPlayers(), C4PlayerInfoList::RestoreSavegameInfos(), and C4GameSave::WriteDescPlayers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetOriginalColor()

uint32_t C4PlayerInfo::GetOriginalColor ( ) const
inline

Definition at line 155 of file C4PlayerInfo.h.

155 { return dwOriginalColor; } // get original player color

Referenced by C4PlayerInfoList::FindSavegameResumePlayerInfo(), and GetLobbyColor().

Here is the caller graph for this function:

◆ GetOriginalName()

const char* C4PlayerInfo::GetOriginalName ( ) const
inline

Definition at line 158 of file C4PlayerInfo.h.

158 { return sName.getData(); }

References StdStrBuf::getData().

Here is the call graph for this function:

◆ GetRes()

C4Network2Res* C4PlayerInfo::GetRes ( ) const
inline

Definition at line 163 of file C4PlayerInfo.h.

163 { return pRes; } // get player resource for network games

Referenced by C4Network2Players::HandlePlayerInfoUpdRequest(), LoadBigIcon(), and C4PlayerInfoList::RecreatePlayers().

Here is the caller graph for this function:

◆ GetScriptPlayerExtraID()

C4ID C4PlayerInfo::GetScriptPlayerExtraID ( ) const
inline

Definition at line 178 of file C4PlayerInfo.h.

178 { return idExtraData; }

Referenced by C4Player::Init().

Here is the caller graph for this function:

◆ GetTeam()

int32_t C4PlayerInfo::GetTeam ( ) const
inline

◆ GetType()

◆ HasAutoGeneratedColor()

bool C4PlayerInfo::HasAutoGeneratedColor ( )
inline

Definition at line 180 of file C4PlayerInfo.h.

180 { return dwColor != dwOriginalColor; } // whether the player got a new color assigned due to color conflict

◆ HasJoined()

bool C4PlayerInfo::HasJoined ( ) const
inline

Definition at line 165 of file C4PlayerInfo.h.

165 { return !!(dwFlags & PIF_Joined); } // return whether player has joined

References PIF_Joined.

Referenced by GetLobbyColor(), IsJoined(), C4Network2Players::OnClientPart(), C4PlayerInfoList::UpdatePlayerAttributes(), and C4GameSave::WriteDescPlayers().

Here is the caller graph for this function:

◆ HasJoinIssued()

bool C4PlayerInfo::HasJoinIssued ( ) const
inline

Definition at line 167 of file C4PlayerInfo.h.

167 { return !!(dwFlags & (PIF_Joined | PIF_JoinIssued)); } // return whether player join is in the queue already (or performed long ago, even)

References PIF_Joined, and PIF_JoinIssued.

Referenced by C4Team::GetFirstUnjoinedPlayerID(), C4PlayerInfoList::GetJoinIssuedPlayerCount(), C4PlayerInfoList::LocalJoinUnjoinedPlayersInQueue(), C4TeamList::ReassignAllTeams(), and C4PlayerInfoList::RecreatePlayerFiles().

Here is the caller graph for this function:

◆ HasJoinPending()

bool C4PlayerInfo::HasJoinPending ( ) const
inline

Definition at line 168 of file C4PlayerInfo.h.

168 { return !(dwFlags & (PIF_Joined | PIF_Removed)); } // return whether player join should be done but has not been performed yet

References PIF_Joined, and PIF_Removed.

Referenced by C4PlayerInfoList::GetJoinPendingPlayerCount().

Here is the caller graph for this function:

◆ HasTeamWon()

bool C4PlayerInfo::HasTeamWon ( ) const

Definition at line 162 of file C4PlayerInfo.cpp.

163 {
164  // team win/solo win
165  C4Team *pTeam;
166  if (idTeam && (pTeam = Game.Teams.GetTeamByID(idTeam)))
167  return pTeam->HasWon();
168  else
169  return HasWon();
170 }
bool HasWon() const
Definition: C4PlayerInfo.h:181
Definition: C4Teams.h:31
bool HasWon() const
Definition: C4Teams.cpp:234

References Game, C4TeamList::GetTeamByID(), HasWon(), C4Team::HasWon(), and C4Game::Teams.

Here is the call graph for this function:

◆ HasWon()

bool C4PlayerInfo::HasWon ( ) const
inline

Definition at line 181 of file C4PlayerInfo.h.

181 { return !!(dwFlags & PIF_Won); }

References PIF_Won.

Referenced by HasTeamWon(), and C4Team::HasWon().

Here is the caller graph for this function:

◆ IsAttributesFixed()

bool C4PlayerInfo::IsAttributesFixed ( ) const
inline

Definition at line 174 of file C4PlayerInfo.h.

174 { return !!(dwFlags & PIF_AttributesFixed); }

References PIF_AttributesFixed.

◆ IsInvisible()

bool C4PlayerInfo::IsInvisible ( ) const
inline

Definition at line 175 of file C4PlayerInfo.h.

175 { return !!(dwFlags & PIF_Invisible); }

References PIF_Invisible.

Referenced by C4PlayerInfoList::GetActivePlayerCount(), C4PlayerInfoList::GetActivePlayerNames(), C4PlayerInfoList::GetActiveScriptPlayerCount(), C4Player::IsInvisible(), and C4GameSave::WriteDescPlayers().

Here is the caller graph for this function:

◆ IsJoined()

bool C4PlayerInfo::IsJoined ( ) const
inline

Definition at line 166 of file C4PlayerInfo.h.

166 { return HasJoined() && !(dwFlags & PIF_Removed); } // return whether player is currently in the game

References HasJoined(), and PIF_Removed.

Referenced by C4Team::AddPlayer(), DisconnectData::CompileFunc(), C4Player::FindNewOwner(), C4PlayerInfoList::FindUnassociatedRestoreInfo(), C4Player::Init(), C4Network2::LeagueNotifyDisconnect(), C4PlayerInfoList::RecreatePlayerFiles(), C4PlayerInfoList::RecreatePlayers(), C4PlayerInfoList::RemoveUnassociatedPlayers(), and C4PlayerInfoList::SetAsRestoreInfos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsJoinForSavegameOnly()

bool C4PlayerInfo::IsJoinForSavegameOnly ( )
inline

Definition at line 130 of file C4PlayerInfo.h.

131  { return !!(dwFlags & PIF_JoinedForSavegameOnly); }

References PIF_JoinedForSavegameOnly.

◆ IsLeagueProjectedGainValid()

bool C4PlayerInfo::IsLeagueProjectedGainValid ( ) const
inline

Definition at line 190 of file C4PlayerInfo.h.

190 { return iLeagueProjectedGain>=0; }

Referenced by C4PlayerInfoList::ResetLeagueProjectedGain().

Here is the caller graph for this function:

◆ IsNoEliminationCheck()

bool C4PlayerInfo::IsNoEliminationCheck ( ) const
inline

Definition at line 179 of file C4PlayerInfo.h.

179 { return !!(dwFlags & PIF_NoEliminationCheck); }

References PIF_NoEliminationCheck.

Referenced by C4Player::Init().

Here is the caller graph for this function:

◆ IsRemoved()

bool C4PlayerInfo::IsRemoved ( ) const
inline

◆ IsScenarioInitDesired()

bool C4PlayerInfo::IsScenarioInitDesired ( ) const
inline

Definition at line 176 of file C4PlayerInfo.h.

176 { return !(dwFlags & PIF_NoScenarioInit); }

References PIF_NoScenarioInit.

Referenced by C4Player::Init().

Here is the caller graph for this function:

◆ IsScenarioSaveDesired()

bool C4PlayerInfo::IsScenarioSaveDesired ( ) const
inline

Definition at line 177 of file C4PlayerInfo.h.

177 { return !(dwFlags & PIF_NoScenarioSave); }

References PIF_NoScenarioSave.

Referenced by C4PlayerInfoList::SetAsRestoreInfos().

Here is the caller graph for this function:

◆ IsTempFile()

bool C4PlayerInfo::IsTempFile ( ) const
inline

Definition at line 196 of file C4PlayerInfo.h.

196 { return !!(dwFlags & PIF_TempFile); } // return whether filename points to temp folder

References PIF_TempFile.

Referenced by C4PlayerInfoList::RecreatePlayers().

Here is the caller graph for this function:

◆ IsUsingAttribute()

bool C4PlayerInfo::IsUsingAttribute ( Attribute  eAttr) const
inline

Definition at line 171 of file C4PlayerInfo.h.

171 { if (eAttr == PLRATT_Color) return IsUsingColor(); else return IsUsingName(); }
bool IsUsingColor() const
Definition: C4PlayerInfo.h:169
bool IsUsingName() const
Definition: C4PlayerInfo.h:170

References IsUsingColor(), IsUsingName(), and PLRATT_Color.

Here is the call graph for this function:

◆ IsUsingColor()

bool C4PlayerInfo::IsUsingColor ( ) const
inline

Definition at line 169 of file C4PlayerInfo.h.

169 { return !IsRemoved() && !idSavegamePlayer; } //return whether the player is actually using the player color
bool IsRemoved() const
Definition: C4PlayerInfo.h:164

References IsRemoved().

Referenced by IsUsingAttribute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsUsingName()

bool C4PlayerInfo::IsUsingName ( ) const
inline

Definition at line 170 of file C4PlayerInfo.h.

170 { return !IsRemoved() && !sLeagueAccount.getLength(); } //return whether the player is actually using the player name (e.g. not if league name is used)

References StdStrBuf::getLength(), and IsRemoved().

Referenced by IsUsingAttribute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsUsingPlayerFile()

bool C4PlayerInfo::IsUsingPlayerFile ( ) const
inline

Definition at line 172 of file C4PlayerInfo.h.

172 { return !IsRemoved(); } //return whether the player is using the file (i.e., isn't dead yet)

References IsRemoved().

Here is the call graph for this function:

◆ IsUsingTeam()

bool C4PlayerInfo::IsUsingTeam ( ) const
inline

Definition at line 173 of file C4PlayerInfo.h.

173 { return !IsRemoved(); } // whether player should be in the team list

References IsRemoved().

Referenced by C4PlayerInfoList::HasSameTeamPlayers(), and C4Team::RecheckPlayers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LoadBigIcon()

bool C4PlayerInfo::LoadBigIcon ( C4FacetSurface fctTarget)

Definition at line 349 of file C4PlayerInfo.cpp.

350 {
351  bool fSuccess = false;
352  // load BigIcon.png of player into target facet; return false if no bigicon present or player file not yet loaded
353  C4Group Plr;
354  C4Network2Res *pRes = nullptr;
355  bool fIncompleteRes = false;
356  if ((pRes = GetRes()))
357  if (!pRes->isComplete())
358  fIncompleteRes = true;
359  size_t iBigIconSize=0;
360  if (!fIncompleteRes)
361  if (Plr.Open(pRes ? pRes->getFile() : GetFilename()))
362  if (Plr.AccessEntry(C4CFN_BigIcon, &iBigIconSize))
363  if (iBigIconSize<=C4NetResMaxBigicon*1024)
364  if (fctTarget.Load(Plr, C4CFN_BigIcon, C4FCT_Full, C4FCT_Full, false, 0))
365  fSuccess = true;
366  return fSuccess;
367 }
#define C4CFN_BigIcon
Definition: C4Components.h:111
const int C4FCT_Full
Definition: C4FacetEx.h:26
const int32_t C4NetResMaxBigicon
Definition: C4Network2Res.h:36
bool Load(C4Group &hGroup, const char *szName, int iWdt, int iHgt, bool fNoErrIfNotFound, int iFlags)
Definition: C4FacetEx.cpp:84
bool AccessEntry(const char *wildcard, size_t *size=nullptr, char *filename=nullptr, bool needs_to_be_a_group=false)
Definition: C4Group.cpp:2104
bool Open(const char *group_name, bool do_create=false)
Definition: C4Group.cpp:660
bool isComplete() const
C4Network2Res * GetRes() const
Definition: C4PlayerInfo.h:163
const char * GetFilename() const
Definition: C4PlayerInfo.h:161

References C4Group::AccessEntry(), C4CFN_BigIcon, C4FCT_Full, C4NetResMaxBigicon, C4Network2Res::getFile(), GetFilename(), GetRes(), C4Network2Res::isComplete(), C4FacetSurface::Load(), and C4Group::Open().

Here is the call graph for this function:

◆ LoadFromLocalFile()

bool C4PlayerInfo::LoadFromLocalFile ( const char *  szFilename)

Definition at line 66 of file C4PlayerInfo.cpp.

67 {
68  // players should not be added in replay mode
69  assert(!Game.C4S.Head.Replay);
70  // clear previous
71  Clear();
72  // open player file group
73  C4Group Grp;
74  if (!Reloc.Open(Grp, szFilename)) return false;
75 
76  // read core
77  C4PlayerInfoCore C4P;
78  if (!C4P.Load(Grp)) return false;
79  // set values
80  eType = C4PT_User;
81  sName = C4P.PrefName;
82  this->szFilename = szFilename;
83  dwColor = dwOriginalColor = 0xff000000 | (C4P.PrefColorDw & 0xffffff); // ignore alpha
84  dwAlternateColor = 0xff000000 | (C4P.PrefColor2Dw & 0xffffff); // ignore alpha
85  // network: resource (not for replays, because everyone has the player files there...)
86  if (::Network.isEnabled() && !Game.C4S.Head.Replay)
87  {
88  // add resource
89  // 2do: rejoining players need to update their resource version when saving the player
90  // otherwise, player file versions may differ
91  pRes = ::Network.ResList.getRefRes(szFilename, true);
92  // not found? add
93  if (!pRes) pRes = ::Network.ResList.AddByGroup(&Grp, false, NRT_Player, -1, szFilename);
94  if (!pRes) return false;
95  // set core and flag
96  ResCore = pRes->getCore();
97  dwFlags |= PIF_HasRes;
98  // filename is no longer needed in network mode, because it's stored in the res-core
99  }
100  // done, success
101  return true;
102 }
C4Network2 Network
Definition: C4Globals.cpp:53
@ NRT_Player
Definition: C4Network2Res.h:45
C4Reloc Reloc
Definition: C4Reloc.cpp:21
C4Network2ResList ResList
Definition: C4Network2.h:113
bool isEnabled() const
Definition: C4Network2.h:203
C4Network2Res::Ref getRefRes(int32_t iResID)
C4Network2Res::Ref AddByGroup(C4Group *pGrp, bool fTemp, C4Network2ResType eType, int32_t iResID=-1, const char *szResName=nullptr, bool fAllowUnloadable=false)
bool Load(C4Group &hGroup)
Definition: C4InfoCore.cpp:88
uint32_t PrefColor2Dw
Definition: C4InfoCore.h:99
char PrefName[C4MaxName+1]
Definition: C4InfoCore.h:85
uint32_t PrefColorDw
Definition: C4InfoCore.h:99
bool Open(C4Group &group, const char *filename) const
Definition: C4Reloc.cpp:156

References C4Network2ResList::AddByGroup(), C4PT_User, C4Game::C4S, Clear(), Game, C4Network2Res::getCore(), C4Network2ResList::getRefRes(), C4Scenario::Head, C4Network2::isEnabled(), C4PlayerInfoCore::Load(), Network, NRT_Player, C4Reloc::Open(), PIF_HasRes, C4PlayerInfoCore::PrefColor2Dw, C4PlayerInfoCore::PrefColorDw, C4PlayerInfoCore::PrefName, Reloc, C4SHead::Replay, and C4Network2::ResList.

Referenced by C4ClientPlayerInfos::C4ClientPlayerInfos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LoadResource()

void C4PlayerInfo::LoadResource ( )

Definition at line 289 of file C4PlayerInfo.cpp.

290 {
291  // only if any resource present and not yet assigned
292  if (IsRemoved() || !(dwFlags & PIF_HasRes) || pRes) return;
293  // Ignore res if a local file is to be used
294  // the PIF_InScenarioFile is not set for startup players in initial replays,
295  // because resources are used for player joins but emulated in playback control
296  // if there will ever be resources in replay mode, this special case can be removed
297  if (Game.C4S.Head.Replay || (dwFlags & PIF_InScenarioFile))
298  dwFlags &= ~PIF_HasRes;
299  else
300  // create resource (will check if resource already exists)
301  if (!(pRes = ::Network.ResList.AddByCore(ResCore)))
302  {
303  dwFlags &= ~PIF_HasRes;
304  // add failed? invalid resource??! -- TODO: may be too large to load
305  LogF("Error: Could not add resource %d for player %s! Player file too large to load?", (int) ResCore.getID(), (const char *) GetFilename());
306  }
307 }
bool LogF(const char *strMessage,...)
Definition: C4Log.cpp:262
int32_t getID() const
Definition: C4Network2Res.h:86
C4Network2Res::Ref AddByCore(const C4Network2ResCore &Core, bool fLoad=true)

References C4Network2ResList::AddByCore(), C4Game::C4S, Game, GetFilename(), C4Network2ResCore::getID(), C4Scenario::Head, IsRemoved(), LogF(), Network, PIF_HasRes, PIF_InScenarioFile, C4SHead::Replay, and C4Network2::ResList.

Here is the call graph for this function:

◆ ResetLeagueProjectedGain()

void C4PlayerInfo::ResetLeagueProjectedGain ( )
inline

Definition at line 145 of file C4PlayerInfo.h.

146  { iLeagueProjectedGain = -1; }

Referenced by C4Network2Players::HandlePlayerInfoUpdRequest(), and C4PlayerInfoList::ResetLeagueProjectedGain().

Here is the caller graph for this function:

◆ SetAsScriptPlayer()

bool C4PlayerInfo::SetAsScriptPlayer ( const char *  szName,
uint32_t  dwColor,
uint32_t  dwFlags,
C4ID  idExtra 
)

Definition at line 104 of file C4PlayerInfo.cpp.

105 {
106  // clear previous
107  Clear();
108  // set parameters
109  eType = C4PT_Script;
110  this->dwColor = dwOriginalColor = 0xff000000 | (dwColor & 0xffffff); // ignore alpha
111  dwAlternateColor = 0;
112  this->sName.CopyValidated(szName);
113  idExtraData = idExtra;
114  this->dwFlags |= dwFlags;
115  // done, success
116  return true;
117 }
void CopyValidated(const char *szFromVal)

References C4PT_Script, Clear(), and ValidatedStdCopyStrBufBase::CopyValidated().

Here is the call graph for this function:

◆ SetAssociatedSavegamePlayer()

void C4PlayerInfo::SetAssociatedSavegamePlayer ( int32_t  aidSavegamePlayer)
inline

Definition at line 124 of file C4PlayerInfo.h.

125  { idSavegamePlayer=aidSavegamePlayer; }

Referenced by C4PlayerInfoList::CreateRestoreInfosForJoinedScriptPlayers(), and C4PlayerInfoList::RestoreSavegameInfos().

Here is the caller graph for this function:

◆ SetAuthID()

void C4PlayerInfo::SetAuthID ( const char *  sznAuthID)
inline

Definition at line 133 of file C4PlayerInfo.h.

134  { szAuthID = sznAuthID; }

Referenced by C4Network2Players::HandlePlayerInfoUpdRequest(), and C4Network2::LeaguePlrAuth().

Here is the caller graph for this function:

◆ SetColor()

void C4PlayerInfo::SetColor ( DWORD  dwUseClr)
inline

Definition at line 115 of file C4PlayerInfo.h.

115 { dwColor = dwUseClr; } // set color to be used

Referenced by C4Team::AddPlayer(), and C4PlayerInfoList::UpdatePlayerAttributes().

Here is the caller graph for this function:

◆ SetDisconnected()

void C4PlayerInfo::SetDisconnected ( )
inline

Definition at line 200 of file C4PlayerInfo.h.

200 { dwFlags |= PIF_Disconnected; }

References PIF_Disconnected.

Referenced by C4Player::EvaluateLeague(), and C4PlayerList::Remove().

Here is the caller graph for this function:

◆ SetFilename()

void C4PlayerInfo::SetFilename ( const char *  szToFilename)

Definition at line 274 of file C4PlayerInfo.cpp.

275 {
276  szFilename = szToFilename;
277 }

Referenced by C4PlayerInfoList::RecreatePlayerFiles(), C4PlayerInfoList::SetAsRestoreInfos(), and SetToScenarioFilename().

Here is the caller graph for this function:

◆ SetForcedName()

void C4PlayerInfo::SetForcedName ( const char *  szNewName)
inline

Definition at line 147 of file C4PlayerInfo.h.

148  { if (szNewName) sForcedName.CopyValidated(szNewName); else sForcedName.Clear(); }

References StdStrBuf::Clear(), and ValidatedStdCopyStrBufBase::CopyValidated().

Here is the call graph for this function:

◆ SetID()

void C4PlayerInfo::SetID ( int32_t  iToID)
inline

Definition at line 114 of file C4PlayerInfo.h.

114 { iID = iToID; } // set player info ID

Referenced by C4PlayerInfoList::AssignPlayerIDs().

Here is the caller graph for this function:

◆ SetJoined()

void C4PlayerInfo::SetJoined ( int32_t  iNumber)

Definition at line 333 of file C4PlayerInfo.cpp.

334 {
335  // mark as joined in current frame
336  iInGameNumber = iNumber;
337  iInGameJoinFrame = Game.FrameCounter;
338  dwFlags |= PIF_Joined;
339 }
int32_t FrameCounter
Definition: C4Game.h:129

References C4Game::FrameCounter, Game, and PIF_Joined.

Referenced by C4Player::Init().

Here is the caller graph for this function:

◆ SetJoinForSavegameOnly()

void C4PlayerInfo::SetJoinForSavegameOnly ( )
inline

Definition at line 128 of file C4PlayerInfo.h.

129  { dwFlags |= PIF_JoinedForSavegameOnly; }

References PIF_JoinedForSavegameOnly.

◆ SetJoinIssued()

void C4PlayerInfo::SetJoinIssued ( )
inline

Definition at line 112 of file C4PlayerInfo.h.

112 { dwFlags |= PIF_JoinIssued; } // mark as joined

References PIF_JoinIssued.

Referenced by C4PlayerInfoList::LocalJoinUnjoinedPlayersInQueue().

Here is the caller graph for this function:

◆ SetLeagueData()

void C4PlayerInfo::SetLeagueData ( const char *  szAccount,
const char *  szNewClanTag,
int32_t  iScore,
int32_t  iRank,
int32_t  iRankSymbol,
const char *  szProgressData 
)
inline

Definition at line 135 of file C4PlayerInfo.h.

136  { sLeagueAccount.CopyValidated(szAccount); sClanTag.CopyValidated(szNewClanTag); iLeagueScore = iScore; iLeagueRank = iRank; iLeagueRankSymbol = iRankSymbol; sLeagueProgressData.Copy(szProgressData); }
void Copy()
Definition: StdBuf.h:467

References StdStrBuf::Copy(), and ValidatedStdCopyStrBufBase::CopyValidated().

Referenced by C4LeagueClient::GetAuthCheckReply().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetLeaguePerformance()

void C4PlayerInfo::SetLeaguePerformance ( int32_t  iNewPerf)
inline

Definition at line 137 of file C4PlayerInfo.h.

138  { iLeaguePerformance = iNewPerf; }

Referenced by C4Network2Reference::InitLocal().

Here is the caller graph for this function:

◆ SetLeagueProgressData()

void C4PlayerInfo::SetLeagueProgressData ( const char *  szNewProgressData)
inline

Definition at line 139 of file C4PlayerInfo.h.

140  { if (szNewProgressData) sLeagueProgressData.Copy(szNewProgressData); else sLeagueProgressData.Clear(); }

References StdStrBuf::Clear(), and StdStrBuf::Copy().

Here is the call graph for this function:

◆ SetLeagueProjectedGain()

void C4PlayerInfo::SetLeagueProjectedGain ( int32_t  iProjectedGain)
inline

Definition at line 143 of file C4PlayerInfo.h.

144  { assert(iProjectedGain>=0); iLeagueProjectedGain = iProjectedGain; }

Referenced by C4Network2::LeagueUpdateProcessReply().

Here is the caller graph for this function:

◆ SetOriginalColor()

void C4PlayerInfo::SetOriginalColor ( DWORD  dwUseClr)
inline

Definition at line 116 of file C4PlayerInfo.h.

116 { dwOriginalColor = dwUseClr; } // set color the player wishes to have

Referenced by C4MessageInput::ProcessCommand().

Here is the caller graph for this function:

◆ SetRemoved()

void C4PlayerInfo::SetRemoved ( )

Definition at line 341 of file C4PlayerInfo.cpp.

342 {
343  // mark as removed - always marks as previously joined, too
344  dwFlags |= PIF_Joined | PIF_Removed;
345  // remember removal frame
346  iInGamePartFrame = Game.FrameCounter;
347 }

References C4Game::FrameCounter, Game, PIF_Joined, and PIF_Removed.

Referenced by C4PlayerList::Remove(), and C4PlayerInfoList::RemoveUnassociatedPlayers().

Here is the caller graph for this function:

◆ SetSavegameResume()

bool C4PlayerInfo::SetSavegameResume ( C4PlayerInfo pSavegameInfo)

Definition at line 322 of file C4PlayerInfo.cpp.

323 {
324  // copy some data fields; but not the file fields, because the join method is determined by this player
325  if (!pSavegameInfo) return false;
326  iID = pSavegameInfo->GetID();
327  dwFlags = (dwFlags & ~PIF_SavegameTakeoverFlags) | (pSavegameInfo->GetFlags() & PIF_SavegameTakeoverFlags);
328  dwColor = pSavegameInfo->GetColor(); // redundant; should be done by host already
329  idTeam = pSavegameInfo->GetTeam();
330  return true;
331 }
DWORD GetFlags()
Definition: C4PlayerInfo.h:198
int32_t GetID() const
Definition: C4PlayerInfo.h:194

References GetColor(), GetFlags(), GetID(), GetTeam(), and PIF_SavegameTakeoverFlags.

Referenced by C4PlayerInfoList::RestoreSavegameInfos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetTeam()

void C4PlayerInfo::SetTeam ( int32_t  idToTeam)
inline

Definition at line 120 of file C4PlayerInfo.h.

120 { idTeam = idToTeam; }

Referenced by C4Team::AddPlayer(), C4TeamList::ReassignAllTeams(), and C4TeamList::RecheckPlayerInfoTeams().

Here is the caller graph for this function:

◆ SetTempFile()

void C4PlayerInfo::SetTempFile ( )
inline

Definition at line 119 of file C4PlayerInfo.h.

119 { assert(!!szFilename); dwFlags |= PIF_TempFile; } // mark filename as temp, so it is deleted in dtor or after join

References PIF_TempFile.

Referenced by C4PlayerInfoList::RecreatePlayerFiles().

Here is the caller graph for this function:

◆ SetToScenarioFilename()

void C4PlayerInfo::SetToScenarioFilename ( const char *  szScenFilename)

Definition at line 279 of file C4PlayerInfo.cpp.

280 {
281  // kill res
282  DiscardResource();
283  // set new filename
284  SetFilename(szScenFilename);
285  // flag scenario filename
286  dwFlags |= PIF_InScenarioFile;
287 }
void SetFilename(const char *szToFilename)
void DiscardResource()

References DiscardResource(), PIF_InScenarioFile, and SetFilename().

Here is the call graph for this function:

◆ SetVotedOut()

void C4PlayerInfo::SetVotedOut ( )
inline

Definition at line 141 of file C4PlayerInfo.h.

142  { dwFlags |= PIF_VotedOut; }

References PIF_VotedOut.

◆ SetWinner()

void C4PlayerInfo::SetWinner ( )
inline

Definition at line 201 of file C4PlayerInfo.h.

201 { dwFlags |= PIF_Won; }

References PIF_Won.

Referenced by C4Player::EvaluateLeague().

Here is the caller graph for this function:

The documentation for this class was generated from the following files: