OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
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

Enumerator
PLRATT_Color 
PLRATT_Name 
PLRATT_Last 

Definition at line 72 of file C4PlayerInfo.h.

Enumerator
PLRAL_Current 
PLRAL_Original 
PLRAL_Alternate 

Definition at line 73 of file C4PlayerInfo.h.

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  };

Constructor & Destructor Documentation

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

void C4PlayerInfo::Clear ( )

Definition at line 31 of file C4PlayerInfo.cpp.

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

Referenced by LoadFromLocalFile(), and SetAsScriptPlayer().

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 }
void Clear()
Definition: StdBuf.h:466
static const C4ID None
Definition: C4Id.h:39
void DeleteTempFile()

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PlayerInfo::CompileFunc ( StdCompiler pComp)

Definition at line 172 of file C4PlayerInfo.cpp.

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().

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 }
Definition: StdAdaptors.h:850
Definition: StdAdaptors.h:762
C4Game Game
Definition: C4Globals.cpp:52
C4Scenario C4S
Definition: C4Game.h:74
bool Replay
Definition: C4Scenario.h:72
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:92
bool isSerializer()
Definition: StdCompiler.h:54
const C4Network2ResCore & getCore() const
StdBitfieldAdapt< T > mkBitfieldAdapt(T &rVal, const StdBitfieldEntry< T > *pNames)
Definition: StdAdaptors.h:953
static const C4ID None
Definition: C4Id.h:39
void Value(const T &rStruct)
Definition: StdCompiler.h:161
virtual bool isDeserializer()
Definition: StdCompiler.h:53
StdIntPackAdapt< T > mkIntPackAdapt(T &rVal)
Definition: StdAdaptors.h:759
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:458
C4SHead Head
Definition: C4Scenario.h:230

Here is the call graph for this function:

void C4PlayerInfo::DeleteTempFile ( )

Definition at line 53 of file C4PlayerInfo.cpp.

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

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

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 }
const char * getData() const
Definition: StdBuf.h:442
void Clear()
Definition: StdBuf.h:466
bool EraseItem(const char *szItemName)
Definition: StdFile.cpp:809

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PlayerInfo::DiscardResource ( )

Definition at line 309 of file C4PlayerInfo.cpp.

References C4Network2ResCore::Clear(), and PIF_HasRes.

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

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t C4PlayerInfo::GetAlternateColor ( ) const
inline

Definition at line 156 of file C4PlayerInfo.h.

156 { return dwAlternateColor; } // get secondary original player color
int32_t C4PlayerInfo::GetAssociatedSavegamePlayerID ( ) const
inline

Definition at line 126 of file C4PlayerInfo.h.

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

127  { return idSavegamePlayer; }

Here is the caller graph for this function:

const char* C4PlayerInfo::getAuthID ( ) const
inline

Definition at line 183 of file C4PlayerInfo.h.

References StdStrBuf::getData().

Referenced by C4LeagueClient::AuthCheck().

183 { return szAuthID.getData(); } // returns authentication ID for this player [league]
const char * getData() const
Definition: StdBuf.h:442

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t C4PlayerInfo::GetColor ( ) const
inline

Definition at line 153 of file C4PlayerInfo.h.

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

153 { return dwColor; } // get player color

Here is the caller graph for this function:

const char* C4PlayerInfo::GetFilename ( ) const
inline

Definition at line 161 of file C4PlayerInfo.h.

References StdStrBuf::getData().

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

161 { return szFilename.getData(); } // get filename for local games
const char * getData() const
Definition: StdBuf.h:442

Here is the call graph for this function:

Here is the caller graph for this function:

DWORD C4PlayerInfo::GetFlags ( )
inline

Definition at line 198 of file C4PlayerInfo.h.

Referenced by SetSavegameResume().

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

Here is the caller graph for this function:

const char* C4PlayerInfo::GetForcedName ( ) const
inline

Definition at line 159 of file C4PlayerInfo.h.

References StdStrBuf::getData().

159 { return sForcedName.getData(); }
const char * getData() const
Definition: StdBuf.h:442

Here is the call graph for this function:

int32_t C4PlayerInfo::GetInGameNumber ( ) const
inline

Definition at line 189 of file C4PlayerInfo.h.

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

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

Here is the caller graph for this function:

const char* C4PlayerInfo::getLeagueAccount ( ) const
inline

Definition at line 184 of file C4PlayerInfo.h.

References StdStrBuf::getData().

Referenced by DisconnectData::CompileFunc().

184 { return sLeagueAccount.getData(); } // returns account name on league server
const char * getData() const
Definition: StdBuf.h:442

