Commit 168b331
authored
Cleanup of Shield Hitpoint Threshold (#6851)
* Cleanup of Shield Hitpoint Threshold
Overall cleanup that does a few things:
1) Changes `ship_is_shield_up` from integer to bool.
2) `ship_is_shield_up` was only ever called to look at one quadrant, never for all quadrants, so took the opportunity to update the 'all-quadrant' block to account for ships with a non-standard number of shield quadrants.
3) ` MAX(2.0f, Shield_percent_skips_damage * shield_get_max_quad(ship_objp)` was used many times throughout the code (and will be used at least 2 more times with #6848), so simply consolidated all of those uses into a new function called `ship_shield_hitpoint_threshold`. Happy to edit the name however.
4) Removed un-needed redundant comments from `ship_is_shield_up` definition in `ship.h` since those comments were already present in the actual function within `shield.cpp`, and all the other functions used comments in that file instead.
Again happy to tune or edit with any other choices.
* use proper default arg style
* actually commit the updated files
* appease modern clang
* clang round 21 parent 365d9c5 commit 168b331
3 files changed
Lines changed: 28 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
903 | 903 | | |
904 | 904 | | |
905 | 905 | | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
906 | 923 | | |
907 | 924 | | |
908 | 925 | | |
909 | 926 | | |
910 | 927 | | |
911 | | - | |
| 928 | + | |
912 | 929 | | |
913 | 930 | | |
914 | 931 | | |
915 | | - | |
916 | | - | |
917 | | - | |
| 932 | + | |
918 | 933 | | |
919 | 934 | | |
920 | | - | |
921 | | - | |
922 | | - | |
923 | | - | |
924 | | - | |
| 935 | + | |
925 | 936 | | |
926 | | - | |
927 | 937 | | |
928 | 938 | | |
929 | 939 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1771 | 1771 | | |
1772 | 1772 | | |
1773 | 1773 | | |
1774 | | - | |
1775 | | - | |
1776 | | - | |
1777 | | - | |
1778 | | - | |
| 1774 | + | |
| 1775 | + | |
1779 | 1776 | | |
1780 | 1777 | | |
1781 | 1778 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2425 | 2425 | | |
2426 | 2426 | | |
2427 | 2427 | | |
2428 | | - | |
2429 | | - | |
| 2428 | + | |
| 2429 | + | |
2430 | 2430 | | |
2431 | 2431 | | |
2432 | 2432 | | |
| |||
2458 | 2458 | | |
2459 | 2459 | | |
2460 | 2460 | | |
2461 | | - | |
2462 | | - | |
| 2461 | + | |
| 2462 | + | |
2463 | 2463 | | |
2464 | 2464 | | |
2465 | 2465 | | |
| |||
2882 | 2882 | | |
2883 | 2883 | | |
2884 | 2884 | | |
2885 | | - | |
2886 | | - | |
| 2885 | + | |
| 2886 | + | |
2887 | 2887 | | |
2888 | 2888 | | |
2889 | 2889 | | |
| |||
0 commit comments