Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for #4801: NPE while Princess moves BAs
This fixes an issue introduced by my attempt to add Field Gun / Field Artillery expected damage calculations for infantry units under Princess. Unfortunately, I didn't realize that the same code path was used by all non-infantry units when Princess projects how much damage _any_ unit will take; in this case, BA attackers trying to compute expected damage against non-enemy targets. The root of the issue is trying to dereference linked ammo for BA weapons, which don't have that concept in some cases. This throws an NPE, which gets caught, causing a null 'mp' object to be returned, which creates a _new_ NPE. Fix is to clean up that area of code and restrict the special weapon handling to infantry only. All others, including BAs, will go back to the previous method of projecting expected damage. Testing: - Re-ran reporter's attached saved game. - Confirmed the update for field guns / field artillery still works correctly. - Ran all unit tests.
- Loading branch information