parent
4a24e39ac1
commit
ea55a22a71
@ -1089,14 +1089,20 @@ void cClientHandle::HandleChat(const AString & a_Message)
|
||||
return;
|
||||
}
|
||||
|
||||
// Not a command, broadcast as a simple message:
|
||||
AString Msg;
|
||||
Printf(Msg, "%s<%s>%s %s",
|
||||
m_Player->GetColor().c_str(),
|
||||
m_Player->GetName().c_str(),
|
||||
cChatColor::White.c_str(),
|
||||
Message.c_str()
|
||||
);
|
||||
// Not a command, broadcast as a message:
|
||||
cCompositeChat Msg;
|
||||
AString Color = m_Player->GetColor();
|
||||
if (Color.length() == 3)
|
||||
{
|
||||
Color = AString("@") + Color[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
Color.empty();
|
||||
}
|
||||
Msg.AddTextPart(AString("<") + m_Player->GetName() + "> ", Color);
|
||||
Msg.ParseText(a_Message);
|
||||
Msg.UnderlineUrls();
|
||||
m_Player->GetWorld()->BroadcastChat(Msg);
|
||||
}
|
||||
|
||||
|
@ -299,6 +299,21 @@ void cCompositeChat::SetMessageType(eMessageType a_MessageType)
|
||||
|
||||
|
||||
|
||||
void cCompositeChat::UnderlineUrls(void)
|
||||
{
|
||||
for (cParts::iterator itr = m_Parts.begin(), end = m_Parts.end(); itr != end; ++itr)
|
||||
{
|
||||
if ((*itr)->m_PartType == ptUrl)
|
||||
{
|
||||
(*itr)->m_Style.append("u");
|
||||
}
|
||||
} // for itr - m_Parts[]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cCompositeChat::AddStyle(AString & a_Style, const AString & a_AddStyle)
|
||||
{
|
||||
if (a_AddStyle.empty())
|
||||
|
@ -155,6 +155,9 @@ public:
|
||||
/** Returns the message type set previously by SetMessageType(). */
|
||||
eMessageType GetMessageType(void) const { return m_MessageType; }
|
||||
|
||||
/** Adds the "underline" style to each part that is an URL. */
|
||||
void UnderlineUrls(void);
|
||||
|
||||
// tolua_end
|
||||
|
||||
const cParts & GetParts(void) const { return m_Parts; }
|
||||
|
@ -226,7 +226,8 @@ public:
|
||||
|
||||
// tolua_begin
|
||||
|
||||
/// Returns the full color code to use for this player, based on their primary group or set in m_Color
|
||||
/** Returns the full color code to use for this player, based on their primary group or set in m_Color.
|
||||
The returned value includes the cChatColor::Delimiter. */
|
||||
AString GetColor(void) const;
|
||||
|
||||
/** tosses the item in the selected hotbar slot */
|
||||
|
Loading…
Reference in New Issue
Block a user