Skip to content

show mana column for solo players with mana#531

Merged
nschimme merged 1 commit into
MUME:masterfrom
nschimme:fix-group-widget-mana-visibility-3472155908677027235
May 18, 2026
Merged

show mana column for solo players with mana#531
nschimme merged 1 commit into
MUME:masterfrom
nschimme:fix-group-widget-mana-visibility-3472155908677027235

Conversation

@nschimme

@nschimme nschimme commented May 18, 2026

Copy link
Copy Markdown
Contributor

The GroupWidget was hiding the Mana column until the player joined a group, even if the player themselves had mana. This happened because column visibility was only updated when characters were added or removed, but not when they were updated.

This commit modifies GroupWidget::slot_onCharacterUpdated to conditionally trigger updateColumnVisibility() if the updated character's mana status is inconsistent with the current column visibility. This ensures the Mana column appears as soon as the player's vitals (including mana) are first received, while avoiding redundant visibility updates when the state hasn't changed.

Summary by Sourcery

Bug Fixes:

  • Fix mana column remaining hidden for solo players whose characters have mana by updating column visibility when character mana status changes.

The GroupWidget was hiding the Mana column until the player joined a
group, even if the player themselves had mana. This happened because
column visibility was only updated when characters were added or
removed, but not when they were updated.

This commit modifies GroupWidget::slot_onCharacterUpdated to
conditionally trigger updateColumnVisibility() if the updated
character's mana status is inconsistent with the current column
visibility. This ensures the Mana column appears as soon as the player's
vitals (including mana) are first received, while avoiding redundant
visibility updates when the state hasn't changed.
@sourcery-ai

sourcery-ai Bot commented May 18, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds logic to GroupWidget::slot_onCharacterUpdated to re-evaluate mana column visibility when a character’s mana stats change, ensuring the Mana column appears for solo players with mana without performing redundant visibility updates.

Sequence diagram for updated GroupWidget::slot_onCharacterUpdated mana visibility handling

sequenceDiagram
    participant GroupWidget
    participant GroupModel as GroupModel_m_model
    participant GroupTable as GroupTable_m_table
    participant Character as SharedGroupChar

    GroupWidget->>GroupModel: updateCharacter(character)
    GroupWidget->>Character: getMana()
    GroupWidget->>Character: getMaxMana()
    GroupWidget->>GroupTable: isColumnHidden(manaCol)
    alt [mana column visibility inconsistent with hasMana]
        GroupWidget->>GroupWidget: updateColumnVisibility()
    end
    GroupWidget->>GroupWidget: updatePulseTimer()
Loading

File-Level Changes

Change Details Files
Re-evaluate mana column visibility when a character update indicates mana presence or absence has changed.
  • Call updateCharacter on the model remains first step in slot_onCharacterUpdated.
  • Compute the mana column index from ColumnTypeEnum::MANA.
  • Determine whether the updated character has mana based on current and maximum mana values.
  • Compare the table’s current hidden state for the mana column against the character’s mana presence and call updateColumnVisibility only when they are inconsistent.
  • Preserve existing pulse timer update behavior after potential visibility update.
src/group/groupwidget.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The condition if (m_table->isColumnHidden(manaCol) == hasMana) is logically correct but a bit opaque; consider computing an explicit shouldShowMana and comparing it to the current hidden state to make the intent clearer.
  • The hasMana check duplicates the mana visibility decision logic; if similar logic exists elsewhere (e.g., when initially setting column visibility), consider centralizing this into a shared helper to keep behavior consistent.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The condition `if (m_table->isColumnHidden(manaCol) == hasMana)` is logically correct but a bit opaque; consider computing an explicit `shouldShowMana` and comparing it to the current hidden state to make the intent clearer.
- The `hasMana` check duplicates the mana visibility decision logic; if similar logic exists elsewhere (e.g., when initially setting column visibility), consider centralizing this into a shared helper to keep behavior consistent.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov

codecov Bot commented May 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 25.36%. Comparing base (4f57972) to head (e45b7f7).

Files with missing lines Patch % Lines
src/group/groupwidget.cpp 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #531      +/-   ##
==========================================
- Coverage   25.36%   25.36%   -0.01%     
==========================================
  Files         519      519              
  Lines       43181    43185       +4     
  Branches     4705     4706       +1     
==========================================
  Hits        10952    10952              
- Misses      32229    32233       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nschimme nschimme merged commit 920f5ab into MUME:master May 18, 2026
20 of 21 checks passed
@nschimme nschimme deleted the fix-group-widget-mana-visibility-3472155908677027235 branch May 18, 2026 19:10
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.

1 participant