Here is the call graph for this function:

Here is the caller graph for this function:

const char* C4PlayerInfo::GetLeagueProgressData ( ) const
inline

Definition at line 192 of file C4PlayerInfo.h.

References StdStrBuf::getData().

Referenced by C4RoundResultsPlayer::EvaluatePlayer().

192 { return sLeagueProgressData.getData(); }
const char * getData() const
Definition: StdBuf.h:442

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4PlayerInfo::GetLeagueProjectedGain ( ) const
inline

Definition at line 191 of file C4PlayerInfo.h.

Referenced by C4Network2::LeagueUpdateProcessReply().

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

Here is the caller graph for this function:

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)
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)
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)
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)
uint32_t C4PlayerInfo::GetLobbyColor ( ) const

Definition at line 127 of file C4PlayerInfo.cpp.

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

Referenced by C4Network2Players::GetClientChatColor().

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 }
C4Game Game
Definition: C4Globals.cpp:52
bool IsTeamColors() const
Definition: C4Teams.h:169
C4Team * GetTeamByID(int32_t iID) const
Definition: C4Teams.cpp:383
uint32_t GetOriginalColor() const
Definition: C4PlayerInfo.h:155
C4TeamList & Teams
Definition: C4Game.h:70
int32_t GetAssociatedSavegamePlayerID() const
Definition: C4PlayerInfo.h:126
int32_t GetTeam() const
Definition: C4PlayerInfo.h:195
uint32_t GetColor() const
Definition: C4PlayerInfo.h:153
TeamDist GetTeamDist() const
Definition: C4Teams.h:208
bool HasJoined() const
Definition: C4PlayerInfo.h:165

Here is the call graph for this function:

Here is the caller graph for this function:

StdStrBuf C4PlayerInfo::GetLobbyName ( ) const

Definition at line 140 of file C4PlayerInfo.cpp.

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

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 }
const char * getData() const
Definition: StdBuf.h:442
void Format(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
Definition: StdBuf.cpp:174
void Ref(const char *pnData)
Definition: StdBuf.h:455
size_t getLength() const
Definition: StdBuf.h:445

Here is the call graph for this function:

const char * C4PlayerInfo::GetLocalJoinFilename ( ) const

Definition at line 119 of file C4PlayerInfo.cpp.

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

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

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 * getData() const
Definition: StdBuf.h:442
const char * getFile() const

Here is the call graph for this function:

Here is the caller graph for this function:

const char* C4PlayerInfo::GetName ( ) const
inline

Definition at line 157 of file C4PlayerInfo.h.

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().

157 { return sLeagueAccount.getLength() ? sLeagueAccount.getData() : sForcedName.getLength() ? sForcedName.getData() : sName.getData(); } // get player name
const char * getData() const
Definition: StdBuf.h:442
size_t getLength() const
Definition: StdBuf.h:445

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t C4PlayerInfo::GetOriginalColor ( ) const
inline

Definition at line 155 of file C4PlayerInfo.h.

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

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

Here is the caller graph for this function:

const char* C4PlayerInfo::GetOriginalName ( ) const
inline

Definition at line 158 of file C4PlayerInfo.h.

References StdStrBuf::getData().

158 { return sName.getData(); }
const char * getData() const
Definition: StdBuf.h:442

Here is the call graph for this function:

C4Network2Res* C4PlayerInfo::GetRes ( ) const
inline

Definition at line 163 of file C4PlayerInfo.h.

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

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

Here is the caller graph for this function:

C4ID C4PlayerInfo::GetScriptPlayerExtraID ( ) const
inline

Definition at line 178 of file C4PlayerInfo.h.

Referenced by C4Player::Init().

178 { return idExtraData; }

Here is the caller graph for this function:

int32_t C4PlayerInfo::GetTeam ( ) const
inline
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
bool C4PlayerInfo::HasJoined ( ) const
inline

Definition at line 165 of file C4PlayerInfo.h.

References PIF_Joined.

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

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

Here is the caller graph for this function:

bool C4PlayerInfo::HasJoinIssued ( ) const
inline

Definition at line 167 of file C4PlayerInfo.h.

References PIF_Joined, and PIF_JoinIssued.

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

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

Here is the caller graph for this function:

bool C4PlayerInfo::HasJoinPending ( ) const
inline

Definition at line 168 of file C4PlayerInfo.h.

References PIF_Joined, and PIF_Removed.

Referenced by C4PlayerInfoList::GetJoinPendingPlayerCount().

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

Here is the caller graph for this function:

bool C4PlayerInfo::HasTeamWon ( ) const

Definition at line 162 of file C4PlayerInfo.cpp.

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

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 }
C4Game Game
Definition: C4Globals.cpp:52
bool HasWon() const
Definition: C4PlayerInfo.h:181
Definition: C4Teams.h:30
C4Team * GetTeamByID(int32_t iID) const
Definition: C4Teams.cpp:383
C4TeamList & Teams
Definition: C4Game.h:70
bool HasWon() const
Definition: C4Teams.cpp:234

