53 while ((pPlr =
First))
73 pPlr->ClearPointers(pObj,
false);
79 if (pPlr->Number==iPlayer)
88 if (!pPlr1 || !pPlr2)
return false;
101 if (!pPlr1 || !pPlr2)
return false;
111 if (pPlr->Position==iPosition)
119 int iDiff=255+255+255;
124 DWORD dwClr2=pPlr->ColorDw;
126 iDiff=std::min(iDiff,
138 if (pPlr->Number==iNumber)
163 if (pPlr->GetType() == eType)
172 if (pPlr->ID == iInfoID)
return pPlr;
188 if (pPlr->GetType() == eType)
199 iNumber++; fFree=
true;
201 if (pPlr->Number==iNumber)
210 return Remove(
Get(iPlayer), fDisconnect, fNoCalls);
218 if (pObj->IsPlayerObject(iPlayer))
219 pObj->AssignRemoval(
true);
225 if (!pPlr)
return false;
249 while (pPrev && pPrev->
Next!=pPlr) pPrev=pPrev->
Next;
278 assert(fScenarioInit || numbers);
281 if (szFilename && !*szFilename) szFilename =
nullptr;
295 if (szFilename)
if (
FileInUse(szFilename))
303 while (pLast && pLast->
Next) pLast=pLast->
Next;
304 if (pLast) pLast->
Next=pPlr;
else First = pPlr;
307 if (!pPlr->
Init(
GetFreeNumber(),iAtClient,szAtClientName,szFilename,fScenarioInit,pInfo, numbers))
332 char szPrefix[1024+1];
346 bool fSuccess =
true;
358 if (fStoreOnOriginal)
363 if (!PlrGroup.
Open(sTempFilename.
getData(), !fStoreOnOriginal))
366 if (!pPlr->Save(PlrGroup,
true, fStoreOnOriginal))
return false;
381 if (!fSaveLocalOnly || pPlr->LocalControl)
396 if (!pPlr)
return false;
403 Remove(pPlr,
false,
false);
414 iResult+=std::max<int32_t>(pPlr->CurrentScore-pPlr->InitialScore,0);
423 if (
SEqual(pPlr->GetName(),szName))
424 if (pPlr->Number!=iExcluding)
433 for (; cPlr; cPlr=cPlr->
Next)
454 if (pPlr->LocalControl)
456 if (cindex==iIndex)
return pPlr;
471 Remove(pPlr, fDisconnect,
false);
485 Remove(pPlr, fDisconnect,
false);
501 if (pPlr->AtClient == iClient)
511 if (
SEqual(pPlr->AtClientName, szName))
521 if (pPlr->AtClient == iClient)
523 if (cindex==iIndex)
return pPlr;
535 if (cindex==iIndex)
return pPlr;
550 Remove(pPlr, fDisconnect, fNoCalls);
561 if (cindex==iIndex)
return pPlr;
572 for (pPlr =
First; pPlr; pPlr = pPlr->
Next)
578 Remove(pPlr, fDisconnect, fNoCalls);
589 pPlr->DenumeratePointers();
595 if (pPlr->MouseControl)
596 if (pPlr->LocalControl)
605 if (!pPlr->Eliminated)
614 bool fSuccess =
true;
618 if (!pPlr->Eliminated)
619 if (!pPlr->LocalSync()) fSuccess =
false;
627 if (pPlr->IsChosingTeam())
634 if (!pForPlayer || !
First)
return;
635 int iNumber = pForPlayer->
Number;
642 if (pPrev == pForPlayer)
return;
648 while (*pOldLink && *pOldLink != pForPlayer) pOldLink = &((*pOldLink)->Next);
649 if (*pOldLink) *pOldLink = pForPlayer->
Next;
654 pForPlayer->
Next = pPrev;
661 pPrev->
Next = pForPlayer;
bool C4Group_CopyItem(const char *source, const char *target, bool no_sorting, bool reset_attributes)
const char * LoadResStr(const char *id)
bool Log(const char *szMessage)
bool LogF(const char *strMessage,...)
void SetClientPrefix(char *szFilename, const char *szClient)
int32_t Hostile(int32_t plr1, int32_t plr2)
int32_t ValidPlr(int32_t plr)
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
bool SEqualNoCase(const char *szStr1, const char *szStr2, int iLen)
void SAppendChar(char cChar, char *szStr)
void SAppend(const char *szSource, char *szTarget, int iMaxL)
bool SEqual(const char *szStr1, const char *szStr2)
size_t SLen(const char *sptr)
StdStrBuf FormatString(const char *szFmt,...)
#define GetGreenValue(rgb)
#define GetBlueValue(rgb)
bool ItemIdentical(const char *szFilename1, const char *szFilename2)
char * GetFilename(char *szPath)
bool ItemExists(const char *szItemName)
const char * getLocalName() const
const char * AtTempPath(const char *filename)
void Add(C4PacketType eType, C4ControlPacket *pCtrl)
C4RoundResults & RoundResults
C4PlayerInfoList & PlayerInfos
C4GameParameters & Parameters
C4Value GRBroadcast(const char *function, C4AulParSet *pars=nullptr, bool pass_error=false, bool reject_test=false)
bool ValidateOwners() override
bool Move(const char *filename, const char *entry_name)
bool Open(const char *group_name, bool do_create=false)
C4Network2Players Players
bool JoinLocalPlayer(const char *szLocalPlayerFilename, bool initial=false)
C4ObjectInfoList CrewInfoList
const char * GetName() const
bool Init(int32_t iNumber, int32_t iAtClient, const char *szAtClientName, const char *szFilename, bool fScenarioInit, class C4PlayerInfo *pInfo, C4ValueNumbers *)
C4PlayerType GetType() const
void NotifyOwnedObjects()
bool IsHostileTowards(const C4Player *opponent) const
char Filename[_MAX_PATH_LEN]
const char * GetName() const
C4PlayerType GetType() const
const char * GetFilename() const
C4PlayerInfo * GetPlayerInfoByID(int32_t id) const
bool DoLocalNonNetworkPlayerJoin(const char *szPlayerFile)
void ClearPointers(C4Object *pObj)
bool Remove(int iPlayer, bool fDisonnected, bool fNoCalls)
C4Player * GetAtRemoteClient(int iIndex=0) const
C4Player * Join(const char *szFilename, bool fScenarioInit, int iAtClient, const char *szAtClientName, class C4PlayerInfo *pInfo, C4ValueNumbers *)
int CheckColorDw(DWORD dwColor, C4Player *pExclude)
C4Player * GetAtClient(int iClient, int iIndex=0) const
bool Hostile(int iPlayer1, int iPlayer2) const
C4Player * GetByInfoID(int iInfoID) const
C4Player * GetByIndex(int iIndex) const
bool MouseControlTaken() const
bool RemoveUnjoined(int32_t iPlayer)
void DenumeratePointers()
C4Player * GetByName(const char *szName, int iExcluding=NO_OWNER) const
C4Player * Get(int iPlayer) const
bool FileInUse(const char *szFilename) const
int AverageScoreGain() const
bool Retire(C4Player *pPlr)
void RecheckPlayerSort(C4Player *pForPlayer)
bool RemoveAtClient(int iClient, bool fDisconnect)
bool PositionTaken(int iPosition) const
int GetCountNotEliminated() const
bool HasPlayerInTeamSelection()
bool RemoveLocal(bool fDisonnected, bool fNoCalls)
bool SynchronizeLocalFiles()
int GetIndex(C4Player *pPlr) const
void JoinNew(const char *szFilename)
bool Save(bool fSaveLocalOnly)
int GetFreeNumber() const
C4Player * GetLocalByIndex(int iIndex) const
bool CtrlRemoveAtClient(int iClient, bool fDisonnected)
bool HostilityDeclared(int iPlayer1, int iPlayer2) const
bool RemoveAtRemoteClient(bool fDisonnected, bool fNoCalls)
bool CtrlRemove(int iPlayer, bool fDisonnected)
bool Valid(int iPlayer) const
void EvaluatePlayer(C4Player *pPlr)
bool CloseViewport(int32_t player_nr, bool silent)
const char * getData() const