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

Enhancement - Improve Deployment-Phase Towing Logic #6606

Merged
merged 5 commits into from
Feb 25, 2025

Conversation

psikomonkie
Copy link
Collaborator

The original implementation of "put warning signs where your tractor/trailer wouldn't be valid" did not properly consider an already deployed tractors/trailers that were more than one link away. This is specifically tested now with TowLinkWarningTest::testDeployTrailerMultiDeployed(). This also includes a change to Princess to use the new method.

Copy link

codecov bot commented Feb 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 29.14%. Comparing base (5407b8b) to head (af1ab22).
Report is 53 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##             master    #6606    +/-   ##
==========================================
  Coverage     29.13%   29.14%            
- Complexity    15366    15405    +39     
==========================================
  Files          2863     2863            
  Lines        279868   279996   +128     
  Branches      49291    49302    +11     
==========================================
+ Hits          81553    81611    +58     
- Misses       192855   192908    +53     
- Partials       5460     5477    +17     

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

Copy link
Collaborator

@Scoppio Scoppio left a comment

Choose a reason for hiding this comment

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

this PR uses alot of lists and sets, which is great, but it also uses alot of nulls and null checks, please take a look if you can change some or most of the nulls you are using for empty collections instead, just to reduce the number of situations where we have to check for null, also there is deeply nested code in many places, see if its possible to avoid some of the nesting and aggregate multiple conditionals in a single test.

@psikomonkie
Copy link
Collaborator Author

psikomonkie commented Feb 24, 2025

this PR uses alot of lists and sets, which is great, but it also uses alot of nulls and null checks, please take a look if you can change some or most of the nulls you are using for empty collections instead, just to reduce the number of situations where we have to check for null, also there is deeply nested code in many places, see if its possible to avoid some of the nesting and aggregate multiple conditionals in a single test.

The usage of nulls & null checking was intentional, null is returned for those sets/lists as an alternative to getting and returning every valid coord. I'll see if I can get this refactored to not need to do that.

@psikomonkie
Copy link
Collaborator Author

this PR uses alot of lists and sets, which is great, but it also uses alot of nulls and null checks, please take a look if you can change some or most of the nulls you are using for empty collections instead, just to reduce the number of situations where we have to check for null, also there is deeply nested code in many places, see if its possible to avoid some of the nesting and aggregate multiple conditionals in a single test.

Removed all of the null lists, reduced conditional nesting, and added a manual stack overflow exception for if a tractor->trailer->tractor situation occurs (which should & is prevented outside of this class). Thanks Luana!

@psikomonkie psikomonkie requested a review from Scoppio February 24, 2025 21:34
@HammerGS HammerGS merged commit 6706585 into MegaMek:master Feb 25, 2025
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.

3 participants