OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4RoundResultsPlayer Class Reference

#include <C4RoundResults.h>

Public Member Functions

 C4RoundResultsPlayer ()
 
 C4RoundResultsPlayer (const C4RoundResultsPlayer &cpy)
 
void CompileFunc (StdCompiler *pComp)
 
int32_t GetID () const
 
C4FacetGetBigIcon ()
 
uint32_t GetTotalPlayingTime () const
 
bool IsScoreOldValid () const
 
int32_t GetScoreOld () const
 
bool IsScoreNewValid () const
 
int32_t GetScoreNew () const
 
const char * GetCustomEvaluationStrings ()
 
int32_t GetLeagueScoreNew () const
 
bool IsLeagueScoreNewValid () const
 
int32_t GetLeagueScoreGain () const
 
int32_t GetLeagueRankNew () const
 
int32_t GetLeagueRankSymbolNew () const
 
int32_t GetLeaguePerformance () const
 
void EvaluateLeague (C4RoundResultsPlayer *pLeaguePlayer)
 
void EvaluatePlayer (C4Player *pPlr)
 
void SetID (int32_t idNew)
 
void AddCustomEvaluationString (const char *szCustomString)
 
void SetLeaguePerformance (int32_t iNewPerf)
 
bool operator== (const C4RoundResultsPlayer &cmp)
 
C4RoundResultsPlayeroperator= (const C4RoundResultsPlayer &cpy)
 

Detailed Description

Definition at line 32 of file C4RoundResults.h.

Constructor & Destructor Documentation

C4RoundResultsPlayer::C4RoundResultsPlayer ( )
inline

Definition at line 61 of file C4RoundResults.h.

61 : id(0), iTotalPlayingTime(0), iScoreOld(-1), iScoreNew(-1), iLeagueScoreNew(-1), iLeagueScoreGain(0), iLeagueRankNew(0), iLeagueRankSymbolNew(0), iLeaguePerformance(0), sLeagueProgressData(), eLeagueStatus(RRPLS_Unknown) {}
C4RoundResultsPlayer::C4RoundResultsPlayer ( const C4RoundResultsPlayer cpy)
inline

Definition at line 62 of file C4RoundResults.h.

62 { *this=cpy; }

Member Function Documentation

void C4RoundResultsPlayer::AddCustomEvaluationString ( const char *  szCustomString)

Definition at line 95 of file C4RoundResults.cpp.

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

Referenced by C4RoundResults::AddCustomEvaluationString().

96 {
97  if (sCustomEvaluationStrings.getLength()) sCustomEvaluationStrings.Append(" ");
98  sCustomEvaluationStrings.Append(szCustomString);
99 }
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:527
size_t getLength() const
Definition: StdBuf.h:453

Here is the call graph for this function:

Here is the caller graph for this function:

void C4RoundResultsPlayer::CompileFunc ( StdCompiler pComp)

Definition at line 31 of file C4RoundResults.cpp.

References mkNamingAdapt(), and StdCompiler::Value().

32 {
33  // remember to adjust operator = and == when adding values here!
34  pComp->Value(mkNamingAdapt(id, "ID", 0));
35  // pComp->Value(mkNamingAdapt(fctBigIcon, "Icon", C4TargetFacet())); - not possible
36  pComp->Value(mkNamingAdapt(iTotalPlayingTime, "TotalPlayingTime", 0u));
37  pComp->Value(mkNamingAdapt(iScoreOld, "SettlementScoreOld", -1));
38  pComp->Value(mkNamingAdapt(iScoreNew, "SettlementScoreNew", -1));
39  pComp->Value(mkNamingAdapt(iLeagueScoreNew, "Score", -1)); // name used in league reply!
40  pComp->Value(mkNamingAdapt(iLeagueScoreGain, "GameScore", -1)); // name used in league reply!
41  pComp->Value(mkNamingAdapt(iLeagueRankNew, "Rank", 0)); // name used in league reply!
42  pComp->Value(mkNamingAdapt(iLeagueRankSymbolNew, "RankSymbol", 0)); // name used in league reply!
43  pComp->Value(mkNamingAdapt(sLeagueProgressData, "LeagueProgressData", StdCopyStrBuf()));
44  StdEnumEntry<LeagueStatus> LeagueStatusEntries[] =
45  {
46  { "", RRPLS_Unknown },
47  { "Lost", RRPLS_Lost },
48  { "Won", RRPLS_Won },
49  };
50  pComp->Value(mkNamingAdapt(mkEnumAdaptT<uint8_t>(eLeagueStatus, LeagueStatusEntries), "Status", RRPLS_Unknown)); // name used in league reply!
51 }
Definition: StdAdaptors.h:760
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:93
void Value(const T &rStruct)
Definition: StdCompiler.h:171

