All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
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
bool FileInUse(const char *szFilename) const
void RecheckPlayerSort(C4Player *pForPlayer)
bool Retire(C4Player *pPlr)
bool SynchronizeLocalFiles()
int AverageScoreGain() const
C4PlayerList Players
void DenumeratePointers()
bool RemoveAtRemoteClient(bool fDisonnected, bool fNoCalls)
C4Player * GetAtRemoteClient(int iIndex=0) const
C4Player * First
Definition: C4PlayerList.h:31
bool RemoveLocal(bool fDisonnected, bool fNoCalls)
bool Hostile(int iPlayer1, int iPlayer2) const
int GetCount() const
C4Player * GetAtClient(int iClient, int iIndex=0) 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)
C4Player * GetByIndex(int iIndex) const
bool Valid(int iPlayer) const
bool RemoveUnjoined(int32_t iPlayer)
bool RemoveAtClient(int iClient, bool fDisconnect)
int GetFreeNumber() const
bool HostilityDeclared(int iPlayer1, int iPlayer2) const
C4Player * GetByInfoID(int iInfoID) const
C4Player * GetLocalByIndex(int iIndex) const
bool CtrlJoin(const class C4Network2ResCore &ResCore, int iClientID, int idPlayerInfo)
const int NO_OWNER
Definition: C4Constants.h:138
int CheckColorDw(DWORD dwColor, C4Player *pExclude)
bool MouseControlTaken() const
Definition: C4Constants.h:152
bool HasPlayerInTeamSelection()
bool PositionTaken(int iPosition) const
void ClearPointers(C4Object *pObj)
bool CtrlRemoveAtClient(int iClient, bool fDisonnected)
bool CtrlRemove(int iPlayer, bool fDisonnected)
int32_t Hostile(int32_t plr1, int32_t plr2)
int GetIndex(C4Player *pPlr) const
int32_t ValidPlr(int32_t plr)
C4Player * GetByName(const char *szName, int iExcluding=NO_OWNER) const
uint32_t DWORD
bool Save(bool fSaveLocalOnly)
bool Remove(int iPlayer, bool fDisonnected, bool fNoCalls)