Allow ignoring clients in the game lobby

stable-5.1
Carl-Philip Hänsch 2010-03-28 21:33:51 +02:00
parent 4378de147c
commit 649df64f1a
9 changed files with 38 additions and 4 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 136 KiB

View File

@ -1332,4 +1332,6 @@ IDS_VOTE_SURRENDERWARNING=Es wurde entschieden, dass du das Spiel nicht verlasse
IDS_VOTE_VOTEDOUT=rausgeworfen
IDS_VOTE_WANTSTO=%s möchte %s
IDS_VOTE_WANTSTOALLOW=%s möchte %s. Zulassen?
IDS_NET_CLIENT_IGNORE_DESC=%s ignorieren. Du kannst Nachrichten von diesem Client dann in der Lobby nicht mehr lesen.
IDS_NET_CLIENT_IGNORE=Ignorieren
IDS_NET_CLIENT_UNIGNORE=Nicht mehr ignorieren

View File

@ -1332,3 +1332,6 @@ IDS_VOTE_SURRENDERWARNING=It was decided that you cannot leave the game. However
IDS_VOTE_VOTEDOUT=voted out
IDS_VOTE_WANTSTO=%s wants to %s
IDS_VOTE_WANTSTOALLOW=%s wants to %s. Allow?
IDS_NET_CLIENT_IGNORE_DESC=Ignores %s. You will not be able to see messages from this client.
IDS_NET_CLIENT_IGNORE=Ignore
IDS_NET_CLIENT_UNIGNORE=Unignore

View File