Here is the call graph for this function:

bool C4PlayerInfo::HasWon ( ) const
inline

Definition at line 181 of file C4PlayerInfo.h.

References PIF_Won.

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

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

Here is the caller graph for this function:

bool C4PlayerInfo::IsAttributesFixed ( ) const
inline

Definition at line 174 of file C4PlayerInfo.h.

References PIF_AttributesFixed.

174 { return !!(dwFlags & PIF_AttributesFixed); }
bool C4PlayerInfo::IsInvisible ( ) const
inline

Definition at line 175 of file C4PlayerInfo.h.

References PIF_Invisible.

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

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

Here is the caller graph for this function:

bool C4PlayerInfo::IsJoined ( ) const
inline

Definition at line 166 of file C4PlayerInfo.h.

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().

166 { return HasJoined() && !(dwFlags & PIF_Removed); } // return whether player is currently in the game
bool HasJoined() const
Definition: C4PlayerInfo.h:165

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4PlayerInfo::IsJoinForSavegameOnly ( )
inline

Definition at line 130 of file C4PlayerInfo.h.

References PIF_JoinedForSavegameOnly.

bool C4PlayerInfo::IsLeagueProjectedGainValid ( ) const
inline

Definition at line 190 of file C4PlayerInfo.h.

Referenced by C4PlayerInfoList::ResetLeagueProjectedGain().

190 { return iLeagueProjectedGain>=0; }

Here is the caller graph for this function:

bool C4PlayerInfo::IsNoEliminationCheck ( ) const
inline

Definition at line 179 of file C4PlayerInfo.h.

References PIF_NoEliminationCheck.

Referenced by C4Player::Init().

Here is the caller graph for this function:

bool C4PlayerInfo::IsRemoved ( ) const
inline
bool C4PlayerInfo::IsScenarioInitDesired ( ) const
inline

Definition at line 176 of file C4PlayerInfo.h.

References PIF_NoScenarioInit.

Referenced by C4Player::Init().

176 { return !(dwFlags & PIF_NoScenarioInit); }

Here is the caller graph for this function:

bool C4PlayerInfo::IsScenarioSaveDesired ( ) const
inline

Definition at line 177 of file C4PlayerInfo.h.

References PIF_NoScenarioSave.

Referenced by C4PlayerInfoList::SetAsRestoreInfos().

177 { return !(dwFlags & PIF_NoScenarioSave); }

Here is the caller graph for this function:

bool C4PlayerInfo::IsTempFile ( ) const
inline

Definition at line 196 of file C4PlayerInfo.h.

References PIF_TempFile.

Referenced by C4PlayerInfoList::RecreatePlayers().

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

Here is the caller graph for this function:

bool C4PlayerInfo::IsUsingAttribute ( Attribute  eAttr) const
inline

Definition at line 171 of file C4PlayerInfo.h.

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

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

Here is the call graph for this function:

bool C4PlayerInfo::IsUsingColor ( ) const
inline

Definition at line 169 of file C4PlayerInfo.h.

References IsRemoved().

Referenced by IsUsingAttribute().

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4PlayerInfo::IsUsingName ( ) const
inline

Definition at line 170 of file C4PlayerInfo.h.

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

Referenced by IsUsingAttribute().

170 { return !IsRemoved() && !sLeagueAccount.getLength(); } //return whether the player is actually using the player name (e.g. not if league name is used)
bool IsRemoved() const
Definition: C4PlayerInfo.h:164
size_t getLength() const
Definition: StdBuf.h:445

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4PlayerInfo::IsUsingPlayerFile ( ) const
inline

Definition at line 172 of file C4PlayerInfo.h.

References IsRemoved().

172 { return !IsRemoved(); } //return whether the player is using the file (i.e., isn't dead yet)
bool IsRemoved() const
Definition: C4PlayerInfo.h:164

Here is the call graph for this function:

bool C4PlayerInfo::IsUsingTeam ( ) const
inline

Definition at line 173 of file C4PlayerInfo.h.

References IsRemoved().

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

