43 bool C4PlayerInfoListBox::ListItem::CanLocalChooseTeams(int32_t idPlayer)
const
50 if (!pLobby)
return false;
56 if (pInfo && pInfo->
HasJoined())
return false;
62 void C4PlayerInfoListBox::ListItem::DrawElement(
C4TargetFacet &cgo)
66 BaseClass::DrawElement(cgo);
71 C4PlayerInfoListBox::PlayerListItem::PlayerListItem(
C4PlayerInfoListBox *pForListBox, int32_t idClient,
72 int32_t idPlayer,
bool fSavegamePlayer,
C4GUI::Element *pInsertBeforeElement)
73 : ListItem(pForListBox), pScoreLabel(nullptr), pTimeLabel(nullptr), pExtraLabel(nullptr),
74 pRankIcon(nullptr), pTeamCombo(nullptr), pTeamPic(nullptr), fIconSet(false), fJoinedInfoSet(false),
75 dwJoinClr(0), dwPlrClr(0), idClient(idClient), idPlayer(idPlayer), fFreeSavegamePlayer(fSavegamePlayer)
77 bool fIsEvaluation = pForListBox->IsEvaluation(), fIsLobby = pForListBox->IsLobby();
81 uint32_t dwPlayerColor;
83 dwPlayerColor = dwTextColor;
99 pTeamCombo->SetSimple(
true);
102 pTeamCombo->SetFont(pCustomFont);
111 if (!pList->IsTeamFilter())
118 pTeamPic->SetDrawColor(pTeam->
GetColor());
122 if (!pList->IsTeamFilter())
127 sTimeLabelText.
Format(
LoadResStr(
"IDS_CTL_TOTALPLAYINGTIME"), iTimeTotal/3600, (iTimeTotal/60)%60, iTimeTotal%60);
132 if (pEvaluationPlayer)
135 if (szCustomEval && *szCustomEval)
142 pNameLabel =
new C4GUI::Label(sPlayerName.getData(), (iHeight + IconLabelSpacing) * (1+!!pTeamPic), IconLabelSpacing,
ALeft, dwPlayerColor, pCustomFont, !fIsEvaluation,
true);
144 SetBounds(
C4Rect(0,0,10,iHeight));
146 AddElement(pIcon); AddElement(pNameLabel);
147 if (pTeamPic) AddElement(pTeamPic);
148 if (pTimeLabel) AddElement(pTimeLabel);
149 if (pTeamCombo) AddElement(pTeamCombo);
150 if (pRankIcon) AddElement(pRankIcon);
151 if (pExtraLabel) AddElement(pExtraLabel);
153 pForListBox->
InsertElement(
this, pInsertBeforeElement, PlayerListBoxIndent);
155 UpdateScoreLabel(pInfo);
157 if (fFreeSavegamePlayer)
158 idListItemID.idType = ListItem::ID::PLI_SAVEGAMEPLR;
160 idListItemID.idType = ListItem::ID::PLI_PLAYER;
161 idListItemID.id = idPlayer;
162 UpdateIcon(pInfo, GetJoinedInfo());
166 fShownCollapsed =
false;
170 void C4PlayerInfoListBox::PlayerListItem::UpdateOwnPos()
174 ParentClass::UpdateOwnPos();
177 caBounds.GetFromLeft(pIcon->GetBounds().Wdt);
178 if (pTeamPic) caBounds.GetFromLeft(pTeamPic->GetBounds().Wdt - IconLabelSpacing);
185 if (pList->IsEvaluation())
189 rcRankIcon = caBounds.GetFromRight(caBounds.GetInnerHeight());
190 if (pExtraLabel) rcExtraDataRect.
Wdt = caBounds.GetInnerWidth();
195 if (pRankIcon) rcRankIcon = caTeamArea.GetFromRight(caTeamArea.GetInnerHeight());
197 C4Rect rcTeam = caTeamArea.GetAll();
201 pTeamCombo->SetBounds(rcTeam);
206 pRankIcon->SetBounds(rcRankIcon);
211 C4Rect rcUpperBounds = caBounds.GetAll();
212 pTimeLabel->SetBounds(rcTeam);
213 pTimeLabel->SetX0(rcUpperBounds.
x + rcUpperBounds.
Wdt);
216 if (pExtraLabel) pExtraLabel->SetBounds(rcExtraDataRect);
219 int32_t C4PlayerInfoListBox::PlayerListItem::GetListItemTopSpacing()
223 if (pList->IsEvaluation())
228 C4PlayerInfoListBox::ListItem *pPrevListItem =
static_cast<C4PlayerInfoListBox::ListItem *
>(pPrevItem);
229 if (pPrevListItem->idListItemID.idType == ListItem::ID::PLI_PLAYER)
233 C4PlayerInfo *pPrevInfo = pPrevPlayerListItem->GetPlayerInfo();
234 if (pThisInfo && pPrevInfo)
250 bool fResPresent =
false;
253 if ((pRes = pInfo->
GetRes()))
257 bool fHasIcon = fResPresent || pEvaluationPlayer || (!
::Network.
isEnabled() && pInfo);
259 bool fHasJoinedInfo = !!pJoinedInfo;
263 if (fHasIcon == fIconSet && fJoinedInfoSet == fHasJoinedInfo && dwJoinedInfoClr == dwJoinClr && dwPlayerClr == dwPlrClr)
return;
271 pIcon->SetFacet(pEvaluationPlayer->
GetBigIcon());
279 pIcon->GetMFacet().Create(64,64);
291 if (!pIcon->EnsureOwnSurface())
return;
293 C4Facet fctDraw = pIcon->GetFacet();
294 int32_t iSizeMax = std::max<int32_t>(fctDraw.
Wdt, fctDraw.
Hgt);
295 int32_t iCrewClrHgt = iSizeMax/2;
296 fctDraw.
Hgt -= iCrewClrHgt; fctDraw.
Y += iCrewClrHgt;
297 fctDraw.
Wdt = iSizeMax/2;
308 fJoinedInfoSet = fHasJoinedInfo;
309 dwJoinClr = dwJoinedInfoClr;
310 dwPlrClr = dwPlayerClr;
313 void C4PlayerInfoListBox::PlayerListItem::UpdateTeam()
315 if (!pTeamCombo)
return;
316 const char *szTeamName =
"";
bool fReadOnly =
true;
317 fReadOnly = !CanLocalChooseTeam();
318 int32_t idTeam;
C4Team *pTeam;
323 if ((idTeam = pInfo->
GetTeam()))
326 pTeamCombo->SetText(szTeamName);
327 pTeamCombo->SetReadOnly(fReadOnly);
330 void C4PlayerInfoListBox::PlayerListItem::UpdateScoreLabel(
C4PlayerInfo *pInfo)
338 int32_t iScoreRightPos = ((pRankIcon && pList->IsEvaluation()) ? pRankIcon->GetBounds().x : GetBounds().Wdt) - IconLabelSpacing;
339 int32_t iScoreYPos = IconLabelSpacing;
342 bool fPlayerHasEvaluationData=
false;
343 if (pEvaluationPlayer)
346 if (szCustomEval && *szCustomEval)
347 fPlayerHasEvaluationData=
true;
349 if (pList->IsEvaluation() && pList->IsTeamFilter())
355 AddElement(pScoreLabel =
new C4GUI::Label(
"", iScoreRightPos, iScoreYPos,
ARight, pList->GetTextColor(), pList->GetCustomFont(),
false));
356 if (pList->IsEvaluation())
357 pScoreLabel->SetToolTip(
LoadResStr(
"IDS_DESC_OLDANDNEWSCORE"));
359 pScoreLabel->SetToolTip(
LoadResStr(
"IDS_DESC_LEAGUESCOREANDPROJECTEDGA"));
363 if (pList->IsEvaluation())
372 int32_t iDiscrepancy = iNewScore - (iOldScore + iScoreGain);
375 sText.
Format(
"{{Ico:League}}<c afafaf>%d (%+d)</c> %d %s", (
int)iOldScore, (int)iScoreGain, (
int)iNewScore,
LoadResStr(
"IDS_TEXT_SCORE"));
380 sText.
Format(
"{{Ico:League}}<c afafaf>%d (%+d)</c><c ff0000>(%+d)</c> %d %s", (
int)iOldScore, (int)iScoreGain, (
int)iDiscrepancy, (int)iNewScore,
LoadResStr(
"IDS_TEXT_SCORE"));
416 pScoreLabel->SetX0(iScoreRightPos);
417 pScoreLabel->SetText(sText.
getData(),
false);
419 else if (pScoreLabel)
423 pScoreLabel =
nullptr;
432 if (iSym && !fShownCollapsed)
435 pRankIcon->SetVisibility(
true);
436 pRankIcon->SetIcon(eRankIcon);
440 pRankIcon->SetVisibility(
false);
445 void C4PlayerInfoListBox::PlayerListItem::UpdateCollapsed()
447 bool fShouldBeCollapsed = pList->IsPlayerItemCollapsed(
this);
448 if (fShouldBeCollapsed == fShownCollapsed)
return;
450 int32_t iHeight; int32_t iNameLblX0;
451 if ((fShownCollapsed = fShouldBeCollapsed))
456 if (pTeamCombo) pTeamCombo->SetVisibility(
false);
463 if (pTeamCombo) pTeamCombo->SetVisibility(
true);
466 iNameLblX0 = iHeight + IconLabelSpacing;
467 pIcon->GetBounds() =
C4Rect(0, 0, iHeight, iHeight);
468 pIcon->UpdateOwnPos();
469 pNameLabel->SetX0(iNameLblX0);
471 SetBounds(pIcon->GetBounds());
473 pList->UpdateElementPosition(
this, PlayerListBoxIndent);
482 if (!GetLobby())
return nullptr;
486 if (fFreeSavegamePlayer)
546 void C4PlayerInfoListBox::PlayerListItem::OnCtxTakeOver(
C4GUI::Element *pListItem,
const int32_t &idPlayer)
552 if (!fFreeSavegamePlayer || !idPlayer || !pLocalInfo)
return;
554 C4PlayerInfo *pGrabbingInfo = LocalInfoRequest.GetPlayerInfoByID(idPlayer);
555 if (!pGrabbingInfo)
return;
562 void C4PlayerInfoListBox::PlayerListItem::OnCtxRemove(
C4GUI::Element *pListItem)
570 if (!pChangeInfo || !idPlayer)
return;
572 if (!LocalInfoRequest.GetPlayerInfoByID(idPlayer))
return;
573 LocalInfoRequest.RemoveInfo(idPlayer);
578 void C4PlayerInfoListBox::PlayerListItem::OnCtxNewColor(
C4GUI::Element *pListItem)
585 if (!pChangeInfo || !idPlayer)
return;
587 C4PlayerInfo *pPlrInfo = LocalInfoRequest.GetPlayerInfoByID(idPlayer);
588 if (!pPlrInfo)
return;
597 C4Team *pTeam; int32_t i=0;
599 if (!pTeam->
IsFull() || GetPlayerInfo()->GetTeam() == pTeam->
GetID())
603 bool C4PlayerInfoListBox::PlayerListItem::OnTeamComboSelChange(
C4GUI::ComboBox *pForCombo, int32_t idNewSelection)
609 if (!CanLocalChooseTeam() || !pNewTeam)
return true;
611 if (!pChangeInfo || !idPlayer)
return true;
615 C4PlayerInfo *pChangedInfo = LocalInfoRequest.GetPlayerInfoByID(idPlayer);
616 if (!pChangedInfo)
return true;
624 void C4PlayerInfoListBox::PlayerListItem::Update()
627 UpdateIcon(GetPlayerInfo(), GetJoinedInfo());
632 UpdateScoreLabel(pNfo);
635 if (pList->IsEvaluation())
637 bool fShowWinners = (pList->GetMode() != PILBM_EvaluationNoWinners);
638 bool fHasWon = fShowWinners && pNfo->
HasTeamWon();
642 sShowName.Take(
FormatString(
"%s (%s)", sShowName.getData(),
LoadResStr(fHasWon ?
"IDS_CTL_WON" :
"IDS_CTL_LOST")));
661 pNameLabel->SetText(sShowName.getData(),
false);
665 C4PlayerInfo *C4PlayerInfoListBox::PlayerListItem::GetPlayerInfo()
const
670 C4PlayerInfo *C4PlayerInfoListBox::PlayerListItem::GetJoinedInfo()
const
674 if (!pInfo)
return nullptr;
676 if (fFreeSavegamePlayer)
680 int32_t idSavegameInfo;
688 bool C4PlayerInfoListBox::PlayerListItem::CanLocalChooseTeam()
const
691 if (fFreeSavegamePlayer || GetJoinedInfo())
return false;
693 if (!::
Network.
isHost() && !IsLocalClientPlayer())
return false;
695 return CanLocalChooseTeams(idPlayer);
698 bool C4PlayerInfoListBox::PlayerListItem::IsLocalClientPlayer()
const
703 return !pClient || pClient->
isLocal();
715 : ListItem(pForListBox), idClient(rClientInfo.getID()), dwClientClr(0xffffff), tLastSoundTime(0)
720 idListItemID.idType = ListItem::ID::PLI_CLIENT;
721 idListItemID.id = idClient;
725 pStatusIcon =
new C4GUI::Icon(
C4Rect(0, 0, iIconSize, iIconSize), GetCurrentStatusIcon());
727 pPingLabel =
nullptr;
729 if (IsLocalClientPlayer())
735 C4Rect rcOwnBounds = pNameLabel->GetBounds();
736 rcOwnBounds.
Wdt += rcOwnBounds.
x; rcOwnBounds.
x = 0;
737 rcOwnBounds.
Hgt += rcOwnBounds.
y; rcOwnBounds.
y = 0;
738 SetBounds(rcOwnBounds);
740 AddElement(pStatusIcon); AddElement(pNameLabel);
741 if (btnAddPlayer) AddElement(btnAddPlayer);
750 int32_t iHgt = GetClientRect().Hgt;
751 btnAddPlayer->
GetBounds() = GetToprightCornerRect(iHgt,iHgt,2,0);
759 void C4PlayerInfoListBox::ClientListItem::SetPing(int32_t iToPing)
765 if (pPingLabel) {
delete pPingLabel; pPingLabel =
nullptr; }
770 ping.
Format(
"%d ms", iToPing);
775 pPingLabel->SetToolTip(
LoadResStr(
"IDS_DLGTIP_PING"));
776 AddElement(pPingLabel);
780 pPingLabel->SetText(ping.
getData());
783 void C4PlayerInfoListBox::ClientListItem::UpdateInfo()
788 fIsShownActive = GetClient() && GetClient()->isActivated();
790 SetStatus(GetCurrentStatusIcon());
793 C4Client *C4PlayerInfoListBox::ClientListItem::GetClient()
const
799 bool C4PlayerInfoListBox::ClientListItem::IsLocalClientPlayer()
const
805 return !pClient || pClient->
isLocal();
813 bool C4PlayerInfoListBox::ClientListItem::IsLocal()
const
819 C4GUI::Icons C4PlayerInfoListBox::ClientListItem::GetCurrentStatusIcon()
826 time_t dt = time(
nullptr) - tLastSoundTime;
827 if (dt >= SoundIconShowTime)
840 if (!pInfoPacket || !GetClient())
846 if (GetClient()->isActivated())
848 if (GetClient()->isLobbyReady())
861 void C4PlayerInfoListBox::ClientListItem::UpdatePing()
864 if (!GetClient())
return;
870 if (pClient && !pClient->
isLocal())
886 void C4PlayerInfoListBox::ClientListItem::SetSoundIcon()
889 tLastSoundTime = time(
nullptr);
891 SetStatus(GetCurrentStatusIcon());
929 void C4PlayerInfoListBox::ClientListItem::OnCtxIgnore(
C4GUI::Element *pListItem)
931 GetClient()->ToggleIgnore();
934 void C4PlayerInfoListBox::ClientListItem::OnCtxKick(
C4GUI::Element *pListItem)
942 void C4PlayerInfoListBox::ClientListItem::OnCtxActivate(
C4GUI::Element *pListItem)
951 void C4PlayerInfoListBox::ClientListItem::OnCtxInfo(
C4GUI::Element *pListItem)
957 void C4PlayerInfoListBox::ClientListItem::OnBtnAddPlr(
C4GUI::Control *btn)
966 C4PlayerInfoListBox::TeamListItem::TeamListItem(
C4PlayerInfoListBox *pForListBox, int32_t idTeam, ListItem *pInsertBefore)
967 : ListItem(pForListBox), idTeam(idTeam)
969 bool fEvaluation = pList->IsEvaluation();
971 const char *szTeamName;
978 if (pTeam) szTeamName = pTeam->
GetName();
else szTeamName =
"INTERNAL TEAM ERROR";
981 idListItemID.idType = ListItem::ID::PLI_TEAM;
982 idListItemID.id = idTeam;
997 pNameLabel =
new C4GUI::Label(szTeamName, iIconSize + IconLabelSpacing, (iIconSize - pFont->
GetLineHeight())/2,
ALeft, pList->GetTextColor(), pFont,
false);
1003 pIcon->GetMFacet().GrabFrom(fctSymbol);
1006 C4Rect rcOwnBounds = pNameLabel->GetBounds();
1007 rcOwnBounds.
Wdt += rcOwnBounds.
x; rcOwnBounds.
x = 0;
1008 rcOwnBounds.
Hgt += rcOwnBounds.
y; rcOwnBounds.
y = 0;
1009 SetBounds(rcOwnBounds);
1011 AddElement(pIcon); AddElement(pNameLabel);
1019 void C4PlayerInfoListBox::TeamListItem::MouseInput(
C4GUI::CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY,
DWORD dwKeyParam)
1024 MoveLocalPlayersIntoTeam();
1027 ListItem::MouseInput(rMouse, iButton, iX, iY, dwKeyParam);
1030 void C4PlayerInfoListBox::TeamListItem::UpdateOwnPos()
1034 ParentClass::UpdateOwnPos();
1036 if (pList->IsEvaluation())
1041 pIcon->SetBounds(caBounds.GetFromLeft(pIcon->GetBounds().Wdt, pIcon->GetBounds().Hgt));
1046 void C4PlayerInfoListBox::TeamListItem::MoveLocalPlayersIntoTeam()
1049 if (!CanLocalChooseTeams())
return;
1053 bool fAnyChange =
false;
1055 if (!pChangeInfo)
return;
1060 while ((pInfo = LocalInfoRequest.GetPlayerInfo(i++)))
1061 if (pInfo->
GetTeam() != idTeam)
1067 if (!fAnyChange)
return;
1073 void C4PlayerInfoListBox::TeamListItem::Update()
1076 if (pList->IsEvaluation())
1079 if (pTeam && pTeam->
HasWon())
1094 C4PlayerInfoListBox::FreeSavegamePlayersListItem::FreeSavegamePlayersListItem(
C4PlayerInfoListBox *pForListBox, ListItem *pInsertBefore)
1095 : ListItem(pForListBox)
1098 idListItemID.idType = ListItem::ID::PLI_SAVEGAMEPLR;
1099 idListItemID.id = 0;
1106 C4Rect rcOwnBounds = pNameLabel->GetBounds();
1107 rcOwnBounds.
Wdt += rcOwnBounds.
x; rcOwnBounds.
x = 0;
1108 rcOwnBounds.
Hgt += rcOwnBounds.
y; rcOwnBounds.
y = 0;
1109 SetBounds(rcOwnBounds);
1111 AddElement(pIcon); AddElement(pNameLabel);
1113 SetToolTip(
LoadResStr(
"IDS_DESC_UNASSOCIATEDSAVEGAMEPLAYE"));
1121 void C4PlayerInfoListBox::FreeSavegamePlayersListItem::Update()
1129 C4PlayerInfoListBox::ScriptPlayersListItem::ScriptPlayersListItem(
C4PlayerInfoListBox *pForListBox, ListItem *pInsertBefore)
1130 : ListItem(pForListBox)
1133 idListItemID.idType = ListItem::ID::PLI_SCRIPTPLR;
1134 idListItemID.id = 0;
1140 btnAddPlayer =
nullptr;
1146 C4Rect rcOwnBounds = pNameLabel->GetBounds();
1147 rcOwnBounds.
Wdt += rcOwnBounds.
x; rcOwnBounds.
x = 0;
1148 rcOwnBounds.
Hgt += rcOwnBounds.
y; rcOwnBounds.
y = 0;
1149 SetBounds(rcOwnBounds);
1151 AddElement(pIcon); AddElement(pNameLabel);
1152 if (btnAddPlayer) AddElement(btnAddPlayer);
1154 SetToolTip(
LoadResStr(
"IDS_DESC_PLAYERSCONTROLLEDBYCOMPUT"));
1161 int32_t iHgt = GetClientRect().Hgt;
1162 btnAddPlayer->
GetBounds() = GetToprightCornerRect(iHgt,iHgt,2,0);
1168 void C4PlayerInfoListBox::ScriptPlayersListItem::Update()
1178 void C4PlayerInfoListBox::ScriptPlayersListItem::OnBtnAddPlr(
C4GUI::Control *btn)
1183 if (!fCanJoinScriptPlayers)
return;
1196 C4PlayerInfoListBox::ReplayPlayersListItem::ReplayPlayersListItem(
C4PlayerInfoListBox *pForListBox, ListItem *pInsertBefore)
1197 : ListItem(pForListBox)
1200 idListItemID.idType = ListItem::ID::PLI_REPLAY;
1201 idListItemID.id = 0;
1208 C4Rect rcOwnBounds = pNameLabel->GetBounds();
1209 rcOwnBounds.
Wdt += rcOwnBounds.
x; rcOwnBounds.
x = 0;
1210 rcOwnBounds.
Hgt += rcOwnBounds.
y; rcOwnBounds.
y = 0;
1211 SetBounds(rcOwnBounds);
1213 AddElement(pIcon); AddElement(pNameLabel);
1215 SetToolTip(
LoadResStr(
"IDS_MSG_REPLAYPLRS_DESC"));
1226 :
C4GUI::ListBox(rcBounds), eMode(eMode), iMaxUncollapsedPlayers(10), fIsCollapsed(false), iTeamFilter(iTeamFilter), dwTextColor(
C4GUI_MessageFontClr), pCustomFont(nullptr)
1240 ClientListItem *pClientItem =
static_cast<ClientListItem *
>(pItem);
1241 pClientItem->SetSoundIcon();
1245 C4PlayerInfoListBox::ListItem *C4PlayerInfoListBox::GetPlayerListItem(ListItem::ID::IDType eType, int32_t
id)
1247 ListItem::ID idSearch(eType,
id);
1252 ListItem *pItem =
static_cast<ListItem *
>(pEItem);
1253 if (pItem->idListItemID == idSearch)
return pItem;
1259 bool C4PlayerInfoListBox::PlrListItemUpdate(ListItem::ID::IDType eType, int32_t
id,
class ListItem **pEnsurePos)
1263 ListItem *pItem = GetPlayerListItem(eType,
id);
1264 if (!pItem)
return false;
1266 if (pItem != *pEnsurePos)
1274 *pEnsurePos =
static_cast<ListItem *
>(pItem->GetNext());
1283 static bool fPlayerListUpdating=
false;
1287 if (fPlayerListUpdating)
return;
1288 fPlayerListUpdating =
true;
1292 ListItem *pCurrInList =
static_cast<ListItem *
>(
GetFirst());
1295 UpdateSavegamePlayers(&pCurrInList);
1303 UpdatePlayersByTeam(&pCurrInList);
1305 UpdatePlayersByRandomTeam(&pCurrInList);
1313 UpdateScriptPlayers(&pCurrInList);
1315 UpdatePlayersByClient(&pCurrInList);
1327 ListItem *pDel = pCurrInList;
1328 pCurrInList =
static_cast<ListItem *
>(pCurrInList->GetNext());
1333 fPlayerListUpdating =
false;
1340 fIsCollapsed =
true;
1348 fIsCollapsed =
false;
1353 void C4PlayerInfoListBox::UpdateSavegamePlayers(ListItem **ppCurrInList)
1360 new FreeSavegamePlayersListItem(
this, *ppCurrInList);
1362 bool fAnyPlayers =
false;
1366 iInfoID = pInfo->
GetID();
1383 void C4PlayerInfoListBox::UpdateReplayPlayers(ListItem **ppCurrInList)
1387 new ReplayPlayersListItem(
this, *ppCurrInList);
1393 iInfoID = pInfo->
GetID();
1401 void C4PlayerInfoListBox::UpdateScriptPlayers(ListItem **ppCurrInList)
1410 new ScriptPlayersListItem(
this, *ppCurrInList);
1422 int32_t iInfoID = pInfo->
GetID();
1430 void C4PlayerInfoListBox::UpdatePlayersByTeam(ListItem **ppCurrInList)
1433 C4Team *pTeam; int32_t i=0;
1452 void C4PlayerInfoListBox::UpdatePlayersByRandomTeam(ListItem **ppCurrInList)
1455 bool fTeamLabelPut =
false;
1472 fTeamLabelPut =
true;
1481 void C4PlayerInfoListBox::UpdatePlayersByClient(ListItem **ppCurrInList)
1489 new ClientListItem(
this, pClient->
getCore(), *ppCurrInList);
1509 void C4PlayerInfoListBox::UpdatePlayersByEvaluation(ListItem **ppCurrInList,
bool fShowWinners)
1517 AddMode pShowWinnersAddModes[] = { AM_Winners, AM_Losers };
1518 AddMode pHideWinnersAddModes[] = { AM_All };
1519 AddMode *pAddModes; int32_t iAddModeCount;
1522 pAddModes = pShowWinnersAddModes; iAddModeCount = 2;
1526 pAddModes = pHideWinnersAddModes; iAddModeCount = 1;
1528 for (int32_t iAddMode = 0; iAddMode < iAddModeCount; ++iAddMode)
1530 AddMode eAddMode = pAddModes[iAddMode];
1539 C4Team *pTeam; int32_t i=0;
1542 UpdatePlayersByEvaluation(ppCurrInList, pTeam, eAddMode);
1545 UpdatePlayersByEvaluation(ppCurrInList,
nullptr, eAddMode);
1550 void C4PlayerInfoListBox::UpdatePlayersByEvaluation(ListItem **ppCurrInList,
C4Team *pTeam, C4PlayerInfoListBox::AddMode eWinMode)
1553 if (pTeam && eWinMode != AM_All)
if (pTeam->
HasWon() != (eWinMode == AM_Winners))
return;
1555 int32_t iTeamID = pTeam ? pTeam->
GetID() : 0;
1563 if (pPlrInfo->
GetTeam() != iTeamID)
continue;
1565 if (!pTeam && eWinMode != AM_All && pPlrInfo->
HasWon() != (eWinMode == AM_Winners))
continue;
1575 if (!fIsCollapsed)
return false;
1582 if (eMode != eNewMode)
1591 pCustomFont = pNewFont;
1592 this->dwTextColor = dwTextColor;
C4GraphicsResource GraphicsResource
#define C4GUI_WinningTextColor
#define C4GUI_StandardBGColor
#define C4GUI_DefaultListSpacing
#define C4GUI_WinningBackgroundColor
#define C4GUI_MessageFontAlpha
#define C4GUI_LosingTextColor
#define C4GUI_MessageFontClr
#define C4GUI_LosingBackgroundColor
const char * LoadResStr(const char *id)
const int32_t C4MC_Button_LeftDouble
DWORD GenerateRandomPlayerColor(int32_t iTry)
const int32_t TEAMID_Unknown
StdStrBuf FormatString(const char *szFmt,...)
const char * getNick() const
const char * getName() const
const C4ClientCore & getCore() const
const char * getName() const
C4Client * getClient(const C4Client *pAfter=nullptr) const
C4Client * getClientByID(int32_t iID) const
void CtrlRemove(const C4Client *pClient, const char *szReason)
int32_t getLocalID() const
int32_t GetClientID() const
C4PlayerInfo * GetPlayerInfo(int32_t iIndex) const
void DeactivateBlitModulation()
void DrawBoxDw(C4Surface *sfcDest, int iX1, int iY1, int iX2, int iY2, DWORD dwClr)
bool GetBlitModulation(DWORD &rdwColor)
void ActivateBlitModulation(DWORD dwWithClr)
void DrawClr(C4Facet &cgo, bool fAspect=true, DWORD dwClr=0)
bool Create(int iWdt, int iHgt, int iWdt2=C4FCT_Full, int iHgt2=C4FCT_Full)
void AddEntry(const char *szText, int32_t id)
static int32_t GetDefaultHeight()
void SetVisibility(bool fToValue) override
Element * GetNext() const
Element * GetSelectedItem()
bool InsertElement(Element *pChild, Element *pInsertBefore, int32_t iIndent=0)
void SetSelectionChangeCallbackFn(BaseCallbackHandler *pToHandler)
void RemoveElement(Element *pChild) override
bool ShowRemoveDlg(Dialog *pDlg)
void DoInput(C4PacketType eCtrlType, C4ControlPacket *pPkt, C4ControlDeliveryType eDelivery)
C4RoundResults & RoundResults
bool DrawTextSpecImage(C4Facet &target, const char *spec, class C4DrawTransform *transform, uint32_t color=0xff)
C4PlayerInfoList & PlayerInfos
C4PlayerInfoList & RestorePlayerInfos
C4GameParameters & Parameters
void OnClientAddPlayer(const char *szFilename, int32_t idClient)
C4Network2IOConnection * getDataConn() const
C4Network2IOConnection * getMsgConn() const
C4Network2Client * GetClientByID(int32_t iID) const
C4Network2Players Players
class C4GameLobby::MainDlg * GetLobby() const
C4Network2ClientList Clients
DWORD GetClientChatColor(int idForClient, bool fLobby) const
C4ClientPlayerInfos * GetLocalPlayerInfoPacket() const
void RequestPlayerInfoUpdate(const class C4ClientPlayerInfos &rRequest)
bool HasAutoGeneratedColor()
uint32_t GetOriginalColor() const
StdStrBuf GetLobbyName() const
bool LoadBigIcon(C4FacetSurface &fctTarget)
bool HasJoinIssued() const
void SetAssociatedSavegamePlayer(int32_t aidSavegamePlayer)
int32_t GetAssociatedSavegamePlayerID() const
int32_t getLeagueScore() const
void SetColor(DWORD dwUseClr)
int32_t getLeagueRankSymbol() const
uint32_t GetLobbyColor() const
void SetTeam(int32_t idToTeam)
const char * GetName() const
int32_t GetLeagueProjectedGain() const
C4PlayerType GetType() const
C4Network2Res * GetRes() const
bool SetAsScriptPlayer(const char *szName, uint32_t dwColor, uint32_t dwFlags, C4ID idExtra)
bool IsLeagueProjectedGainValid() const
bool IsPlayerItemCollapsed(PlayerListItem *pItem)
C4PlayerInfoListBox(const C4Rect &rcBounds, Mode eMode, int32_t iTeamFilter=0)
friend class TeamListItem
void SetClientSoundIcon(int32_t iForClientID)
void SetCustomFont(CStdFont *pNewFont, uint32_t dwTextColor)
void OnPlrListSelChange(class C4GUI::Element *pEl)
CStdFont * GetCustomFont() const
void SetMode(Mode eNewMode)
friend class PlayerListItem
uint32_t GetTextColor() const
@ PILBM_EvaluationNoWinners
C4ClientPlayerInfos * GetInfoByClientID(int32_t iClientID) const
C4ClientPlayerInfos * GetIndexedInfo(int32_t iIndex) const
int32_t GetActiveScriptPlayerCount(bool fCountSavegameResumes, bool fCountInvisible) const
C4PlayerInfo * GetPlayerInfoBySavegameID(int32_t id) const
C4PlayerInfo * GetNextPlayerInfoByID(int32_t id) const
bool DoPlayerInfoUpdate(C4ClientPlayerInfos *pUpdate)
int32_t GetActivePlayerCount(bool fCountInvisible) const
C4PlayerInfo * GetPlayerInfoByID(int32_t id) const
int32_t GetPlayerCount() const
const C4RoundResultsPlayers & GetPlayers() const
bool SettlementScoreIsHidden()
int32_t GetScoreNew() const
bool IsLeagueScoreNewValid() const
int32_t GetLeagueScoreGain() const
int32_t GetScoreOld() const
uint32_t GetTotalPlayingTime() const
const char * GetCustomEvaluationStrings()
bool IsScoreNewValid() const
int32_t GetLeagueRankSymbolNew() const
int32_t GetLeagueScoreNew() const
C4RoundResultsPlayer * GetByID(int32_t id) const
uint32_t GetColor() const
int32_t GetIndexedPlayer(int32_t iIndex) const
const char * GetIconSpec() const
int32_t GetPlayerCount() const
const char * GetName() const
C4Team * GetTeamByIndex(int32_t iIndex) const
bool IsMultiTeams() const
C4Team * GetTeamByID(int32_t iID) const
bool IsTeamVisible() const
bool CanLocalChooseTeam() const
int32_t GetMaxScriptPlayers() const
bool IsAutoGenerateTeams() const
bool IsTeamColors() const
StdStrBuf GetScriptPlayerName() const
bool CanLocalSeeTeam() const
int GetLineHeight() const
int32_t GetTextWidth(const char *szText, bool fCheckMarkup=true)
void Ref(const char *pnData)
const char * getData() const
void Format(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O