45 {
"", RRPLS_Unknown },
46 {
"Lost", RRPLS_Lost },
49 pComp->
Value(
mkNamingAdapt(mkEnumAdaptT<uint8_t>(eLeagueStatus, LeagueStatusEntries),
"Status", RRPLS_Unknown));
84 assert(pLeaguePlayerInfo);
87 iLeagueScoreNew = pLeaguePlayerInfo->iLeagueScoreNew;
88 iLeagueScoreGain = pLeaguePlayerInfo->iLeagueScoreGain;
89 iLeagueRankNew = pLeaguePlayerInfo->iLeagueRankNew;
90 iLeagueRankSymbolNew = pLeaguePlayerInfo->iLeagueRankSymbolNew;
91 sLeagueProgressData =pLeaguePlayerInfo->sLeagueProgressData;
96 if (sCustomEvaluationStrings.
getLength()) sCustomEvaluationStrings.
Append(
" ");
97 sCustomEvaluationStrings.
Append(szCustomString);
103 if (
id != cmp.id)
return false;
104 if (iTotalPlayingTime != cmp.iTotalPlayingTime)
return false;
105 if (iScoreOld != cmp.iScoreOld)
return false;
106 if (iScoreNew != cmp.iScoreNew)
return false;
107 if (sCustomEvaluationStrings != cmp.sCustomEvaluationStrings)
return false;
108 if (iLeagueScoreNew != cmp.iLeagueScoreNew)
return false;
109 if (iLeagueScoreGain != cmp.iLeagueScoreGain)
return false;
110 if (iLeagueRankNew != cmp.iLeagueRankNew)
return false;
111 if (iLeagueRankSymbolNew != cmp.iLeagueRankSymbolNew)
return false;
112 if (eLeagueStatus != cmp.eLeagueStatus)
return false;
113 if (sLeagueProgressData != cmp.sLeagueProgressData)
return false;
119 if (
this == &cpy)
return *
this;
122 iTotalPlayingTime = cpy.iTotalPlayingTime;
123 iScoreOld = cpy.iScoreOld;
124 iScoreNew = cpy.iScoreNew;
125 sCustomEvaluationStrings = cpy.sCustomEvaluationStrings;
126 iLeagueScoreNew = cpy.iLeagueScoreNew;
127 iLeagueScoreGain = cpy.iLeagueScoreGain;
128 iLeagueRankNew = cpy.iLeagueRankNew;
129 iLeagueRankSymbolNew = cpy.iLeagueRankSymbolNew;
130 eLeagueStatus = cpy.eLeagueStatus;
131 sLeagueProgressData = cpy.sLeagueProgressData;
140 while (iPlayerCount)
delete ppPlayers[--iPlayerCount];
149 if (deserializing)
Clear();
150 int32_t iTemp = iPlayerCount;
151 pComp->
Value(mkNamingCountAdapt<int32_t>(iTemp,
"Player"));
153 { pComp->
excCorrupt(
"player count out of range");
return; }
155 if (deserializing && iTemp > iPlayerCapacity)
157 GrowList(iTemp - iPlayerCapacity);
158 iPlayerCount = iTemp;
159 ZeroMem(ppPlayers,
sizeof(*ppPlayers) * iPlayerCount);
164 mkPtrAdaptNoNull<C4RoundResultsPlayer>(*ppPlayers);
169 if (idx>=0 && idx<iPlayerCount)
170 return ppPlayers[idx];
177 for (int32_t idx=0; idx<iPlayerCount; ++idx)
178 if (ppPlayers[idx]->GetID() ==
id)
179 return ppPlayers[idx];
183 void C4RoundResultsPlayers::GrowList(
size_t iByVal)
200 if (iPlayerCount == iPlayerCapacity) GrowList(4);
201 ppPlayers[iPlayerCount++] = pNewPlayer;
221 if (iPlayerCount != cmp.iPlayerCount)
return false;
222 for (int32_t i = 0; i < iPlayerCount; ++i)
223 if (!(*ppPlayers[i] == *cmp.ppPlayers[i]))
246 sCustomEvaluationStrings.
Clear();
247 iLeaguePerformance = 0;
250 fHideSettlementScore=
false;
257 fHideSettlementScore=
true;
258 else fHideSettlementScore=
false;
264 if (deserializing)
Clear();
287 int32_t cnt;
C4ID idGoal;
291 bool fFulfilled =
false;;
300 if (fFulfilled) FulfilledGoalList.
SetIDCount(idGoal, 1,
true);
307 C4Player *pFirstLocalPlayer = ::Players.GetLocalByIndex(0);
308 int32_t iFirstLocalPlayer = pFirstLocalPlayer ? pFirstLocalPlayer->
Number :
NO_OWNER;
318 Statistics = stats.ToJSON();
322 DebugLogF(
"ERROR: cannot serialize CollectStatistics() result: %s", e.
what());
331 this->eNetResult = eNetResult;
332 if (szResultMsg) sNetResult.
Copy(szResultMsg);
else sNetResult.
Clear();
364 sCustomEvaluationStrings.
Append(szCustomString);
375 fHideSettlementScore=fHide;
380 return fHideSettlementScore;
388 iLeaguePerformance = iNewPerf;
400 return iLeaguePerformance;
403 return pPlr->GetLeaguePerformance();
415 if (!CompileFromBuf_LogWarn<StdCompilerINIRead>(
mkNamingAdapt(*
this,
"RoundResults"), Buf, szFilename))
return false;
430 if (!hGroup.
Add(szFilename, Buf,
false,
true))
C4Def * C4Id2Def(C4ID id)
#define PSF_CollectStatistics
C4AulScriptEngine ScriptEngine
bool DebugLogF(const char *strMessage ...)
const int32_t C4MaxPlayer
std::enable_if< std::is_pod< T >::value >::type ZeroMem(T *lpMem, size_t dwSize)
StdArrayAdapt< T, M > mkArrayAdaptMap(T *pArray, int iSize, M &&map)
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
C4PropListStatic * GetPropList()
void Draw(C4Facet &cgo, bool fAspect=true, int32_t iPhaseX=0, int32_t iPhaseY=0, bool fTransparent=true)
bool Create(int iWdt, int iHgt, int iWdt2=C4FCT_Full, int iHgt2=C4FCT_Full)
C4RoundResults & RoundResults
bool DeleteEntry(const char *filename, bool do_recycle=false)
bool Add(const char *filename, const char *entry_name)
bool LoadEntryString(const char *entry_name, StdStrBuf *buffer)
bool SetIDCount(C4ID c_id, int32_t iCount, bool fAddNewID=false)
const char * what() const noexcept override
C4ID GetListID(int32_t dwCategory, int index) const
C4Object * Find(C4Def *def, int owner=ANY_OWNER, DWORD dwOCF=OCF_All)
void CompileFunc(StdCompiler *pComp) override
C4RoundResultsPlayers Players
StdCopyStrBuf sResultsString
class C4PlayerInfo * GetInfo()
const char * GetLeagueProgressData() const
C4Value Call(C4PropertyName k, C4AulParSet *pPars=nullptr, bool fPassErrors=false)
void EvaluatePlayer(C4Player *pPlr)
void EvaluateLeague(const char *szResultMsg, bool fSuccess, const C4RoundResultsPlayers &rLeagueInfo)
bool Save(C4Group &hGroup, const char *szFilename=C4CFN_RoundResults)
void EvaluateNetwork(NetResult eResult, const char *szResultsString)
void CompileFunc(StdCompiler *pComp)
bool Load(C4Group &hGroup, const char *szFilename=C4CFN_RoundResults)
bool HasNetResult() const
static void EvaluateGoals(C4IDList &GoalList, C4IDList &FulfilledGoalList, int32_t iPlayerNumber)
void HideSettlementScore(bool fHide=true)
void AddCustomEvaluationString(const char *szCustomString, int32_t idPlayer)
void SetLeaguePerformance(int32_t iNewPerf, int32_t idPlayer=0)
int32_t GetLeaguePerformance(int32_t idPlayer=0) const
bool SettlementScoreIsHidden()
void SetLeaguePerformance(int32_t iNewPerf)
void EvaluatePlayer(C4Player *pPlr)
bool operator==(const C4RoundResultsPlayer &cmp)
void AddCustomEvaluationString(const char *szCustomString)
C4RoundResultsPlayer & operator=(const C4RoundResultsPlayer &cpy)
void EvaluateLeague(C4RoundResultsPlayer *pLeaguePlayer)
void SetID(int32_t idNew)
void CompileFunc(StdCompiler *pComp)
C4RoundResultsPlayer * GetCreateByID(int32_t id)
C4RoundResultsPlayers & operator=(const C4RoundResultsPlayers &cpy)
bool operator==(const C4RoundResultsPlayers &cmp)
C4RoundResultsPlayer * GetByID(int32_t id) const
void Add(C4RoundResultsPlayer *pNewPlayer)
C4RoundResultsPlayer * GetByIndex(int32_t idx) const
void CompileFunc(StdCompiler *pComp)
void excCorrupt(const char *szMessage,...)
void Value(const T &rStruct)
virtual bool isDeserializer()
void AppendChar(char cChar)
void Append(const char *pnData, size_t iChars)