OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4PlayerList.cpp
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 1998-2000, Matthes Bender
5  * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
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  */
17 
18 /* Dynamic list to hold runtime player data */
19 
20 #include "C4Include.h"
21 #include "player/C4PlayerList.h"
22 
23 #include "c4group/C4Components.h"
24 #include "control/C4GameControl.h"
25 #include "control/C4RoundResults.h"
26 #include "editor/C4Console.h"
27 #include "game/C4FullScreen.h"
28 #include "game/C4Viewport.h"
29 #include "lib/StdColors.h"
30 #include "network/C4League.h"
31 #include "object/C4GameObjects.h"
32 #include "object/C4Object.h"
33 #include "player/C4Player.h"
34 
36 {
37  Default();
38 }
39 
41 {
42  Clear();
43 }
44 
46 {
47  First=nullptr;
48 }
49 
51 {
52  C4Player *pPlr;
53  while ((pPlr = First))
54  { First = pPlr->Next; delete pPlr; }
55  First = nullptr;
56 }
57 
59 {
60  C4Player *pPlr;
61  // Execute
62  for (pPlr=First; pPlr; pPlr=pPlr->Next)
63  pPlr->Execute();
64  // Check retirement
65  for (pPlr=First; pPlr; pPlr=pPlr->Next)
66  if (pPlr->Eliminated && !pPlr->RetireDelay)
67  { Retire(pPlr); break; }
68 }
69 
71 {
72  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
73  pPlr->ClearPointers(pObj, false);
74 }
75 
76 bool C4PlayerList::Valid(int iPlayer) const
77 {
78  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
79  if (pPlr->Number==iPlayer)
80  return true;
81  return false;
82 }
83 
84 bool C4PlayerList::Hostile(int iPlayer1, int iPlayer2) const
85 {
86  C4Player *pPlr1=Get(iPlayer1);
87  C4Player *pPlr2=Get(iPlayer2);
88  if (!pPlr1 || !pPlr2) return false;
89  if (pPlr1->Number==pPlr2->Number) return false;
90  if ( pPlr1->IsHostileTowards(pPlr2)
91  || pPlr2->IsHostileTowards(pPlr1) )
92  return true;
93  return false;
94 }
95 
96 bool C4PlayerList::HostilityDeclared(int iPlayer1, int iPlayer2) const
97 {
98  // check one-way-hostility
99  C4Player *pPlr1=Get(iPlayer1);
100  C4Player *pPlr2=Get(iPlayer2);
101  if (!pPlr1 || !pPlr2) return false;
102  if (pPlr1->Number==pPlr2->Number) return false;
103  if ( pPlr1->IsHostileTowards(pPlr2))
104  return true;
105  return false;
106 }
107 
108 bool C4PlayerList::PositionTaken(int iPosition) const
109 {
110  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
111  if (pPlr->Position==iPosition)
112  return true;
113  return false;
114 }
115 
117 {
118  // maximum difference
119  int iDiff=255+255+255;
120  // check all player's color difference
121  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next) if (pPlr != pExclude)
122  {
123  // get color
124  DWORD dwClr2=pPlr->ColorDw;
125  // assign difference, if less than smallest difference found
126  iDiff=std::min(iDiff,
127  Abs(GetBlueValue(dwColor) - GetBlueValue(dwClr2))
128  + Abs(GetGreenValue(dwColor) - GetGreenValue(dwClr2))
129  + Abs(GetRedValue(dwColor) - GetRedValue(dwClr2)));
130  }
131  // return the difference
132  return iDiff;
133 }
134 
135 C4Player* C4PlayerList::Get(int iNumber) const
136 {
137  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
138  if (pPlr->Number==iNumber)
139  return pPlr;
140  return nullptr;
141 }
142 
144 {
145  int cindex=0;
146  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next, cindex++)
147  if (pPlr==tPlr)
148  return cindex;
149  return -1;
150 }
151 
153 {
154  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
155  if (!iIndex--)
156  return pPlr;
157  return nullptr;
158 }
159 
161 {
162  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
163  if (pPlr->GetType() == eType)
164  if (!iIndex--)
165  return pPlr;
166  return nullptr;
167 }
168 
170 {
171  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
172  if (pPlr->ID == iInfoID) return pPlr;
173  return nullptr;
174 }
175 
177 {
178  int iCount = 0;
179  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
180  iCount++;
181  return iCount;
182 }
183 
185 {
186  int iCount = 0;
187  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
188  if (pPlr->GetType() == eType)
189  iCount++;
190  return iCount;
191 }
192 
194 {
195  int iNumber=-1;
196  bool fFree;
197  do
198  {
199  iNumber++; fFree=true;
200  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
201  if (pPlr->Number==iNumber)
202  fFree=false;
203  }
204  while (!fFree);
205  return iNumber;
206 }
207 
208 bool C4PlayerList::Remove(int iPlayer, bool fDisconnect, bool fNoCalls)
209 {
210  return Remove(Get(iPlayer), fDisconnect, fNoCalls);
211 }
212 
213 bool C4PlayerList::RemoveUnjoined(int32_t iPlayer)
214 {
215  // Savegame resume missing player: Remove player objects only
216  for (C4Object *pObj : Objects)
217  if (pObj->Status)
218  if (pObj->IsPlayerObject(iPlayer))
219  pObj->AssignRemoval(true);
220  return true;
221 }
222 
223 bool C4PlayerList::Remove(C4Player *pPlr, bool fDisconnect, bool fNoCalls)
224 {
225  if (!pPlr) return false;
226 
227  // inform script
228  if (!fNoCalls)
230 
231  // Transfer ownership of other objects to team members
232  if (!fNoCalls) pPlr->NotifyOwnedObjects();
233 
234  // NET2: update player info list
235  if (pPlr->ID)
236  {
238  if (pInfo)
239  {
240  pInfo->SetRemoved();
241  if (fDisconnect)
242  pInfo->SetDisconnected();
243  }
244  // if player wasn't evaluated, store round results anyway
245  if (!pPlr->Evaluated) Game.RoundResults.EvaluatePlayer(pPlr);
246  }
247 
248  C4Player *pPrev=First;
249  while (pPrev && pPrev->Next!=pPlr) pPrev=pPrev->Next;
250  if (pPrev) pPrev->Next=pPlr->Next;
251  else First=pPlr->Next;
252 
253  // Remove eliminated crew
254  if (!fNoCalls) pPlr->RemoveCrewObjects();
255 
256  // Clear object info pointers
258 
259  // Clear viewports
260  ::Viewports.CloseViewport(pPlr->Number, fNoCalls);
261  // Check fullscreen viewports
263 
264  // Remove player
265  delete pPlr;
266 
267  // Validate object owners
269 
270  // Update console
272  return true;
273 }
274 
275 C4Player* C4PlayerList::Join(const char *szFilename, bool fScenarioInit, int iAtClient, const char *szAtClientName, C4PlayerInfo *pInfo, C4ValueNumbers * numbers)
276 {
277  assert(pInfo);
278  assert(fScenarioInit || numbers);
279 
280  // safeties
281  if (szFilename && !*szFilename) szFilename = nullptr;
282 
283  // Log
284  LogF(LoadResStr(fScenarioInit ? "IDS_PRC_JOINPLR" : "IDS_PRC_RECREATE"),pInfo->GetName());
285 
286  // Too many players
287  if (true) // replay needs to check, too!
289  {
290  LogF(LoadResStr("IDS_PRC_TOOMANYPLRS"),Game.Parameters.MaxPlayers);
291  return nullptr;
292  }
293 
294  // Check duplicate file usage
295  if (szFilename) if (FileInUse(szFilename))
296  { Log(LoadResStr("IDS_PRC_PLRFILEINUSE")); return nullptr; }
297 
298  // Create
299  C4Player *pPlr = new C4Player;
300 
301  // Append to player list
302  C4Player *pLast=First;
303  while (pLast && pLast->Next) pLast=pLast->Next;
304  if (pLast) pLast->Next=pPlr; else First = pPlr;
305 
306  // Init
307  if (!pPlr->Init(GetFreeNumber(),iAtClient,szAtClientName,szFilename,fScenarioInit,pInfo, numbers))
308  { Remove(pPlr, false, false); Log(LoadResStr("IDS_PRC_JOINFAIL")); return nullptr; }
309 
310  // Done
311  return pPlr;
312 }
313 
314 // Join players (via network/ctrl queue)
315 void C4PlayerList::JoinNew(const char *szFilename)
316 {
317  if (::Network.isEnabled())
318  {
319  ::Network.Players.JoinLocalPlayer(szFilename);
320  return;
321  }
322  // security
323  if (!ItemExists(szFilename)) return;
324  // join via player info
326 }
327 
328 void SetClientPrefix(char *szFilename, const char *szClient)
329 {
330  char szTemp[1024+1];
331  // Compose prefix
332  char szPrefix[1024+1];
333  SCopy(szClient,szPrefix); SAppendChar('-',szPrefix);
334  // Prefix already set?
335  SCopy(GetFilename(szFilename),szTemp,SLen(szPrefix));
336  if (SEqualNoCase(szTemp,szPrefix)) return;
337  // Insert prefix
338  SCopy(GetFilename(szFilename),szTemp);
339  SCopy(szPrefix,GetFilename(szFilename));
340  SAppend(szTemp,szFilename);
341 }
342 
343 bool C4PlayerList::Save(C4Group &hGroup, bool fStoreTiny, const C4PlayerInfoList &rStoreList)
344 {
345  StdStrBuf sTempFilename;
346  bool fSuccess = true;
347  // Save to external player files and add to group
348  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
349  {
350  // save only those in the list, and only those with a filename
351  C4PlayerInfo *pNfo = rStoreList.GetPlayerInfoByID(pPlr->ID);
352  if (!pNfo) continue;
353  if (!pNfo->GetFilename() || !*pNfo->GetFilename()) continue;;
354  // save over original file?
355  bool fStoreOnOriginal = (!fStoreTiny && pNfo->GetType() == C4PT_User);
356  // Create temporary file
357  sTempFilename.Copy(Config.AtTempPath(pNfo->GetFilename()));
358  if (fStoreOnOriginal)
359  if (!C4Group_CopyItem(pPlr->Filename, sTempFilename.getData()))
360  return false;
361  // Open group
362  C4Group PlrGroup;
363  if (!PlrGroup.Open(sTempFilename.getData(), !fStoreOnOriginal))
364  return false;
365  // Save player
366  if (!pPlr->Save(PlrGroup, true, fStoreOnOriginal)) return false;
367  PlrGroup.Close();
368  // Add temp file to group
369  if (!hGroup.Move(sTempFilename.getData(), pNfo->GetFilename())) return false;
370  }
371  return fSuccess;
372 }
373 
374 bool C4PlayerList::Save(bool fSaveLocalOnly)
375 {
376  // do not save in replays
377  if (Game.C4S.Head.Replay) return true;
378  // Save to external player files
379  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
380  if (pPlr->GetType() != C4PT_Script)
381  if (!fSaveLocalOnly || pPlr->LocalControl)
382  if (!pPlr->Save())
383  return false;
384  return true;
385 }
386 
388 {
389  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
390  pPlr->Evaluate();
391  return true;
392 }
393 
395 {
396  if (!pPlr) return false;
397 
398  if (!pPlr->Evaluated)
399  {
400  pPlr->Evaluate();
401  if (!::Control.isReplay() && pPlr->GetType() != C4PT_Script) pPlr->Save();
402  }
403  Remove(pPlr, false, false);
404 
405  return true;
406 }
407 
409 {
410  int iResult=0;
411  if (First)
412  {
413  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
414  iResult+=std::max<int32_t>(pPlr->CurrentScore-pPlr->InitialScore,0);
415  iResult/=GetCount();
416  }
417  return iResult;
418 }
419 
420 C4Player* C4PlayerList::GetByName(const char *szName, int iExcluding) const
421 {
422  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
423  if (SEqual(pPlr->GetName(),szName))
424  if (pPlr->Number!=iExcluding)
425  return pPlr;
426  return nullptr;
427 }
428 
429 bool C4PlayerList::FileInUse(const char *szFilename) const
430 {
431  // Check original player files
432  C4Player *cPlr=First;
433  for (; cPlr; cPlr=cPlr->Next)
434  if (ItemIdentical(cPlr->Filename,szFilename))
435  return true;
436  // Compare to any network path player files with prefix (hack)
437  if (::Network.isEnabled())
438  {
439  char szWithPrefix[_MAX_PATH+1];
440  SCopy(GetFilename(szFilename),szWithPrefix);
441  SetClientPrefix(szWithPrefix, Game.Clients.getLocalName());
442  for (cPlr=First; cPlr; cPlr=cPlr->Next)
443  if (SEqualNoCase(GetFilename(cPlr->Filename),szWithPrefix))
444  return true;
445  }
446  // Not in use
447  return false;
448 }
449 
451 {
452  int cindex=0;
453  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
454  if (pPlr->LocalControl)
455  {
456  if (cindex==iIndex) return pPlr;
457  cindex++;
458  }
459  return nullptr;
460 }
461 
462 bool C4PlayerList::RemoveAtClient(int iClient, bool fDisconnect)
463 {
464  C4Player *pPlr;
465  // Get players
466  while ((pPlr = GetAtClient(iClient)))
467  {
468  // Log
469  Log(FormatString(LoadResStr("IDS_PRC_REMOVEPLR"),pPlr->GetName()).getData());
470  // Remove
471  Remove(pPlr, fDisconnect, false);
472  }
473  return true;
474 }
475 
476 bool C4PlayerList::RemoveAtClient(const char *szName, bool fDisconnect)
477 {
478  C4Player *pPlr;
479  // Get players
480  while ((pPlr = GetAtClient(szName)))
481  {
482  // Log
483  Log(FormatString(LoadResStr("IDS_PRC_REMOVEPLR"),pPlr->GetName()).getData());
484  // Remove
485  Remove(pPlr, fDisconnect, false);
486  }
487  return true;
488 }
489 
490 bool C4PlayerList::CtrlRemove(int iPlayer, bool fDisconnect)
491 {
492  // Add packet to input
493  Game.Input.Add(CID_RemovePlr, new C4ControlRemovePlr(iPlayer, fDisconnect));
494  return true;
495 }
496 
497 bool C4PlayerList::CtrlRemoveAtClient(int iClient, bool fDisconnect)
498 {
499  // Get players
500  for (C4Player *pPlr = First; pPlr; pPlr = pPlr->Next)
501  if (pPlr->AtClient == iClient)
502  if (!CtrlRemove(pPlr->Number, fDisconnect))
503  return false;
504  return true;
505 }
506 
507 bool C4PlayerList::CtrlRemoveAtClient(const char *szName, bool fDisconnect)
508 {
509  // Get players
510  for (C4Player *pPlr = First; pPlr; pPlr = pPlr->Next)
511  if (SEqual(pPlr->AtClientName, szName))
512  if (!CtrlRemove(pPlr->Number, fDisconnect))
513  return false;
514  return true;
515 }
516 
517 C4Player* C4PlayerList::GetAtClient(int iClient, int iIndex) const
518 {
519  int cindex=0;
520  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
521  if (pPlr->AtClient == iClient)
522  {
523  if (cindex==iIndex) return pPlr;
524  cindex++;
525  }
526  return nullptr;
527 }
528 
529 C4Player* C4PlayerList::GetAtClient(const char *szName, int iIndex) const
530 {
531  int cindex=0;
532  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
533  if (SEqualNoCase(pPlr->AtClientName,szName))
534  {
535  if (cindex==iIndex) return pPlr;
536  cindex++;
537  }
538  return nullptr;
539 }
540 
541 bool C4PlayerList::RemoveAtRemoteClient(bool fDisconnect, bool fNoCalls)
542 {
543  C4Player *pPlr;
544  // Get players
545  while ((pPlr = GetAtRemoteClient()))
546  {
547  // Log
548  Log(FormatString(LoadResStr("IDS_PRC_REMOVEPLR"),pPlr->GetName()).getData());
549  // Remove
550  Remove(pPlr, fDisconnect, fNoCalls);
551  }
552  return true;
553 }
554 
556 {
557  int cindex=0;
558  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
559  if (pPlr->AtClient != ::Control.ClientID())
560  {
561  if (cindex==iIndex) return pPlr;
562  cindex++;
563  }
564  return nullptr;
565 }
566 
567 bool C4PlayerList::RemoveLocal(bool fDisconnect, bool fNoCalls)
568 {
569  // (used by league system the set local fate)
570  C4Player *pPlr;
571  do
572  for (pPlr = First; pPlr; pPlr = pPlr->Next)
573  if (pPlr->LocalControl)
574  {
575  // Log
576  Log(FormatString(LoadResStr("IDS_PRC_REMOVEPLR"),pPlr->GetName()).getData());
577  // Remove
578  Remove(pPlr, fDisconnect, fNoCalls);
579  break;
580  }
581  while (pPlr);
582 
583  return true;
584 }
585 
587 {
588  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
589  pPlr->DenumeratePointers();
590 }
591 
593 {
594  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
595  if (pPlr->MouseControl)
596  if (pPlr->LocalControl)
597  return true;
598  return false;
599 }
600 
602 {
603  int iCount = 0;
604  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
605  if (!pPlr->Eliminated)
606  iCount++;
607  return iCount;
608 }
609 
611 {
612  // message
613  Log(LoadResStr("IDS_PRC_SYNCPLRS"));
614  bool fSuccess = true;
615  // check all players
616  for (C4Player *pPlr=First; pPlr; pPlr=pPlr->Next)
617  // eliminated players will be saved soon, anyway
618  if (!pPlr->Eliminated)
619  if (!pPlr->LocalSync()) fSuccess = false;
620  // done
621  return fSuccess;
622 }
623 
625 {
626  for (C4Player *pPlr = First; pPlr; pPlr = pPlr->Next)
627  if (pPlr->IsChosingTeam())
628  return true;
629  return false;
630 }
631 
633 {
634  if (!pForPlayer || !First) return;
635  int iNumber = pForPlayer->Number;
636  // get entry that should be the previous
637  // (use '<=' to run past pForPlayer itself)
638  C4Player *pPrev = First;
639  while (pPrev->Next && pPrev->Next->Number <= iNumber)
640  pPrev=pPrev->Next;
641  // if it's correctly sorted, pPrev should point to pForPlayer itself
642  if (pPrev == pForPlayer) return;
643  // otherwise, pPrev points to the entry that should be the new previous
644  // or to First if pForPlayer should be the head entry
645  // re-link it there
646  // first remove from old link pos
647  C4Player **pOldLink = &First;
648  while (*pOldLink && *pOldLink != pForPlayer) pOldLink = &((*pOldLink)->Next);
649  if (*pOldLink) *pOldLink = pForPlayer->Next;
650  // then link into new
651  if (pPrev == First && pPrev->Number > iNumber)
652  {
653  // at head
654  pForPlayer->Next = pPrev;
655  First = pForPlayer;
656  }
657  else
658  {
659  // after prev
660  pForPlayer->Next = pPrev->Next;
661  pPrev->Next = pForPlayer;
662  }
663 }
664 
665 int32_t ValidPlr(int32_t plr)
666 {
667  return ::Players.Valid(plr);
668 }
669 
670 int32_t Hostile(int32_t plr1, int32_t plr2)
671 {
672  return ::Players.Hostile(plr1,plr2);
673 }
674 
bool IsHostileTowards(const C4Player *opponent) const
Definition: C4Player.cpp:860
char * GetFilename(char *szPath)
Definition: StdFile.cpp:45
const char * getData() const
Definition: StdBuf.h:442
bool FileInUse(const char *szFilename) const
void RecheckPlayerSort(C4Player *pForPlayer)
C4Config Config
Definition: C4Config.cpp:833
const char * GetName() const
Definition: C4PlayerInfo.h:157
void SetDisconnected()
Definition: C4PlayerInfo.h:200
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
Definition: Standard.cpp:152
bool Retire(C4Player *pPlr)
void SAppendChar(char cChar, char *szStr)
Definition: Standard.cpp:265
int32_t Team
Definition: C4Player.h:88
C4Console Console
Definition: C4Globals.cpp:45
bool SynchronizeLocalFiles()
#define PSF_RemovePlayer
Definition: C4GameScript.h:46
void SAppend(const char *szSource, char *szTarget, int iMaxL)
Definition: Standard.cpp:257
bool ItemIdentical(const char *szFilename1, const char *szFilename2)
Definition: StdFile.cpp:855
C4Game Game
Definition: C4Globals.cpp:52
int32_t Number
Definition: C4Player.h:86
#define GetGreenValue(rgb)
Definition: StdColors.h:28
void SetClientPrefix(char *szFilename, const char *szClient)
C4Scenario C4S
Definition: C4Game.h:74
int AverageScoreGain() const
void DenumeratePointers()
bool Replay
Definition: C4Scenario.h:72
bool RemoveAtRemoteClient(bool fDisonnected, bool fNoCalls)
char Filename[_MAX_PATH+1]
Definition: C4Player.h:80
void Add(C4PacketType eType, C4ControlPacket *pCtrl)
Definition: C4Control.h:82
bool SEqualNoCase(const char *szStr1, const char *szStr2, int iLen)
Definition: Standard.cpp:207
C4FullScreen FullScreen
Definition: C4Globals.cpp:46
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
#define _MAX_PATH
int GetCount() const
#define GetRedValue(rgb)
Definition: StdColors.h:29
size_t SLen(const char *sptr)
Definition: Standard.h:74
void UpdateMenus()
Definition: C4Console.cpp:504
bool SEqual(const char *szStr1, const char *szStr2)
Definition: Standard.h:93
C4GameParameters & Parameters
Definition: C4Game.h:67
C4Player * GetAtClient(int iClient, int iIndex=0) const
C4PlayerInfo * GetPlayerInfoByID(int32_t id) const
int GetCountNotEliminated() const
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
C4Player * Get(int iPlayer) const
int iResult
Definition: C4GroupMain.cpp:39
C4Player * Join(const char *szFilename, bool fScenarioInit, int iAtClient, const char *szAtClientName, class C4PlayerInfo *pInfo, C4ValueNumbers *)
C4Network2 Network
Definition: C4Globals.cpp:53
void JoinNew(const char *szFilename)
C4Player * GetByIndex(int iIndex) const
void NotifyOwnedObjects()
Definition: C4Player.cpp:1311
#define GetBlueValue(rgb)
Definition: StdColors.h:27
bool Valid(int iPlayer) const
bool DoLocalNonNetworkPlayerJoin(const char *szPlayerFile)
C4GameControl Control
bool RemoveUnjoined(int32_t iPlayer)
bool Move(const char *szFile, const char *szAddAs)
Definition: C4Group.cpp:1325
bool RemoveAtClient(int iClient, bool fDisconnect)
bool Open(const char *szGroupName, bool fCreate=false)
Definition: C4Group.cpp:514
const char * getLocalName() const
Definition: C4Client.h:170
void Execute()
Definition: C4Player.cpp:162
int GetFreeNumber() const
C4PlayerList Players
bool C4Group_CopyItem(const char *szSource, const char *szTarget1, bool fNoSort, bool fResetAttributes)
Definition: C4Group.cpp:100
bool HostilityDeclared(int iPlayer1, int iPlayer2) const
C4Player * GetByInfoID(int iInfoID) const
bool ValidateOwners() override
C4Player * GetLocalByIndex(int iIndex) const
int32_t Hostile(int32_t plr1, int32_t plr2)
bool Close()
Definition: C4Group.cpp:755
int CheckColorDw(DWORD dwColor, C4Player *pExclude)
bool isEnabled() const
Definition: C4Network2.h:203
bool Evaluated
Definition: C4Player.h:85
bool MouseControlTaken() const
C4PlayerType
Definition: C4Constants.h:151
C4RoundResults & RoundResults
Definition: C4Game.h:73
int32_t Eliminated
Definition: C4Player.h:83
bool HasPlayerInTeamSelection()
bool PositionTaken(int iPosition) const
C4Control & Input
Definition: C4Game.h:82
void Evaluate()
Definition: C4Player.cpp:787
int32_t ID
Definition: C4Player.h:87
bool ViewportCheck()
void ClearPointers(C4Object *pObj)
const char * GetFilename() const
Definition: C4PlayerInfo.h:161
C4PlayerInfoList & PlayerInfos
Definition: C4Game.h:71
C4ViewportList Viewports
Definition: C4Viewport.cpp:841
const char * GetName() const
Definition: C4Player.h:151
int32_t ClientID() const
friend class C4Player
Definition: C4PlayerList.h:82
bool isReplay() const
Definition: C4GameControl.h:98
int32_t ValidPlr(int32_t plr)
bool CtrlRemoveAtClient(int iClient, bool fDisonnected)
C4Value GRBroadcast(const char *szFunction, C4AulParSet *pPars=nullptr, bool fPassError=false, bool fRejectTest=false)
Definition: C4Game.cpp:3844
C4Network2Players Players
Definition: C4Network2.h:119
bool Log(const char *szMessage)
Definition: C4Log.cpp:202
C4Player * Next
Definition: C4Player.h:142
void EvaluatePlayer(C4Player *pPlr)
C4ClientList & Clients
Definition: C4Game.h:69
bool CloseViewport(int32_t iPlayer, bool fSilent)
Definition: C4Viewport.cpp:961
C4ObjectInfoList CrewInfoList
Definition: C4Player.h:124
int32_t RetireDelay
Definition: C4Player.h:95
bool Save()
Definition: C4Player.cpp:415
C4PlayerType GetType() const
Definition: C4PlayerInfo.h:152
void RemoveCrewObjects()
Definition: C4Player.cpp:1271
const char * AtTempPath(const char *szFilename)
Definition: C4Config.cpp:540
T Abs(T val)
Definition: Standard.h:42
C4SHead Head
Definition: C4Scenario.h:230
bool JoinLocalPlayer(const char *szLocalPlayerFilename, bool initial=false)
bool CtrlRemove(int iPlayer, bool fDisonnected)
bool ItemExists(const char *szItemName)
Definition: StdFile.h:75
int GetIndex(C4Player *pPlr) const
C4Player * GetByName(const char *szName, int iExcluding=NO_OWNER) const
uint32_t DWORD
bool LogF(const char *strMessage,...)
Definition: C4Log.cpp:260
void Copy()
Definition: StdBuf.h:467
bool Save(bool fSaveLocalOnly)
bool Remove(int iPlayer, bool fDisonnected, bool fNoCalls)
bool Init(int32_t iNumber, int32_t iAtClient, const char *szAtClientName, const char *szFilename, bool fScenarioInit, class C4PlayerInfo *pInfo, C4ValueNumbers *)
Definition: C4Player.cpp:257
C4GameObjects Objects
Definition: C4Globals.cpp:48
bool LocalControl
Definition: C4Player.h:99
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270
C4PlayerType GetType() const
Definition: C4Player.cpp:1726