Fix #8848: Fix Large Vessel Temp Crew Issues#9088
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9088 +/- ##
============================================
+ Coverage 15.21% 15.23% +0.01%
- Complexity 9296 9305 +9
============================================
Files 1304 1304
Lines 172561 172518 -43
Branches 26080 26063 -17
============================================
+ Hits 26254 26277 +23
+ Misses 143260 143198 -62
+ Partials 3047 3043 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
IllianiBird
left a comment
There was a problem hiding this comment.
Couple of questions before I merge this
| VESSEL_PILOT -> unit.getDriverRole() == role; | ||
| case VESSEL_GUNNER -> unit.getGunnerRole() == role; | ||
| case VESSEL_CREW -> unit.canTakeMoreVesselCrew(); | ||
| case VESSEL_CREW -> (unit.getEntity() instanceof Aero aero && !(aero instanceof ConvFighter)) |
There was a problem hiding this comment.
I was going to say there was a potential NPE here, but remembered that instanceof includes null protection. Man, that tiny piece of QoL makes me so happy.
| * | ||
| * @return available slots (negative = surplus temp crew) | ||
| */ | ||
| private int getRoleSpecificNeeds(Unit unit, PersonnelRole role) { |
There was a problem hiding this comment.
I'm not seeing Navigator, and I believe JumpShips and WarShips both count as Aero (could be wrong)
There was a problem hiding this comment.
There are no temp navigators.
There was a problem hiding this comment.
That's all I needed to hear :)
| doReturn(new HashSet<>(activeCrew)).when(unit).getGunners(); | ||
| doReturn(crewSize).when(unit).getTotalGunnerNeeds(); | ||
| } | ||
| case VESSEL_CREW -> { |
There was a problem hiding this comment.
If you do need add a case for navigator elsewhere, might be worth adding a cheeky addition to your test here
Fixes #8848
Temp Crew is now more role-aware when determining how many more crew members a unit needs to ensure it is filled with the correct temp crew and not just pilots.
Also consolidates some code from Campaign to use HumanResources instead.