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

add option to hide unit tooltip in report log, correct issue with pre… #4609

Merged
merged 2 commits into from
Jul 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions megamek/i18n/megamek/common/options/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ GameOptionsInfo.option.auto_ams.displayableName=Automatically Assign AMS
GameOptionsInfo.option.auto_ams.description=When on, Megamek automatically determines AMS assignments based on highest expected damage from missile attacks
GameOptionsInfo.option.full_rotor_hits.displayableName=(Unofficial) No reduced damage for VTOL rotor hits
GameOptionsInfo.option.full_rotor_hits.description=If checked, VTOLs will take full damage from a rotor hit instead of Total Warfare-style reduced damage. \nUnchecked by default.
GameOptionsInfo.option.suppress_unit_tooltip_in_report_log.displayableName=Hide Unit Tooltip in report log
GameOptionsInfo.option.suppress_unit_tooltip_in_report_log.description=If checked, Unit Tooltip will not show in the end phase on the report log
GameOptionsInfo.option.hide_unofficial.displayableName=Don't show unofficial game options
GameOptionsInfo.option.hide_unofficial.description=If checked, unofficial game options will be deactivated and hidden
GameOptionsInfo.option.hide_legacy.displayableName=Don't show legacy game options
Expand Down
1 change: 1 addition & 0 deletions megamek/src/megamek/common/options/GameOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public synchronized void initialize() {
addOption(base, OptionsConstants.BASE_RANDOM_BASEMENTS, true);
addOption(base, OptionsConstants.BASE_AUTO_AMS, true);
addOption(base, OptionsConstants.BASE_TURN_TIMER, 0);
addOption(base, OptionsConstants.BASE_SUPPRESS_UNIT_TOOLTIP_IN_REPORT_LOG, false);
addOption(base, OptionsConstants.BASE_HIDE_UNOFFICIAL, false);
addOption(base, OptionsConstants.BASE_HIDE_LEGACY, false);

Expand Down
1 change: 1 addition & 0 deletions megamek/src/megamek/common/options/OptionsConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ public class OptionsConstants {
public static final String BASE_BREEZE = "breeze";
public static final String BASE_RANDOM_BASEMENTS = "random_basements";
public static final String BASE_AUTO_AMS = "auto_ams";
public static final String BASE_SUPPRESS_UNIT_TOOLTIP_IN_REPORT_LOG = "suppress_unit_tooltip_in_report_log";
public static final String BASE_HIDE_UNOFFICIAL = "hide_unofficial";
public static final String BASE_HIDE_LEGACY = "hide_legacy";

Expand Down
16 changes: 15 additions & 1 deletion megamek/src/megamek/server/GameManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1780,6 +1780,10 @@ private List<Report> bvReport(String name, int playerID, BVCountHelper bvc, bool
}

private void entityStatusReport() {
if (game.getOptions().booleanOption(OptionsConstants.BASE_SUPPRESS_UNIT_TOOLTIP_IN_REPORT_LOG)) {
return;
}

List<Report> reports = new ArrayList<>();
List<Entity> entities = game.getEntitiesVector().stream()
.filter(e -> (e.isDeployed() && e.getPosition() != null))
Expand All @@ -1789,7 +1793,12 @@ private void entityStatusReport() {
comp = comp.thenComparing((Entity e) -> e.getDisplayName());
entities.sort(comp);

Report r = new Report(7600);
// turn off preformatted text for unit tool tip
Report r = new Report(1230, Report.PUBLIC);
r.add("</pre>");
reports.add(r);

r = new Report(7600);
reports.add(r);

for (Entity e : entities) {
Expand All @@ -1810,6 +1819,11 @@ private void entityStatusReport() {
reports.add(r);
}

// turn preformatted text back on, so that text after will display properly
r = new Report(1230, Report.PUBLIC);
r.add("<pre>");
reports.add(r);

vPhaseReport.addAll(reports);
}

Expand Down