Go to the documentation of this file.
1 /*
2  * OpenClonk,
3  *
4  * Copyright (c) 1998-2000, Matthes Bender
5  * Copyright (c) 2001-2009, RedWolf Design GmbH,
6  * Copyright (c) 2009-2016, The OpenClonk Team and contributors
7  *
8  * Distributed under the terms of the ISC license; see accompanying file
9  * "COPYING" for details.
10  *
11  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
12  * See accompanying file "TRADEMARK" for details.
13  *
14  * To redistribute this file separately, substitute the full license texts
15  * for the above references.
16  */
18 /* Dynamic list to hold runtime player data */
20 #ifndef INC_C4PlayerList
21 #define INC_C4PlayerList
23 #include "control/C4PlayerInfo.h"
26 {
27 public:
28  C4PlayerList();
29  ~C4PlayerList();
30 public:
32 public:
33  void Default();
34  void Clear();
35  void Execute();
36  void DenumeratePointers();
37  void ClearPointers(C4Object *pObj);
38  int GetCount() const;
39  int GetCount(C4PlayerType eType) const;
40  int GetIndex(C4Player *pPlr) const;
41  int GetCountNotEliminated() const;
42  int AverageScoreGain() const;
43  C4Player *Get(int iPlayer) const;
44  C4Player *GetByIndex(int iIndex) const;
45  C4Player *GetByIndex(int iIndex, C4PlayerType eType) const;
46  C4Player *GetByName(const char *szName, int iExcluding=NO_OWNER) const;
47  C4Player *GetLocalByIndex(int iIndex) const;
48  C4Player *GetAtClient(int iClient, int iIndex=0) const;
49  C4Player *GetAtClient(const char *szName, int iIndex=0) const;
50  C4Player *GetAtRemoteClient(int iIndex=0) const;
51  C4Player *GetByInfoID(int iInfoID) const;
52  C4Player *Join(const char *szFilename, bool fScenarioInit, int iAtClient, const char *szAtClientName, class C4PlayerInfo *pInfo, C4ValueNumbers *);
53  void JoinNew(const char *szFilename);
54  bool CtrlJoin(const class C4Network2ResCore &ResCore, int iClientID, int idPlayerInfo);
55  bool FileInUse(const char *szFilename) const;
56  bool Retire(C4Player *pPlr);
57  bool Evaluate();
58  bool Save(bool fSaveLocalOnly);
59  bool Save(C4Group &hGroup, bool fStoreTiny, const C4PlayerInfoList &rStoreList); // save all players present in the restore list
60  bool Remove(int iPlayer, bool fDisonnected, bool fNoCalls);
61  bool RemoveUnjoined(int32_t iPlayer); // remove player objects only
62  bool Remove(C4Player *pPlr, bool fDisonnected, bool fNoCalls);
63  bool RemoveAtRemoteClient(bool fDisonnected, bool fNoCalls);
64  bool RemoveLocal(bool fDisonnected, bool fNoCalls);
65  bool MouseControlTaken() const;
66  bool RemoveAtClient(int iClient, bool fDisconnect);
67  bool RemoveAtClient(const char *szName, bool fDisconnect);
68  bool CtrlRemove(int iPlayer, bool fDisonnected);
69  bool CtrlRemoveAtClient(int iClient, bool fDisonnected);
70  bool CtrlRemoveAtClient(const char *szName, bool fDisonnected);
71  bool Valid(int iPlayer) const;
72  bool Hostile(int iPlayer1, int iPlayer2) const;
73  bool HostilityDeclared(int iPlayer1, int iPlayer2) const; // check whether iPlayer1 treats iPlayer2 as hostile, but not vice versa!
74  bool PositionTaken(int iPosition) const;
75  int CheckColorDw(DWORD dwColor, C4Player *pExclude); // return minimum difference to the other player's colors
76  bool SynchronizeLocalFiles(); // syncrhonize all local player files; resetting InGame times
77  bool HasPlayerInTeamSelection(); // Return whether any player is in the pre-join team selection dialogue
78 protected:
79  int GetFreeNumber() const;
80  void RecheckPlayerSort(C4Player *pForPlayer);
82  friend class C4Player;
83 };
84 extern C4PlayerList Players;
86 int32_t ValidPlr(int32_t plr);
87 int32_t Hostile(int32_t plr1, int32_t plr2);
88 #endif
void RecheckPlayerSort(C4Player *pForPlayer)
bool PositionTaken(int iPosition) const
bool Retire(C4Player *pPlr)
C4Player * GetLocalByIndex(int iIndex) const
int GetFreeNumber() const
bool SynchronizeLocalFiles()
bool MouseControlTaken() const
bool FileInUse(const char *szFilename) const
C4PlayerList Players
void DenumeratePointers()
bool Valid(int iPlayer) const
bool RemoveAtRemoteClient(bool fDisonnected, bool fNoCalls)
C4Player * First
Definition: C4PlayerList.h:31
C4Player * GetByName(const char *szName, int iExcluding=NO_OWNER) const
bool RemoveLocal(bool fDisonnected, bool fNoCalls)
C4Player * GetByIndex(int iIndex) const
int GetCountNotEliminated() const
C4Player * Get(int iPlayer) const
C4Player * Join(const char *szFilename, bool fScenarioInit, int iAtClient, const char *szAtClientName, class C4PlayerInfo *pInfo, C4ValueNumbers *)
void JoinNew(const char *szFilename)
int GetIndex(C4Player *pPlr) const
bool RemoveUnjoined(int32_t iPlayer)
bool RemoveAtClient(int iClient, bool fDisconnect)
bool Hostile(int iPlayer1, int iPlayer2) const
bool CtrlJoin(const class C4Network2ResCore &ResCore, int iClientID, int idPlayerInfo)
const int NO_OWNER
Definition: C4Constants.h:137
int CheckColorDw(DWORD dwColor, C4Player *pExclude)
Definition: C4Constants.h:151
bool HasPlayerInTeamSelection()
void ClearPointers(C4Object *pObj)
C4Player * GetAtClient(int iClient, int iIndex=0) const
bool CtrlRemoveAtClient(int iClient, bool fDisonnected)
bool CtrlRemove(int iPlayer, bool fDisonnected)
int32_t ValidPlr(int32_t plr)
uint32_t DWORD
int AverageScoreGain() const
bool Save(bool fSaveLocalOnly)
bool Remove(int iPlayer, bool fDisonnected, bool fNoCalls)
C4Player * GetByInfoID(int iInfoID) const
C4Player * GetAtRemoteClient(int iIndex=0) const
int GetCount() const
bool HostilityDeclared(int iPlayer1, int iPlayer2) const