diff --git a/src/otclient/core/statictext.cpp b/src/otclient/core/statictext.cpp index a97f19a2..b09e6519 100644 --- a/src/otclient/core/statictext.cpp +++ b/src/otclient/core/statictext.cpp @@ -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 diff --git a/src/otclient/core/statictext.h b/src/otclient/core/statictext.h index 4cf51100..93293823 100644 --- a/src/otclient/core/statictext.h +++ b/src/otclient/core/statictext.h @@ -50,7 +50,7 @@ private: void compose(); Boolean m_yell; - std::vector m_messages; + std::deque m_messages; std::string m_name; Otc::SpeakType m_messageType; Color m_color;