Reduce code duplication in extrinsics-protect-items code

The same checks were being repeated for every damage type; this
sends them through two centralised functions (one for checking
whether an extrinsic blocks a specific instance of item destruction
and one for the enlightenment message), so that new mechanisms of
item destruction prevention will need to change only one point in
the code.
This commit is contained in:
Alex Smith
2023-12-05 04:34:24 +00:00
parent 2d8ba944e1
commit 7ca9951996
5 changed files with 55 additions and 29 deletions

View File

@@ -3582,7 +3582,8 @@ extern void melt_ice_away(union any *, long);
extern int zap_over_floor(coordxy, coordxy, int, boolean *, boolean, short);
extern void fracture_rock(struct obj *);
extern boolean break_statue(struct obj *);
extern boolean u_adtyp_resistance_obj(int);
extern int u_adtyp_resistance_obj(int);
extern boolean inventory_resistance_check(int);
extern char *item_what(int);
extern void destroy_item(int, int);
extern int destroy_mitem(struct monst *, int, int);