From 4ee3f9d01171d885ce655fc72ba8ac45f2a47773 Mon Sep 17 00:00:00 2001 From: Sven Eberhardt Date: Sun, 18 Apr 2010 10:18:16 +0200 Subject: [PATCH] Fix player color alpha after /plrclr change command (#254) --- src/control/C4PlayerInfo.cpp | 6 ++++++ src/gui/C4GameLobby.cpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/control/C4PlayerInfo.cpp b/src/control/C4PlayerInfo.cpp index 01d973b36..626a96009 100644 --- a/src/control/C4PlayerInfo.cpp +++ b/src/control/C4PlayerInfo.cpp @@ -807,6 +807,12 @@ void C4PlayerInfoList::UpdatePlayerAttributes(C4ClientPlayerInfos *pForInfo, boo pInfo->SetColor(dwForceClr); pForInfo->SetUpdated(); } + // make sure colors have correct alpha (modified engines might send malformed packages of transparent colors) + if ((pInfo->GetColor() & 0xff000000u) != 0xff000000u) + { + pInfo->SetColor(pInfo->GetColor() | 0xff000000u); + pForInfo->SetUpdated(); + } } if (fResolveConflicts) ResolvePlayerAttributeConflicts(pForInfo); } diff --git a/src/gui/C4GameLobby.cpp b/src/gui/C4GameLobby.cpp index eac3352be..b02189e1c 100644 --- a/src/gui/C4GameLobby.cpp +++ b/src/gui/C4GameLobby.cpp @@ -540,7 +540,7 @@ namespace C4GameLobby else { // color validation - dwNewClr &= 0xffffff; + dwNewClr |= 0xff000000; if (!dwNewClr) ++dwNewClr; // request a color change to this color C4ClientPlayerInfos LocalInfoRequest = *pCltNfo;