Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Reveal chat history when chat message box is open. #9025

Merged
merged 2 commits into from Apr 16, 2021

Conversation

PeterN
Copy link
Member

@PeterN PeterN commented Apr 11, 2021

Motivation / Problem

Chat history is removed from the screen after a few seconds. It is visible by opening the console, but this fills a large portion of the screen and may also contain other non-chat messages. It also requires extra keypresses.

Description

Instead of removing chat messages after the chat duration, they are now hidden from the normal chat history, until the chat message box is opened, where the full message history is automatically revealed.

Limitations

Default chat history length seems to be quite long by default.

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@PeterN PeterN changed the title Chatmsg list Reveal chat history when chat message box is open Apr 11, 2021
@PeterN PeterN changed the title Reveal chat history when chat message box is open Feature: Reveal chat history when chat message box is open. Apr 11, 2021
Copy link
Contributor

@stormcone stormcone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor thingie. :)

src/network/network_chat_gui.cpp Outdated Show resolved Hide resolved
src/network/network_chat_gui.cpp Outdated Show resolved Hide resolved
Comment on lines +48 to +58
static std::deque<ChatMessage> _chatmsg_list; ///< The actual chat message list.
static bool _chatmessage_dirty = false; ///< Does the chat message need repainting?
static bool _chatmessage_visible = false; ///< Is a chat message visible.
static bool _chat_tab_completion_active; ///< Whether tab completion is active.
static uint MAX_CHAT_MESSAGES = 0; ///< The limit of chat messages to show.

/**
* Time the chat history was marked dirty. This is used to determine if expired
* messages have recently expired and should cause a redraw to hide them.
*/
static std::chrono::steady_clock::time_point _chatmessage_dirty_time;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth combining these all into a struct? Just to hold everything together

src/network/network_chat_gui.cpp Outdated Show resolved Hide resolved
src/network/network_chat_gui.cpp Outdated Show resolved Hide resolved
@PeterN
Copy link
Member Author

PeterN commented Apr 12, 2021

Tweaked to keep list in the order it is displayed, so no reverse iteration is required.

Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

@michicc michicc merged commit cb9f56d into OpenTTD:master Apr 16, 2021
@PeterN PeterN deleted the chatmsg-list branch April 16, 2021 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants