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  : dwFlags(0), eType(C4PT_User), iID(0), pRes(0), szFilename(), dwColor(0xffffffff),
105  dwOriginalColor(0xffffffff), dwAlternateColor(0), idSavegamePlayer(0), idTeam(0), iInGameNumber(-1),
106  iInGameJoinFrame(-1), iInGamePartFrame(-1), idExtraData(C4ID::None), sLeagueAccount(""),
107  iLeagueScore(0), iLeagueRank(0), iLeagueRankSymbol(0), iLeagueProjectedGain(-1), iLeaguePerformance(0) { }
static const C4ID None
Definition: C4Id.h:42

Member Function Documentation

void C4PlayerInfo::Clear ( )

Definition at line 34 of file C4PlayerInfo.cpp.

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

Referenced by LoadFromLocalFile(), and SetAsScriptPlayer().

35 {
36  // del temp file
38  // clear fields
39  sName.Clear(); szFilename.Clear();
40  pRes = nullptr;
41  ResCore.Clear();
42  // default fields
43  dwColor = dwOriginalColor = 0xffffffff;
44  dwAlternateColor = 0;
45  dwFlags = 0;
46  iID = idSavegamePlayer = idTeam = 0;
47  iInGameNumber = iInGameJoinFrame = iInGamePartFrame = -1;
48  sLeagueAccount = ""; iLeagueScore=iLeagueRank=0;
49  iLeagueProjectedGain = -1;
50  eType = C4PT_User;
51  idExtraData = C4ID::None;
52  iLeaguePerformance = 0;
53  sLeagueProgressData.Clear();
54 }
void Clear()
Definition: StdBuf.h:474
static const C4ID None
Definition: C4Id.h:42
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 175 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().

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

Here is the call graph for this function:

void C4PlayerInfo::DeleteTempFile ( )

Definition at line 56 of file C4PlayerInfo.cpp.

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PlayerInfo::DiscardResource ( )

Definition at line 312 of file C4PlayerInfo.cpp.

References C4Network2ResCore::Clear(), and PIF_HasRes.

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

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

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 159 of file C4PlayerInfo.h.

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

Definition at line 129 of file C4PlayerInfo.h.

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

130  { return idSavegamePlayer; }

Here is the caller graph for this function:

const char* C4PlayerInfo::getAuthID ( ) const
inline

Definition at line 186 of file C4PlayerInfo.h.

References StdStrBuf::getData().

Referenced by C4LeagueClient::AuthCheck().

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

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 156 of file C4PlayerInfo.h.

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

156 { return dwColor; } // get player color

Here is the caller graph for this function:

const char* C4PlayerInfo::GetFilename ( ) const
inline

Definition at line 164 of file C4PlayerInfo.h.

References StdStrBuf::getData().

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

DWORD C4PlayerInfo::GetFlags ( )
inline

Definition at line 201 of file C4PlayerInfo.h.

Referenced by SetSavegameResume().

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

Here is the caller graph for this function:

const char* C4PlayerInfo::GetForcedName ( ) const
inline

Definition at line 162 of file C4PlayerInfo.h.

References StdStrBuf::getData().

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

Here is the call graph for this function:

int32_t C4PlayerInfo::GetInGameNumber ( ) const
inline

Definition at line 192 of file C4PlayerInfo.h.

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