Here is the call graph for this function:

void C4RoundResultsPlayer::EvaluateLeague ( C4RoundResultsPlayer pLeaguePlayer)

Definition at line 83 of file C4RoundResults.cpp.

Referenced by C4RoundResults::EvaluateLeague().

84 {
85  assert(pLeaguePlayerInfo);
86  //
87  // copy league info
88  iLeagueScoreNew = pLeaguePlayerInfo->iLeagueScoreNew;
89  iLeagueScoreGain = pLeaguePlayerInfo->iLeagueScoreGain;
90  iLeagueRankNew = pLeaguePlayerInfo->iLeagueRankNew;
91  iLeagueRankSymbolNew = pLeaguePlayerInfo->iLeagueRankSymbolNew;
92  sLeagueProgressData =pLeaguePlayerInfo->sLeagueProgressData;
93 }

Here is the caller graph for this function:

void C4RoundResultsPlayer::EvaluatePlayer ( C4Player pPlr)

Definition at line 53 of file C4RoundResults.cpp.

References C4Player::BigIcon, C4FacetSurface::Clear(), StdStrBuf::Copy(), C4FacetSurface::Create(), C4Facet::Draw(), C4Player::Evaluated, C4RoundResult::FinalScore, C4Player::GetInfo(), C4PlayerInfo::GetLeagueProgressData(), C4Facet::Hgt, C4PlayerInfoCore::LastRound, C4Facet::Surface, C4PlayerInfoCore::TotalPlayingTime, C4PlayerInfoCore::TotalScore, and C4Facet::Wdt.

Referenced by C4RoundResults::EvaluatePlayer().

54 {
55  assert(pPlr);
56  // set fields by player
57  iTotalPlayingTime = pPlr->TotalPlayingTime;
58  if (pPlr->Evaluated)
59  {
60  iScoreNew = pPlr->TotalScore;
61  iScoreOld = iScoreNew - pPlr->LastRound.FinalScore;
62  }
63  else
64  {
65  // player not evaluated (e.g., removed by disconnect): Old score known only
66  iScoreOld = pPlr->TotalScore;
67  }
68  // load icon from player
69  fctBigIcon.Clear();
70  if (pPlr->BigIcon.Surface)
71  {
72  fctBigIcon.Create(pPlr->BigIcon.Wdt, pPlr->BigIcon.Hgt);
73  pPlr->BigIcon.Draw(fctBigIcon);
74  }
75  // progress data by player
76  C4PlayerInfo *pInfo = pPlr->GetInfo();
77  if (pInfo)
78  {
79  sLeagueProgressData.Copy(pInfo->GetLeagueProgressData());
80  }
81 }
class C4PlayerInfo * GetInfo()
Definition: C4Player.cpp:1555
int32_t TotalPlayingTime
Definition: C4InfoCore.h:92
const char * GetLeagueProgressData() const
Definition: C4PlayerInfo.h:195
C4FacetSurface BigIcon
Definition: C4Player.h:140
void Draw(C4Facet &cgo, bool fAspect=true, int32_t iPhaseX=0, int32_t iPhaseY=0, bool fTransparent=true)
Definition: C4Facet.cpp:154
bool Evaluated
Definition: C4Player.h:87
int32_t FinalScore
Definition: C4InfoCore.h:72
int32_t TotalScore
Definition: C4InfoCore.h:90
float Hgt
Definition: C4Facet.h:120
bool Create(int iWdt, int iHgt, int iWdt2=C4FCT_Full, int iHgt2=C4FCT_Full)
Definition: C4FacetEx.cpp:54
C4Surface * Surface
Definition: C4Facet.h:119
void Copy()
Definition: StdBuf.h:475
float Wdt
Definition: C4Facet.h:120
void Clear()
Definition: C4FacetEx.h:44
C4RoundResult LastRound
Definition: C4InfoCore.h:93

Here is the call graph for this function:

Here is the caller graph for this function:

C4Facet& C4RoundResultsPlayer::GetBigIcon ( )
inline

Definition at line 67 of file C4RoundResults.h.

67 { return fctBigIcon; }
const char* C4RoundResultsPlayer::GetCustomEvaluationStrings ( )
inline

Definition at line 73 of file C4RoundResults.h.

References StdStrBuf::getData().

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

Here is the call graph for this function:

int32_t C4RoundResultsPlayer::GetID ( ) const
inline

Definition at line 66 of file C4RoundResults.h.

Referenced by C4RoundResults::EvaluateLeague().

66 { return id; }

Here is the caller graph for this function:

int32_t C4RoundResultsPlayer::GetLeaguePerformance ( ) const
inline

