diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-04-02 23:51:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-02 23:51:08 +0200 |
commit | 2481ea27ce0f423f3e6f3522539d20e1500cf572 (patch) | |
tree | 73251dcbf9146d7499177f59b266d8c60b0eaae7 /src/chat.cpp | |
parent | e98fd934ce17a7af0b4629fc88158373303c88a0 (diff) | |
download | minetest-2481ea27ce0f423f3e6f3522539d20e1500cf572.tar.gz minetest-2481ea27ce0f423f3e6f3522539d20e1500cf572.tar.bz2 minetest-2481ea27ce0f423f3e6f3522539d20e1500cf572.zip |
Fix many issues reported by clang-tidy (#7189)
* Fix many issues reported by clang-tidy
We have many issues in code related to some performance to float <-> double.
Clang-tidy reported it in performance-type-promotion-in-math-fn
I fixed many of them. It's not ready for a promote to blocking
Also fix some value which should be const-ref
Diffstat (limited to 'src/chat.cpp')
-rw-r--r-- | src/chat.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/chat.cpp b/src/chat.cpp index 38c0332bf..cc0980230 100644 --- a/src/chat.cpp +++ b/src/chat.cpp @@ -37,13 +37,12 @@ ChatBuffer::ChatBuffer(u32 scrollback): m_empty_formatted_line.first = true; } -void ChatBuffer::addLine(std::wstring name, std::wstring text) +void ChatBuffer::addLine(const std::wstring &name, const std::wstring &text) { ChatLine line(name, text); m_unformatted.push_back(line); - if (m_rows > 0) - { + if (m_rows > 0) { // m_formatted is valid and must be kept valid bool scrolled_at_bottom = (m_scroll == getBottomScrollPos()); u32 num_added = formatChatLine(line, m_cols, m_formatted); @@ -52,8 +51,7 @@ void ChatBuffer::addLine(std::wstring name, std::wstring text) } // Limit number of lines by m_scrollback - if (m_unformatted.size() > m_scrollback) - { + if (m_unformatted.size() > m_scrollback) { deleteOldest(m_unformatted.size() - m_scrollback); } } |