192 { 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 187 of file C4PlayerInfo.h.

References StdStrBuf::getData().

Referenced by DisconnectData::CompileFunc().

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

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 195 of file C4PlayerInfo.h.

References StdStrBuf::getData().

Referenced by C4RoundResultsPlayer::EvaluatePlayer().

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

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 194 of file C4PlayerInfo.h.

Referenced by C4Network2::LeagueUpdateProcessReply().

194 { 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 189 of file C4PlayerInfo.h.

189 { return iLeagueRank; } // returns rank on league server (0 for not assigned)
int32_t C4PlayerInfo::getLeagueRankSymbol ( ) const
inline

Definition at line 190 of file C4PlayerInfo.h.

190 { return iLeagueRankSymbol; } // returns rank symbol on league server (0 for not assigned)
int32_t C4PlayerInfo::getLeagueScore ( ) const
inline

Definition at line 188 of file C4PlayerInfo.h.

188 { return iLeagueScore; } // returns score number on league server (0 for not assigned)
int32_t C4PlayerInfo::getLeagueScoreProjected ( ) const
inline

Definition at line 191 of file C4PlayerInfo.h.

191 { return iLeagueScoreProjected; } // returns score on league server in case of win (0 for not assigned)
uint32_t C4PlayerInfo::GetLobbyColor ( ) const

Definition at line 130 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().

131 {
132  // special case if random teams and team colors are enabled in lobby:
133  // Unjoined players do not show their team! Instead, they just display their original color
135  if (Game.Teams.IsTeamColors())
136  if (Game.Teams.GetTeamByID(GetTeam()))
138  return GetOriginalColor();
139  // otherwise, just show the normal player color
140  return GetColor();
141 }
C4Game Game
Definition: C4Globals.cpp:52
bool IsTeamColors() const
Definition: C4Teams.h:170
C4Team * GetTeamByID(int32_t iID) const
Definition: C4Teams.cpp:384
uint32_t GetOriginalColor() const
Definition: C4PlayerInfo.h:158
C4TeamList & Teams
Definition: C4Game.h:72
int32_t GetAssociatedSavegamePlayerID() const
Definition: C4PlayerInfo.h:129
int32_t GetTeam() const
Definition: C4PlayerInfo.h:198
uint32_t GetColor() const
Definition: C4PlayerInfo.h:156
TeamDist GetTeamDist() const
Definition: C4Teams.h:209
bool HasJoined() const
Definition: C4PlayerInfo.h:168

Here is the call graph for this function:

Here is the caller graph for this function:

StdStrBuf C4PlayerInfo::GetLobbyName ( ) const

Definition at line 143 of file C4PlayerInfo.cpp.

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

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

Here is the call graph for this function:

const char * C4PlayerInfo::GetLocalJoinFilename ( ) const

Definition at line 122 of file C4PlayerInfo.cpp.

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

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

123 {
124  // preferred: by resource
125  if (pRes) return pRes->getFile();
126  // if no resource is known (replay or non-net), return filename
127  return szFilename.getData();
128 }
const char * getData() const
Definition: StdBuf.h:450
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 160 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().

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

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 158 of file C4PlayerInfo.h.

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

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

Here is the caller graph for this function:

const char* C4PlayerInfo::GetOriginalName ( ) const
inline

Definition at line 161 of file C4PlayerInfo.h.

References StdStrBuf::getData().

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

Here is the call graph for this function:

C4Network2Res* C4PlayerInfo::GetRes ( ) const
inline

Definition at line 166 of file C4PlayerInfo.h.

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

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

Here is the caller graph for this function:

C4ID C4PlayerInfo::GetScriptPlayerExtraID ( ) const
inline

Definition at line 181 of file C4PlayerInfo.h.

Referenced by C4Player::Init().

181 { return idExtraData; }

Here is the caller graph for this function:

int32_t C4PlayerInfo::GetTeam ( ) const
inline
bool C4PlayerInfo::HasAutoGeneratedColor ( )
inline

Definition at line 183 of file C4PlayerInfo.h.

183 { return dwColor != dwOriginalColor; } // whether the player got a new color assigned due to color conflict
bool C4PlayerInfo::HasJoined ( ) const
inline

Definition at line 168 of file C4PlayerInfo.h.

References PIF_Joined.

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

168 { 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 170 of file C4PlayerInfo.h.

References PIF_Joined, and PIF_JoinIssued.

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

170 { 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 171 of file C4PlayerInfo.h.

References PIF_Joined, and PIF_Removed.

Referenced by C4PlayerInfoList::GetJoinPendingPlayerCount().

171 { 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 165 of file C4PlayerInfo.cpp.

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

166 {
167  // team win/solo win
168  C4Team *pTeam;
169  if (idTeam && (pTeam = Game.Teams.GetTeamByID(idTeam)))
170  return pTeam->HasWon();
171  else
172  return HasWon();
173 }
C4Game Game
Definition: C4Globals.cpp:52
bool HasWon() const
Definition: C4PlayerInfo.h:184
Definition: C4Teams.h:30
C4Team * GetTeamByID(int32_t iID) const
Definition: C4Teams.cpp:384
C4TeamList & Teams
Definition: C4Game.h:72
bool HasWon() const
Definition: C4Teams.cpp:235

Here is the call graph for this function:

bool C4PlayerInfo::HasWon ( ) const
inline

Definition at line 184 of file C4PlayerInfo.h.

References PIF_Won.

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

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

Here is the caller graph for this function:

bool C4PlayerInfo::IsAttributesFixed ( ) const
inline

Definition at line 177 of file C4PlayerInfo.h.

References PIF_AttributesFixed.

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

Definition at line 178 of file C4PlayerInfo.h.

References PIF_Invisible.

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

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

Here is the caller graph for this function:

bool C4PlayerInfo::IsJoined ( ) const
inline

Definition at line 169 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().

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4PlayerInfo::IsJoinForSavegameOnly ( )
inline

Definition at line 133 of file C4PlayerInfo.h.

References PIF_JoinedForSavegameOnly.

bool C4PlayerInfo::IsLeagueProjectedGainValid ( ) const
inline

Definition at line 193 of file C4PlayerInfo.h.

Referenced by C4PlayerInfoList::ResetLeagueProjectedGain().

193 { return iLeagueProjectedGain>=0; }

Here is the caller graph for this function:

bool C4PlayerInfo::IsNoEliminationCheck ( ) const
inline

Definition at line 182 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 179 of file C4PlayerInfo.h.

References PIF_NoScenarioInit.

Referenced by C4Player::Init().

179 { return !(dwFlags & PIF_NoScenarioInit); }

Here is the caller graph for this function:

bool C4PlayerInfo::IsScenarioSaveDesired ( ) const
inline

Definition at line 180 of file C4PlayerInfo.h.

References PIF_NoScenarioSave.

Referenced by C4PlayerInfoList::SetAsRestoreInfos().

180 { return !(dwFlags & PIF_NoScenarioSave); }

Here is the caller graph for this function:

bool C4PlayerInfo::IsTempFile ( ) const
inline

Definition at line 199 of file C4PlayerInfo.h.

References PIF_TempFile.

Referenced by C4PlayerInfoList::RecreatePlayers().

199 { 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 174 of file C4PlayerInfo.h.

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

174 { if (eAttr == PLRATT_Color) return IsUsingColor(); else return IsUsingName(); }
bool IsUsingColor() const
Definition: C4PlayerInfo.h:172
bool IsUsingName() const
Definition: C4PlayerInfo.h:173

Here is the call graph for this function:

bool C4PlayerInfo::IsUsingColor ( ) const
inline

Definition at line 172 of file C4PlayerInfo.h.

References IsRemoved().

Referenced by IsUsingAttribute().

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4PlayerInfo::IsUsingName ( ) const
inline

Definition at line 173 of file C4PlayerInfo.h.

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

Referenced by IsUsingAttribute().

173 { 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:167
size_t getLength() const
Definition: StdBuf.h:453

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4PlayerInfo::IsUsingPlayerFile ( ) const
inline

Definition at line 175 of file C4PlayerInfo.h.

References IsRemoved().

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

Here is the call graph for this function:

bool C4PlayerInfo::IsUsingTeam ( ) const
inline

Definition at line 176 of file C4PlayerInfo.h.

References IsRemoved().

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4PlayerInfo::LoadBigIcon ( C4FacetSurface fctTarget)

Definition at line 352 of file C4PlayerInfo.cpp.

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

353 {
354  bool fSuccess = false;
355  // load BigIcon.png of player into target facet; return false if no bigicon present or player file not yet loaded
356  C4Group Plr;
357  C4Network2Res *pRes = nullptr;
358  bool fIncompleteRes = false;
359  if ((pRes = GetRes()))
360  if (!pRes->isComplete())
361  fIncompleteRes = true;
362  size_t iBigIconSize=0;
363  if (!fIncompleteRes)
364  if (Plr.Open(pRes ? pRes->getFile() : GetFilename()))
365  if (Plr.AccessEntry(C4CFN_BigIcon, &iBigIconSize))
366  if (iBigIconSize<=C4NetResMaxBigicon*1024)
367  if (fctTarget.Load(Plr, C4CFN_BigIcon, C4FCT_Full, C4FCT_Full, false, 0))
368  fSuccess = true;
369  return fSuccess;
370 }
C4Network2Res * GetRes() const
Definition: C4PlayerInfo.h:166
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:164
#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 69 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().

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

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

Here is the call graph for this function:

void C4PlayerInfo::ResetLeagueProjectedGain ( )
inline

Definition at line 148 of file C4PlayerInfo.h.

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

149  { 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 107 of file C4PlayerInfo.cpp.

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

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

Here is the call graph for this function:

void C4PlayerInfo::SetAssociatedSavegamePlayer ( int32_t  aidSavegamePlayer)
inline

Definition at line 127 of file C4PlayerInfo.h.

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

128  { idSavegamePlayer=aidSavegamePlayer; }

Here is the caller graph for this function:

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

Definition at line 136 of file C4PlayerInfo.h.

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

137  { szAuthID = sznAuthID; }

Here is the caller graph for this function:

void C4PlayerInfo::SetColor ( DWORD  dwUseClr)
inline

Definition at line 118 of file C4PlayerInfo.h.

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

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

Here is the caller graph for this function:

void C4PlayerInfo::SetDisconnected ( )
inline

Definition at line 203 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 277 of file C4PlayerInfo.cpp.

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

278 {
279  szFilename = szToFilename;
280 }

Here is the caller graph for this function:

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

Definition at line 150 of file C4PlayerInfo.h.

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

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

Here is the call graph for this function:

void C4PlayerInfo::SetID ( int32_t  iToID)
inline

Definition at line 117 of file C4PlayerInfo.h.

Referenced by C4PlayerInfoList::AssignPlayerIDs().

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

Here is the caller graph for this function:

void C4PlayerInfo::SetJoined ( int32_t  iNumber)

Definition at line 336 of file C4PlayerInfo.cpp.

References C4Game::FrameCounter, Game, and PIF_Joined.

Referenced by C4Player::Init().

337 {
338  // mark as joined in current frame
339  iInGameNumber = iNumber;
340  iInGameJoinFrame = Game.FrameCounter;
341  dwFlags |= PIF_Joined;
342 }
C4Game Game
Definition: C4Globals.cpp:52
int32_t FrameCounter
Definition: C4Game.h:130

Here is the caller graph for this function:

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

Definition at line 115 of file C4PlayerInfo.h.

References PIF_JoinIssued.

Referenced by C4PlayerInfoList::LocalJoinUnjoinedPlayersInQueue().

115 { 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 138 of file C4PlayerInfo.h.

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

Referenced by C4LeagueClient::GetAuthCheckReply().

139  { sLeagueAccount.CopyValidated(szAccount); sClanTag.CopyValidated(szNewClanTag); iLeagueScore = iScore; iLeagueRank = iRank; iLeagueRankSymbol = iRankSymbol; sLeagueProgressData.Copy(szProgressData); }
void Copy()
Definition: StdBuf.h:475
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 140 of file C4PlayerInfo.h.

Referenced by C4Network2Reference::InitLocal().

141  { iLeaguePerformance = iNewPerf; }

Here is the caller graph for this function:

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

Definition at line 142 of file C4PlayerInfo.h.

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

143  { if (szNewProgressData) sLeagueProgressData.Copy(szNewProgressData); else sLeagueProgressData.Clear(); }
void Clear()
Definition: StdBuf.h:474
void Copy()
Definition: StdBuf.h:475

Here is the call graph for this function:

void C4PlayerInfo::SetLeagueProjectedGain ( int32_t  iProjectedGain)
inline

Definition at line 146 of file C4PlayerInfo.h.

Referenced by C4Network2::LeagueUpdateProcessReply().

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

Here is the caller graph for this function:

void C4PlayerInfo::SetOriginalColor ( DWORD  dwUseClr)
inline

Definition at line 119 of file C4PlayerInfo.h.

Referenced by C4MessageInput::ProcessCommand().

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

Here is the caller graph for this function:

void C4PlayerInfo::SetRemoved ( )

Definition at line 344 of file C4PlayerInfo.cpp.

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

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

345 {
346  // mark as removed - always marks as previously joined, too
347  dwFlags |= PIF_Joined | PIF_Removed;
348  // remember removal frame
349  iInGamePartFrame = Game.FrameCounter;
350 }
C4Game Game
Definition: C4Globals.cpp:52
int32_t FrameCounter
Definition: C4Game.h:130

Here is the caller graph for this function:

bool C4PlayerInfo::SetSavegameResume ( C4PlayerInfo pSavegameInfo)

Definition at line 325 of file C4PlayerInfo.cpp.

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

Referenced by C4PlayerInfoList::RestoreSavegameInfos().

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

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 123 of file C4PlayerInfo.h.

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

123 { idTeam = idToTeam; }

Here is the caller graph for this function:

void C4PlayerInfo::SetTempFile ( )
inline

Definition at line 122 of file C4PlayerInfo.h.

References PIF_TempFile.

Referenced by C4PlayerInfoList::RecreatePlayerFiles().

122 { 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 282 of file C4PlayerInfo.cpp.

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

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

Here is the call graph for this function:

void C4PlayerInfo::SetVotedOut ( )
inline

Definition at line 144 of file C4PlayerInfo.h.

References PIF_VotedOut.

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

Definition at line 204 of file C4PlayerInfo.h.

References PIF_Won.

Referenced by C4Player::EvaluateLeague().

204 { dwFlags |= PIF_Won; }

Here is the caller graph for this function:


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