fix freezes from server talks spam
This commit is contained in:
parent
83f86eac64
commit
fb36ff2da3
|
@ -54,13 +54,15 @@ bool StaticText::addMessage(const std::string& name, Otc::SpeakType type, const
|
|||
m_name = name;
|
||||
m_messageType = type;
|
||||
}
|
||||
else {
|
||||
else if(m_messages.size() > 20) {
|
||||
// to many messages, ignore to avoid lag
|
||||
return false;
|
||||
} else {
|
||||
// we can only add another message if it follows these conditions
|
||||
if(m_name != name || m_messageType != type)
|
||||
return false;
|
||||
}
|
||||
|
||||
m_messages.push_back(message);
|
||||
compose();
|
||||
|
||||
auto self = asStaticText();
|
||||
|
@ -73,7 +75,7 @@ bool StaticText::addMessage(const std::string& name, Otc::SpeakType type, const
|
|||
|
||||
void StaticText::removeMessage()
|
||||
{
|
||||
m_messages.erase(m_messages.begin());
|
||||
m_messages.pop_front();
|
||||
|
||||
if(m_messages.empty()) {
|
||||
// schedule removal
|
||||
|
|
|
@ -50,7 +50,7 @@ private:
|
|||
void compose();
|
||||
|
||||
Boolean<false> m_yell;
|
||||
std::vector<std::string> m_messages;
|
||||
std::deque<std::string> m_messages;
|
||||
std::string m_name;
|
||||
Otc::SpeakType m_messageType;
|
||||
Color m_color;
|
||||
|
|
Loading…
Reference in New Issue