Merge fire-based erosion to common codepaths.
This finally eliminates all direct increases of `oeroded` and `oeroded2` and moves them all to go via `erode_obj()`. They are still manipulated directly in a few places, but not to erode objects. This now merges the `fire_damage()` function to a common codepath, used for items on lava and burning oil, but fire needs more work. There is still a duplication between `destroy_item()` and `fire_damage()`; the two codepaths should eventually be merged in some manner so that there is only one codepath to say "an object was affected by fire". This path might require some parameters, such as whether the fire will just erode objects or burn them outright, but that can happen another day.
This commit is contained in:
@@ -2202,7 +2202,7 @@ E coord *FDECL(gettrack, (int,int));
|
||||
/* ### trap.c ### */
|
||||
|
||||
E boolean FDECL(burnarmor,(struct monst *));
|
||||
E boolean FDECL(erode_obj, (struct obj *,const char *,int,BOOLEAN_P,BOOLEAN_P));
|
||||
E int FDECL(erode_obj, (struct obj *,const char *,int,int));
|
||||
E boolean FDECL(grease_protect, (struct obj *,const char *,struct monst *));
|
||||
E struct trap *FDECL(maketrap, (int,int,int));
|
||||
E void FDECL(fall_through, (BOOLEAN_P));
|
||||
@@ -2221,7 +2221,8 @@ E void NDECL(float_up);
|
||||
E void FDECL(fill_pit, (int,int));
|
||||
E int FDECL(float_down, (long, long));
|
||||
E void NDECL(climb_pit);
|
||||
E int FDECL(fire_damage, (struct obj *,BOOLEAN_P,BOOLEAN_P,XCHAR_P,XCHAR_P));
|
||||
E boolean FDECL(fire_damage, (struct obj *,BOOLEAN_P,XCHAR_P,XCHAR_P));
|
||||
E int FDECL(fire_damage_chain, (struct obj *,BOOLEAN_P,BOOLEAN_P,XCHAR_P,XCHAR_P));
|
||||
E void acid_damage(struct obj *);
|
||||
E int FDECL(water_damage, (struct obj *,const char*,BOOLEAN_P));
|
||||
E void FDECL(water_damage_chain, (struct obj *,BOOLEAN_P));
|
||||
|
||||
@@ -99,6 +99,9 @@
|
||||
#define COST_BITE 13 /* start eating food */
|
||||
#define COST_OPEN 14 /* open tin */
|
||||
#define COST_BRKLCK 15 /* break box/chest's lock */
|
||||
#define COST_RUST 16 /* rust damage */
|
||||
#define COST_ROT 17 /* rotting attack */
|
||||
#define COST_CORRODE 18 /* acid damage */
|
||||
|
||||
/* bitmask flags for corpse_xname();
|
||||
PFX_THE takes precedence over ARTICLE, NO_PFX takes precedence over both */
|
||||
|
||||
@@ -325,6 +325,19 @@ struct obj {
|
||||
#define ERODE_ROT 2
|
||||
#define ERODE_CORRODE 3
|
||||
|
||||
/* erosion flags for erode_obj() */
|
||||
#define EF_NONE 0
|
||||
#define EF_GREASE 0x1 /* check for a greased object */
|
||||
#define EF_DESTROY 0x2 /* potentially destroy the object */
|
||||
#define EF_VERBOSE 0x4 /* print extra messages */
|
||||
#define EF_PAY 0x8 /* it's the player's fault */
|
||||
|
||||
/* erosion return values for erode_obj(), water_damage() */
|
||||
#define ER_NOTHING 0 /* nothing happened */
|
||||
#define ER_GREASED 1 /* protected by grease */
|
||||
#define ER_DAMAGED 2 /* object was damaged in some way */
|
||||
#define ER_DESTROYED 3 /* object was destroyed */
|
||||
|
||||
/*
|
||||
* Notes for adding new oextra structures:
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user