173 { return !IsRemoved(); } // whether player should be in the team list
bool IsRemoved() const
Definition: C4PlayerInfo.h:164

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4PlayerInfo::LoadBigIcon ( C4FacetSurface fctTarget)

Definition at line 349 of file C4PlayerInfo.cpp.

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

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 }
C4Network2Res * GetRes() const
Definition: C4PlayerInfo.h:163
bool AccessEntry(const char *szWildCard, size_t *iSize=nullptr, char *sFileName=nullptr, bool NeedsToBeAGroup=false)
Definition: C4Group.cpp:1695
bool Load(C4Group &hGroup, const char *szName, int iWdt, int iHgt, bool fNoErrIfNotFound, int iFlags)
Definition: C4FacetEx.cpp:78
bool isComplete() const
const char * getFile() const
bool Open(const char *szGroupName, bool fCreate=false)
Definition: C4Group.cpp:514
const char * GetFilename() const
Definition: C4PlayerInfo.h:161
#define C4CFN_BigIcon
Definition: C4Components.h:111
const int C4FCT_Full
Definition: C4FacetEx.h:26
const int32_t C4NetResMaxBigicon
Definition: C4Network2Res.h:36

Here is the call graph for this function:

bool C4PlayerInfo::LoadFromLocalFile ( const char *  szFilename)

Definition at line 66 of file C4PlayerInfo.cpp.

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().

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 }
C4Game Game
Definition: C4Globals.cpp:52
C4Scenario C4S
Definition: C4Game.h:74
bool Replay
Definition: C4Scenario.h:72
char PrefName[C4MaxName+1]
Definition: C4InfoCore.h:85
C4Network2 Network
Definition: C4Globals.cpp:53
const C4Network2ResCore & getCore() const
bool Load(C4Group &hGroup)
Definition: C4InfoCore.cpp:78
C4Network2Res::Ref AddByGroup(C4Group *pGrp, bool fTemp, C4Network2ResType eType, int32_t iResID=-1, const char *szResName=nullptr, bool fAllowUnloadable=false)
bool Open(C4Group &hGroup, const char *filename) const
Definition: C4Reloc.cpp:82
C4Network2Res::Ref getRefRes(int32_t iResID)
bool isEnabled() const
Definition: C4Network2.h:203
uint32_t PrefColorDw
Definition: C4InfoCore.h:99
C4Network2ResList ResList
Definition: C4Network2.h:113
C4Reloc Reloc
Definition: C4Reloc.cpp:21
uint32_t PrefColor2Dw
Definition: C4InfoCore.h:99
C4SHead Head
Definition: C4Scenario.h:230

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PlayerInfo::LoadResource ( )

Definition at line 289 of file C4PlayerInfo.cpp.

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

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 }
C4Network2Res::Ref AddByCore(const C4Network2ResCore &Core, bool fLoad=true)
C4Game Game
Definition: C4Globals.cpp:52
C4Scenario C4S
Definition: C4Game.h:74
bool Replay
Definition: C4Scenario.h:72
int32_t getID() const
Definition: C4Network2Res.h:86
C4Network2 Network
Definition: C4Globals.cpp:53
bool IsRemoved() const
Definition: C4PlayerInfo.h:164
C4Network2ResList ResList
Definition: C4Network2.h:113
const char * GetFilename() const
Definition: C4PlayerInfo.h:161
C4SHead Head
Definition: C4Scenario.h:230
bool LogF(const char *strMessage,...)
Definition: C4Log.cpp:250

Here is the call graph for this function:

void C4PlayerInfo::ResetLeagueProjectedGain ( )
inline

Definition at line 145 of file C4PlayerInfo.h.

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

146  { iLeagueProjectedGain = -1; }

Here is the caller graph for this function:

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

Definition at line 104 of file C4PlayerInfo.cpp.

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

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)

Here is the call graph for this function:

void C4PlayerInfo::SetAssociatedSavegamePlayer ( int32_t  aidSavegamePlayer)
inline

Definition at line 124 of file C4PlayerInfo.h.

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

125  { idSavegamePlayer=aidSavegamePlayer; }

Here is the caller graph for this function:

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

Definition at line 133 of file C4PlayerInfo.h.

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

134  { szAuthID = sznAuthID; }

Here is the caller graph for this function:

void C4PlayerInfo::SetColor ( DWORD  dwUseClr)
inline

Definition at line 115 of file C4PlayerInfo.h.

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

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

Here is the caller graph for this function:

void C4PlayerInfo::SetDisconnected ( )
inline

Definition at line 200 of file C4PlayerInfo.h.

References PIF_Disconnected.

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

Here is the caller graph for this function:

