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

Fix #5795: Implement TW LOS and Forest rules for Low Altitude maps #5797

Merged

Conversation

Sleet01
Copy link
Collaborator

@Sleet01 Sleet01 commented Jul 26, 2024

It looks like this has been broken since before 0.48.0, maybe since 2003: we have been treating Low-Altitude map terrain as if it were Ground Map terrain, which means it never obscures Aerospace units from each other.

Buildings and landed Dropships (which are treated as buildings) should not obscure lines of site between any Aero units using Altitude on a Low-Altitude map.
Additionally, forests should only rise 1 level above the terrain they are on when Low Altitude maps are created from Ground Maps - thankfully the Hex class provides a mechanism to tweak this stat for forest / jungle / foliage hexes.

Total Warfare p. 81 says:

Each level on a ground mapsheet hex corresponds to an
aerospace altitude. For example, a hill marked Level 2 equals
Altitude 2. Units can enter that hex only if flying at Altitude 3
or higher (or 2 if landing; see p. 87). Wooded hexes rise one
altitude above the underlying terrain. For simplicity sake,
building hexes do not rise above the underlying terrain and
are ignored by aerospace units (unless the unit is attempting
to land, see p. 87).

Unfortunately it was much simpler to reverse the normal conversion and use the units' Altitudes as Elevation, rather than convert Elevation into Altitudes, due to the way that LosEffects is written.

Testing:

  • Various ASFs and Conventional Fighters on a multitude of Low Altitude maps constructed from existing templates.
  • Ran all 3 projects' unit tests.

Close #5795

image

Copy link

codecov bot commented Jul 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 29.05%. Comparing base (8b06aec) to head (6827413).
Report is 16 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5797      +/-   ##
============================================
- Coverage     29.06%   29.05%   -0.01%     
+ Complexity    13913    13908       -5     
============================================
  Files          2507     2507              
  Lines        266339   266362      +23     
  Branches      47611    47624      +13     
============================================
- Hits          77403    77397       -6     
- Misses       185012   185027      +15     
- Partials       3924     3938      +14     

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

Copy link
Member

@SJuliez SJuliez left a comment

Choose a reason for hiding this comment

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

I have some comments.

megamek/src/megamek/common/Board.java Outdated Show resolved Hide resolved
megamek/src/megamek/common/LosEffects.java Outdated Show resolved Hide resolved
@Sleet01 Sleet01 force-pushed the Fix_5795_low_alt_terrain_not_obscuring branch from d4f4d2f to 6827413 Compare July 28, 2024 05:12
@Sleet01 Sleet01 requested a review from SJuliez July 28, 2024 05:14
@SJuliez SJuliez merged commit c24ec01 into MegaMek:master Jul 28, 2024
6 checks passed
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.

Low-altitude Map Terrain not Obstructing Fire
2 participants