# Crosshair alpha (opaqueness, between 0 and 255).
crosshair_alpha (Crosshair alpha) int 255 0 255
-# Maximum number of recent chat items to show
-recent_chat_size (Recent Chat Messages) int 6 3 99
+# Maximum number of recent chat messages to show
+recent_chat_messages (Recent Chat Messages) int 6 2 20
# Whether node texture animations should be desynchronized per mapblock.
desynchronize_mapblock_texture_animation (Desynchronize block animation) bool true
# type: int min: 0 max: 255
# crosshair_alpha = 255
-# Maximum number of recent chat items to show
-# type: int min: 3 max: 99
-# recent_chat_size = 6
+# Maximum number of recent chat messages to show
+# type: int min: 2 max: 20
+# recent_chat_messages = 6
# Whether node texture animations should be desynchronized per mapblock.
# type: bool
return formatted_count - rows;
}
-void ChatBuffer::resize(u32 scrollback) {
+void ChatBuffer::resize(u32 scrollback)
+{
m_scrollback = scrollback;
if (m_unformatted.size() > m_scrollback)
- {
deleteOldest(m_unformatted.size() - m_scrollback);
- }
}
}
-void ChatBackend::applySettings(Settings* settings) {
- m_recent_buffer.resize(settings->getU32("recent_chat_size"));
+void ChatBackend::applySettings()
+{
+ u32 recent_lines = g_settings->getU32("recent_chat_messages");
+ recent_lines = rangelim(recent_lines, 2, 20);
+ m_recent_buffer.resize(recent_lines);
}
void ChatBackend::step(float dtime)
u32 formatChatLine(const ChatLine& line, u32 cols,
std::vector<ChatFormattedLine>& destination) const;
- void resize(u32 scrollback);
+ void resize(u32 scrollback);
protected:
s32 getTopScrollPos() const;
s32 getBottomScrollPos() const;
void scrollPageDown();
void scrollPageUp();
- // Resize recent buffer based on settings
- void applySettings(Settings* settings);
+ // Resize recent buffer based on settings
+ void applySettings();
private:
ChatBuffer m_console_buffer;
settings->setDefault("node_highlighting", "box");
settings->setDefault("crosshair_color", "(255,255,255)");
settings->setDefault("crosshair_alpha", "255");
- settings->setDefault("recent_chat_size", "6");
+ settings->setDefault("recent_chat_messages", "6");
settings->setDefault("hud_scaling", "1.0");
settings->setDefault("gui_scaling", "1.0");
settings->setDefault("gui_scaling_filter", "false");
// Remove stale "recent" chat messages from previous connections
chat_backend->clearRecentChat();
- // Make sure the size of the recent messages buffer is right
- chat_backend->applySettings(g_settings);
+ // Make sure the size of the recent messages buffer is right
+ chat_backend->applySettings();
// Chat backend and console
gui_chat_console = new GUIChatConsole(guienv, guienv->getRootGUIElement(),
gettext("Crosshair alpha");
gettext("Crosshair alpha (opaqueness, between 0 and 255).");
gettext("Recent Chat Messages");
- gettext("Maximum number of recent chat items to show");
+ gettext("Maximum number of recent chat lines to show");
gettext("Desynchronize block animation");
gettext("Whether node texture animations should be desynchronized per mapblock.");
gettext("Maximum hotbar width");