void C4PlayerInfo::SetFilename ( const char *  szToFilename)

Definition at line 274 of file C4PlayerInfo.cpp.

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

275 {
276  szFilename = szToFilename;
277 }

Here is the caller graph for this function:

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

Definition at line 147 of file C4PlayerInfo.h.

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

148  { if (szNewName) sForcedName.CopyValidated(szNewName); else sForcedName.Clear(); }
void Clear()
Definition: StdBuf.h:466
void CopyValidated(const char *szFromVal)

Here is the call graph for this function:

void C4PlayerInfo::SetID ( int32_t  iToID)
inline

Definition at line 114 of file C4PlayerInfo.h.

Referenced by C4PlayerInfoList::AssignPlayerIDs().

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

Here is the caller graph for this function:

void C4PlayerInfo::SetJoined ( int32_t  iNumber)

Definition at line 333 of file C4PlayerInfo.cpp.

References C4Game::FrameCounter, Game, and PIF_Joined.

Referenced by C4Player::Init().

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

Here is the caller graph for this function:

void C4PlayerInfo::SetJoinForSavegameOnly ( )
inline
void C4PlayerInfo::SetJoinIssued ( )
inline

Definition at line 112 of file C4PlayerInfo.h.

References PIF_JoinIssued.

Referenced by C4PlayerInfoList::LocalJoinUnjoinedPlayersInQueue().

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

Here is the caller graph for this function:

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.

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

Referenced by C4LeagueClient::GetAuthCheckReply().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PlayerInfo::SetLeaguePerformance ( int32_t  iNewPerf)
inline

Definition at line 137 of file C4PlayerInfo.h.

Referenced by C4Network2Reference::InitLocal().

138  { iLeaguePerformance = iNewPerf; }

Here is the caller graph for this function:

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

Definition at line 139 of file C4PlayerInfo.h.

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

140  { if (szNewProgressData) sLeagueProgressData.Copy(szNewProgressData); else sLeagueProgressData.Clear(); }
void Clear()
Definition: StdBuf.h:466
void Copy()
Definition: StdBuf.h:467

Here is the call graph for this function:

void C4PlayerInfo::SetLeagueProjectedGain ( int32_t  iProjectedGain)
inline

Definition at line 143 of file C4PlayerInfo.h.

Referenced by C4Network2::LeagueUpdateProcessReply().

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

Here is the caller graph for this function:

void C4PlayerInfo::SetOriginalColor ( DWORD  dwUseClr)
inline

Definition at line 116 of file C4PlayerInfo.h.

Referenced by C4MessageInput::ProcessCommand().

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

Here is the caller graph for this function:

void C4PlayerInfo::SetRemoved ( )

Definition at line 341 of file C4PlayerInfo.cpp.

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

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

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 }
C4Game Game
Definition: C4Globals.cpp:52
int32_t FrameCounter
Definition: C4Game.h:128

Here is the caller graph for this function:

bool C4PlayerInfo::SetSavegameResume ( C4PlayerInfo pSavegameInfo)

Definition at line 322 of file C4PlayerInfo.cpp.

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

Referenced by C4PlayerInfoList::RestoreSavegameInfos().

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 }
int32_t GetTeam() const
Definition: C4PlayerInfo.h:195
uint32_t GetColor() const
Definition: C4PlayerInfo.h:153
DWORD GetFlags()
Definition: C4PlayerInfo.h:198
int32_t GetID() const
Definition: C4PlayerInfo.h:194

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PlayerInfo::SetTeam ( int32_t  idToTeam)
inline

Definition at line 120 of file C4PlayerInfo.h.

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

120 { idTeam = idToTeam; }

Here is the caller graph for this function:

void C4PlayerInfo::SetTempFile ( )
inline

Definition at line 119 of file C4PlayerInfo.h.

References PIF_TempFile.

Referenced by C4PlayerInfoList::RecreatePlayerFiles().

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

Here is the caller graph for this function:

void C4PlayerInfo::SetToScenarioFilename ( const char *  szScenFilename)

Definition at line 279 of file C4PlayerInfo.cpp.

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

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()

Here is the call graph for this function:

void C4PlayerInfo::SetVotedOut ( )
inline

Definition at line 141 of file C4PlayerInfo.h.

References PIF_VotedOut.

142  { dwFlags |= PIF_VotedOut; }
void C4PlayerInfo::SetWinner ( )
inline

Definition at line 201 of file C4PlayerInfo.h.

References PIF_Won.

Referenced by C4Player::EvaluateLeague().

201 { dwFlags |= PIF_Won; }

Here is the caller graph for this function:


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