Rearm - Fix some magazine types duplicating during rearm #7760
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When merged this pull request will:
Some vehicles (issue discovered with the RHS's Bradley Busk III) report no compatible magazines when running CBA_fnc_compatibleMagazines without the allMuzzles parameter. This leads to the magazine type which will be added by the rearm action not getting removed before hand. Due to the code's assumption that all magazines have been removed, this leads to the filled magazines being added on top of the old (still loaded) magazines. Due to the old magazines still not being full the rearm option remains leading players to continuously duplicate the magazine count which for us has lead to server performance issues.
As the stated goal of the code is to find all allowed magazine classes in the weapon, it is expected that getting the magazines for all weapons should not lead to any issues other than a potential increased performance load for the specific setTurretMagazineAmmo function. All additional found magazine types due to this change should simply be removed and re-added as the comments state is intended by this function.