Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kuronekochomusuke
Copy link
Collaborator

  • correct issues with the unittooltip not displaying correctly in the report

image

@kuronekochomusuke kuronekochomusuke requested a review from a team as a code owner June 7, 2025 13:53
@kuronekochomusuke kuronekochomusuke added Bug Any kind of issue that cannot be fixed without code changes Reports Anything relating in game reporting labels Jun 7, 2025
@kuronekochomusuke kuronekochomusuke changed the title correct issues with the unittooltip not displaying correctly in the r… Issue: correct issues with the unittooltip not displaying correctly in the r… Jun 7, 2025
@kuronekochomusuke kuronekochomusuke changed the title Issue: correct issues with the unittooltip not displaying correctly in the r… Issue: correct issues with the unittooltip not displaying correctly in the report Jun 7, 2025
@codecov
Copy link

codecov bot commented Jun 7, 2025

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 30.73%. Comparing base (9b84606) to head (a4ffe66).
Report is 56 commits behind head on master.

Files with missing lines Patch % Lines
...gamek/client/ui/clientGUI/tooltip/UnitToolTip.java 0.00% 1 Missing ⚠️
...src/megamek/server/totalwarfare/TWGameManager.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7222      +/-   ##
============================================
- Coverage     30.75%   30.73%   -0.02%     
+ Complexity    17581    17546      -35     
============================================
  Files          2974     2974              
  Lines        290337   290346       +9     
  Branches      50611    50599      -12     
============================================
- Hits          89285    89239      -46     
- Misses       194338   194409      +71     
+ Partials       6714     6698      -16     

☔ 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.

@HammerGS HammerGS requested a review from Copilot June 7, 2025 17:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses formatting issues for unit tooltips within the report view by removing legacy <pre> tag injections in the server report generator and gating sensor‐only tooltips on the report flag in the client.

  • Remove hard‐coded closing/opening <pre> wrappers around the status report
  • Always generate the report section for unit tooltips at a fixed position
  • Skip sensor‐only tooltips when rendering in report mode on the client

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
megamek/src/megamek/server/totalwarfare/TWGameManager.java Stripped out <pre> tag inserts and adjusted report creation sequence
megamek/src/megamek/client/ui/clientGUI/tooltip/UnitToolTip.java Added !report check to prevent sensor‐only tooltips from appearing in reports
Comments suppressed due to low confidence (2)

megamek/src/megamek/server/totalwarfare/TWGameManager.java:1857

  • Here r still refers to the previous Report instance instead of a new one that would re-enable <pre> formatting. This will add the wrong object and drop necessary <pre> tags, breaking report layout. Consider reinstating a new Report with <pre> before this call.
reports.add(r);

megamek/src/megamek/client/ui/clientGUI/tooltip/UnitToolTip.java:131

  • [nitpick] This new report flag check changes tooltip logic; there may not be existing tests covering both branches. Add a unit test to verify sensor-only tooltips are correctly skipped when report is true.
if ((!report) && (EntityVisibilityUtils.onlyDetectedBySensors(localPlayer, entity))) {

boolean inGameValue, boolean showBV, boolean showSensors, boolean showSeenBy, boolean report) {
// Tooltip info for a sensor blip
if (EntityVisibilityUtils.onlyDetectedBySensors(localPlayer, entity)) {
if ((!report) && (EntityVisibilityUtils.onlyDetectedBySensors(localPlayer, entity))) {
Copy link

Copilot AI Jun 7, 2025

Choose a reason for hiding this comment

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

[nitpick] The extra parentheses around each condition are unnecessary. Simplify to if (!report && EntityVisibilityUtils.onlyDetectedBySensors(localPlayer, entity)) for improved readability.

Suggested change
if ((!report) && (EntityVisibilityUtils.onlyDetectedBySensors(localPlayer, entity))) {
if (!report && EntityVisibilityUtils.onlyDetectedBySensors(localPlayer, entity)) {

Copilot uses AI. Check for mistakes.
@rjhancock rjhancock merged commit a96e951 into MegaMek:master Jun 7, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Any kind of issue that cannot be fixed without code changes Reports Anything relating in game reporting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants