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

Skip to content

Conversation

@WeaverThree
Copy link
Collaborator

@WeaverThree WeaverThree commented Oct 11, 2024

The random camouflage picker was sometimes picking directories instead of files to use as camo for a group in a generated contract. It also wasn't going into all of the subdirectories, only the first level under the faction, so some files were getting left out. This fixes both of those problems.

It seems like Camoflauge or AbstractIcon should have some verification that the files you pass them exist, but...

@IllianiBird
Copy link
Collaborator

On my mobile so can’t review, but thank you for fixing this

if (!allFiles.isEmpty()) {
File randomFile = allFiles.get(new Random().nextInt(allFiles.size()));
if ((null != allPaths) && (!allPaths.isEmpty())) {
Path randomPath = allPaths.get(new Random().nextInt(allPaths.size()));

Check warning

Code scanning / CodeQL

Random used only once Warning

Random object created and used only once.
@codecov-commenter
Copy link

codecov-commenter commented Oct 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.43%. Comparing base (fb4b93d) to head (033068c).
Report is 48 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5035      +/-   ##
============================================
- Coverage     10.44%   10.43%   -0.02%     
- Complexity     6015     6018       +3     
============================================
  Files           950      952       +2     
  Lines        133511   133807     +296     
  Branches      19400    19428      +28     
============================================
+ Hits          13948    13958      +10     
- Misses       118217   118503     +286     
  Partials       1346     1346              

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

@IllianiBird IllianiBird merged commit 5a3f85e into MegaMek:master Oct 12, 2024
4 checks passed
@WeaverThree WeaverThree deleted the wvr-5028-random-camo-fix branch October 16, 2024 17:24
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