m_empty_formatted_line.first = true;
}
-ChatBuffer::~ChatBuffer()
-{
-}
-
void ChatBuffer::addLine(std::wstring name, std::wstring text)
{
ChatLine line(name, text);
void ChatBuffer::step(f32 dtime)
{
- for (u32 i = 0; i < m_unformatted.size(); ++i)
- {
- m_unformatted[i].age += dtime;
+ for (ChatLine &line : m_unformatted) {
+ line.age += dtime;
}
}
s32 index = m_scroll + (s32) row;
if (index >= 0 && index < (s32) m_formatted.size())
return m_formatted[index];
- else
- return m_empty_formatted_line;
+
+ return m_empty_formatted_line;
}
void ChatBuffer::scroll(s32 rows)
s32 rows = (s32) m_rows;
if (rows == 0)
return 0;
- else if (formatted_count <= rows)
+
+ if (formatted_count <= rows)
return formatted_count - rows;
- else
- return 0;
+
+ return 0;
}
s32 ChatBuffer::getBottomScrollPos() const
{
}
-ChatPrompt::~ChatPrompt()
-{
-}
-
void ChatPrompt::input(wchar_t ch)
{
m_line.insert(m_cursor, 1, ch);
// find all names that start with the selected prefix
std::vector<std::wstring> completions;
- for (std::list<std::string>::const_iterator
- i = names.begin();
- i != names.end(); ++i)
- {
- if (str_starts_with(narrow_to_wide(*i), prefix, true))
- {
- std::wstring completion = narrow_to_wide(*i);
+ for (const std::string &name : names) {
+ if (str_starts_with(narrow_to_wide(name), prefix, true)) {
+ std::wstring completion = narrow_to_wide(name);
if (prefix_start == 0)
completion += L": ";
completions.push_back(completion);
}
}
+
if (completions.empty())
return;
{
}
-ChatBackend::~ChatBackend()
-{
-}
-
void ChatBackend::addMessage(std::wstring name, std::wstring text)
{
// Note: A message may consist of multiple lines, for example the MOTD.