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