-
Notifications
You must be signed in to change notification settings - Fork 118
feat: Add chat prefixes to distinguish All and Observer messages #1764
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
base: main
Are you sure you want to change the base?
feat: Add chat prefixes to distinguish All and Observer messages #1764
Conversation
Adds [All] prefix for messages sent to all players and [Observers] prefix for observer chat. Allies-only messages show no prefix for cleaner display. This improves chat clarity by making it immediately obvious when a message was sent to everyone versus just to allies, following the convention used in games like League of Legends.
| return; | ||
| } | ||
|
|
||
| // TheSuperHackers @feature TheSuperHackers 31/10/2025 Add chat prefix to distinguish between All/Observers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we using European date format d/m/yyyy or freedom date format m/d/yyyy?
Edit: Oh no, I've been using American, but I see a lot of European in the codebase.
Stubbjax
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to use localisation keys and the appropriate TheGameText->fetch() calls.
|
I think as global chat is typically considered the default, it makes more sense to prefix team messages rather than global messages. Example: There is an existing It also seems unnecessary to prefix observer messages as fellow observers can easily deduce who is observing vs playing. |
- Changed from prefixing global/observer messages to prefixing team messages - Global messages now have no prefix (default behavior) - Team messages are prefixed with (TEAM) using GUI:Team localization key - Removed observer message prefix as it's unnecessary - Used TheGameText->FETCH_OR_SUBSTITUTE() for proper localization support - Format: Global chat: '[Player Name] Message' - Format: Team chat: '(TEAM) [Player Name] Message' - Applied changes to both GeneralsMD and Generals codebases
|
Use |
| } | ||
|
|
||
| // Team message: sent to allies only (not to all active players) | ||
| isTeamMessage = (activePlayers == alliesCount && alliesCount > 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a complicated way to determine this is a team message. Can this be simplified?
Also this would be better as a standalone isTeamChat function, not embedded in ConnectionManager::processChat like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay its no big deal will work on it later still in the process of understanding the code
…onManager::processChat() - Add isTeamChat helper and localized GUI:Team prefix
… for team/global messages in ConnectionManager::processChat - Use CHAT:TeamFormat and CHAT:GlobalFormat via FETCH_OR_SUBSTITUTE_FORMAT - Keep team detection with isTeamChat helper - Applied to both GeneralsMD and Generals versions
5a10ff3 to
a8a5138
Compare
|
Force-pushed to apply requested formatting / localization changes. Ready for re-review 👍 |
Skyaero42
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels a bit like this was coded with AI without after check. It needs another pass.
Also the post description doesnt match the code.
Up for discussion, i think all message should be marked, so All, Team and Observer
| // Simplified team chat detection + localizable format via FETCH_OR_SUBSTITUTE_FORMAT() | ||
| // ============================================================= | ||
|
|
||
| static Bool isTeamChat(const Player* sender, UInt32 mask) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functions should not exist within other functions. Usr private functions in the class instead
| Bool amIObserver = !ThePlayerList->getLocalPlayer()->isPlayerActive(); | ||
| Bool canSeeChat = (amIObserver || !fromObserver) && !TheGameInfo->getConstSlot(playerID)->isMuted(); | ||
| // ============================================================= | ||
| // ConnectionManager::processChat() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels a bit too much written by AI without a human checking the result.
Comment is incorrect, because it is not a refactor but a feature or enhancment.
| Int allies = 0; | ||
| Int recipients = 0; | ||
|
|
||
| for (Int i = 0; i < MAX_SLOTS; ++i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think this is correct. You only need to verify the relationship between receiver and sender. Don't need to loop through all players for this.

Description
Adds chat message prefixes to improve in-game communication clarity:
Changes
Behavior
n- **Observer chat**: [Observers] [PlayerName] messagenThis follows the convention used in games like League of Legends and makes it immediately obvious whether a message was sent to everyone or just to your team.
Testing