Definition at line 79 of file C4RoundResults.h.

79 { return iLeaguePerformance; }
int32_t C4RoundResultsPlayer::GetLeagueRankNew ( ) const
inline

Definition at line 77 of file C4RoundResults.h.

77 { return iLeagueRankNew; } // returns rank on league server after round evaluation (0 for not assigned)
int32_t C4RoundResultsPlayer::GetLeagueRankSymbolNew ( ) const
inline

Definition at line 78 of file C4RoundResults.h.

78 { return iLeagueRankSymbolNew; }
int32_t C4RoundResultsPlayer::GetLeagueScoreGain ( ) const
inline

Definition at line 76 of file C4RoundResults.h.

76 { return iLeagueScoreGain; }
int32_t C4RoundResultsPlayer::GetLeagueScoreNew ( ) const
inline

Definition at line 74 of file C4RoundResults.h.

74 { return iLeagueScoreNew; } // returns score number on league server after round evaluation (0 for not assigned)
int32_t C4RoundResultsPlayer::GetScoreNew ( ) const
inline

Definition at line 72 of file C4RoundResults.h.

72 { return iScoreNew; }
int32_t C4RoundResultsPlayer::GetScoreOld ( ) const
inline

Definition at line 70 of file C4RoundResults.h.

70 { return iScoreOld; }
uint32_t C4RoundResultsPlayer::GetTotalPlayingTime ( ) const
inline

Definition at line 68 of file C4RoundResults.h.

68 { return iTotalPlayingTime; }
bool C4RoundResultsPlayer::IsLeagueScoreNewValid ( ) const
inline

Definition at line 75 of file C4RoundResults.h.

75 { return iLeagueScoreNew>=0; }
bool C4RoundResultsPlayer::IsScoreNewValid ( ) const
inline

Definition at line 71 of file C4RoundResults.h.

71 { return iScoreNew>=0; }
bool C4RoundResultsPlayer::IsScoreOldValid ( ) const
inline

Definition at line 69 of file C4RoundResults.h.

69 { return iScoreOld>=0; }
C4RoundResultsPlayer & C4RoundResultsPlayer::operator= ( const C4RoundResultsPlayer cpy)

Definition at line 118 of file C4RoundResults.cpp.

119 {
120  if (this == &cpy) return *this;
121  // assign all xcept icon
122  id = cpy.id;
123  iTotalPlayingTime = cpy.iTotalPlayingTime;
124  iScoreOld = cpy.iScoreOld;
125  iScoreNew = cpy.iScoreNew;
126  sCustomEvaluationStrings = cpy.sCustomEvaluationStrings;
127  iLeagueScoreNew = cpy.iLeagueScoreNew;
128  iLeagueScoreGain = cpy.iLeagueScoreGain;
129  iLeagueRankNew = cpy.iLeagueRankNew;
130  iLeagueRankSymbolNew = cpy.iLeagueRankSymbolNew;
131  eLeagueStatus = cpy.eLeagueStatus;
132  sLeagueProgressData = cpy.sLeagueProgressData;
133  return *this;
134 }
bool C4RoundResultsPlayer::operator== ( const C4RoundResultsPlayer cmp)

Definition at line 101 of file C4RoundResults.cpp.

102 {
103  // cmp all xcept icon
104  if (id != cmp.id) return false;
105  if (iTotalPlayingTime != cmp.iTotalPlayingTime) return false;
106  if (iScoreOld != cmp.iScoreOld) return false;
107  if (iScoreNew != cmp.iScoreNew) return false;
108  if (sCustomEvaluationStrings != cmp.sCustomEvaluationStrings) return false;
109  if (iLeagueScoreNew != cmp.iLeagueScoreNew) return false;
110  if (iLeagueScoreGain != cmp.iLeagueScoreGain) return false;
111  if (iLeagueRankNew != cmp.iLeagueRankNew) return false;
112  if (iLeagueRankSymbolNew != cmp.iLeagueRankSymbolNew) return false;
113  if (eLeagueStatus != cmp.eLeagueStatus) return false;
114  if (sLeagueProgressData != cmp.sLeagueProgressData) return false;
115  return true;
116 }
void C4RoundResultsPlayer::SetID ( int32_t  idNew)
inline

Definition at line 84 of file C4RoundResults.h.

Referenced by C4RoundResultsPlayers::GetCreateByID().

84 { this->id=idNew; }

Here is the caller graph for this function:

void C4RoundResultsPlayer::SetLeaguePerformance ( int32_t  iNewPerf)
inline

Definition at line 86 of file C4RoundResults.h.

Referenced by C4RoundResults::SetLeaguePerformance().

86 { iLeaguePerformance = iNewPerf; }

Here is the caller graph for this function:


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