@ -6,6 +6,7 @@
* Copyright (c) 2005-2006 Günther Brammer
* Copyright (c) 2006 Florian Groß
* Copyright (c) 2007-2008 Matthes Bender
* Copyright (c) 2010 Carl-Philip Hänsch
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
*
* Portions might be copyrighted by other authors who have contributed
@ -664,7 +665,7 @@ namespace C4GameLobby
// output message should be prefixed with client already
const char *szMsgBuf = szMessage;
// 2do: log with player colors?
if (pChatBox && C4GUI::GetRes())
if (pChatBox && C4GUI::GetRes() && !pOfClient->IsIgnored())
{
pChatBox->AddTextLine(szMsgBuf, &C4GUI::GetRes()->TextFont, ::Network.Players.GetClientChatColor(pOfClient ? pOfClient->getID() : Game.Clients.getLocalID(), true) | C4GUI_MessageFontAlpha, true, true);
pChatBox->ScrollToBottom();

View File

@ -5,6 +5,7 @@
* Copyright (c) 2005, 2009 Peter Wortmann
* Copyright (c) 2005-2008 Günther Brammer
* Copyright (c) 2007 Matthes Bender
* Copyright (c) 2010 Carl-Philip Hänsch
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
*
* Portions might be copyrighted by other authors who have contributed
@ -695,6 +696,7 @@ namespace C4GUI
Ico_Disconnect = 49,
Ico_View = 50,
Ico_RegJoinOnly = 51,
Ico_Ignored = 52,
Ico_Ex_RecordOff = Ico_Extended + 0,
Ico_Ex_RecordOn = Ico_Extended + 1,

View File

@ -4,6 +4,7 @@
* Copyright (c) 2008 Sven Eberhardt
* Copyright (c) 2008 Matthes Bender
* Copyright (c) 2009 Nicolas Hake
* Copyright (c) 2010 Carl-Philip Hänsch
* Copyright (c) 2008-2009, RedWolf Design GmbH, http://www.clonk.de
*
* Portions might be copyrighted by other authors who have contributed
@ -825,6 +826,8 @@ bool C4PlayerInfoListBox::ClientListItem::IsLocal() const
C4GUI::Icons C4PlayerInfoListBox::ClientListItem::GetCurrentStatusIcon()
{
if (GetClient()->IsIgnored()) return C4GUI::Ico_Ignored;
// sound icon?
if (tLastSoundTime)
{
@ -909,10 +912,23 @@ C4GUI::ContextMenu *C4PlayerInfoListBox::ClientListItem::OnContext(C4GUI::Elemen
StdCopyStrBuf strClientInfoDesc(LoadResStr("IDS_NET_CLIENTINFO_DESC"));
pMenu->AddItem(LoadResStr("IDS_NET_CLIENTINFO"), strClientInfoDesc.getData(), C4GUI::Ico_None,
new C4GUI::CBMenuHandler<ClientListItem>(this, &ClientListItem::OnCtxInfo));
//Ignore button
if(!pClient->isLocal())
{
StdCopyStrBuf strNewColor(LoadResStr(pClient->IsIgnored() ? "IDS_NET_CLIENT_UNIGNORE" : "IDS_NET_CLIENT_IGNORE"));
pMenu->AddItem(strNewColor.getData(), FormatString(LoadResStr("IDS_NET_CLIENT_IGNORE_DESC"), pClient->getName()).getData(),
C4GUI::Ico_None, new C4GUI::CBMenuHandler<ClientListItem>(this, &ClientListItem::OnCtxIgnore), NULL);
}
// open it
return pMenu;
}
void C4PlayerInfoListBox::ClientListItem::OnCtxIgnore(C4GUI::Element *pListItem)
{
GetClient()->ToggleIgnore();
}
void C4PlayerInfoListBox::ClientListItem::OnCtxKick(C4GUI::Element *pListItem)
{
// host only

View File

@ -2,6 +2,7 @@
* OpenClonk, http://www.openclonk.org
*
* Copyright (c) 2008 Sven Eberhardt
* Copyright (c) 2010 Carl-Philip Hänsch
* Copyright (c) 2008-2009, RedWolf Design GmbH, http://www.clonk.de
Permission to use, copy, modify, and/or distribute this software for any
@ -211,6 +212,7 @@ private:
void OnCtxKick(C4GUI::Element *pListItem); // kick item selected in client ctx menu
void OnCtxActivate(C4GUI::Element *pListItem); // toggle player/observer
void OnCtxInfo(C4GUI::Element *pListItem); // show info dlg (modal)
void OnCtxIgnore(C4GUI::Element *pListItem);
void OnBtnAddPlr(C4GUI::Control *btn);
};

View File

@ -4,6 +4,7 @@
* Copyright (c) 2005-2006 Peter Wortmann
* Copyright (c) 2006 Günther Brammer
* Copyright (c) 2008 Armin Burgmeier
* Copyright (c) 2010 Carl-Philip Hänsch
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
*
* Portions might be copyrighted by other authors who have contributed
@ -105,12 +106,12 @@ void C4ClientCore::CompileFunc(StdCompiler *pComp)
// *** C4Client
C4Client::C4Client()
: pNetClient(NULL)
: pNetClient(NULL), fIsIgnored(false)
{
}
C4Client::C4Client(const C4ClientCore &Core)
: Core(Core), fLocal(false), pNetClient(NULL), pNext(NULL)
: Core(Core), fLocal(false), pNetClient(NULL), fIsIgnored(false), pNext(NULL)
{
}

View File

@ -2,6 +2,7 @@
* OpenClonk, http://www.openclonk.org
*
* Copyright (c) 2005-2006 Peter Wortmann
* Copyright (c) 2010 Carl-Philip Hänsch
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
*
* Portions might be copyrighted by other authors who have contributed
@ -95,6 +96,8 @@ private:
bool fLocal; // Local, NoSync
class C4Network2Client *pNetClient; // Local, NoSync
bool fIsIgnored; // Local, NoSync: chat messages from this client are suppressed
C4Client *pNext;
public:
@ -107,6 +110,7 @@ public:
bool isActivated() const { return Core.isActivated(); }
bool isObserver() const { return Core.isObserver(); }
bool isRegistered()const { return Core.isRegistered(); }
bool IsIgnored() const { return fIsIgnored; }
bool isLocal() const { return fLocal; }
C4Network2Client *getNetClient() const { return pNetClient; }
@ -118,11 +122,14 @@ public:
void SetObserver() { Core.SetObserver(true); }
void SetLocal();
void ToggleIgnore() { fIsIgnored = !fIsIgnored; }
void UnlinkNetClient() { pNetClient = NULL; }
void Remove();
void CompileFunc(StdCompiler *pComp);
};
class C4ClientList