found_artifact() groundwork
Lay groundwork for generating a log event when finding an artifact on the floor or carried by a monster. This part should not produce any change in behavior. Move g.artidisco[] and g.artiexist[] out of the instance_globals struct back to local within artifact.c. They are both initialized at the start of a game (and only used in that file) so don't need to be part of any bulk reinitialization if restart-instead-of-exit ever gets implemented. Convert artiexist[] from an array of booleans to an array of structs containing a pair of bitfields. artiexist[].exists is a direct replacement for the boolean; artiexist[].found is new but not put to any significant use yet. If will be used to suppress the future found-an-artifact event for cases where a more specific event (like crowning or divine gift as #offer reward) is already produced. Remove g.via_naming altogether and add an extra argument to oname() calls to replace it. Add an extra argument to artifact_exists() calls.
This commit is contained in:
@@ -421,7 +421,6 @@ struct plinemsg_type {
|
||||
/* bitmask for callers of hide_unhide_msgtypes() */
|
||||
#define MSGTYP_MASK_REP_SHOW ((1 << MSGTYP_NOREP) | (1 << MSGTYP_NOSHOW))
|
||||
|
||||
|
||||
enum bcargs {override_restriction = -1};
|
||||
struct breadcrumbs {
|
||||
const char *funcnm;
|
||||
@@ -701,10 +700,6 @@ struct instance_globals {
|
||||
/* artifcat.c */
|
||||
int spec_dbon_applies; /* coordinate effects from spec_dbon() with
|
||||
messages in artifact_hit() */
|
||||
/* flags including which artifacts have already been created */
|
||||
boolean artiexist[1 + NROFARTIFACTS + 1];
|
||||
/* and a discovery list for them (no dummy first entry here) */
|
||||
xchar artidisco[NROFARTIFACTS];
|
||||
int mkot_trap_warn_count;
|
||||
|
||||
/* botl.c */
|
||||
@@ -864,7 +859,6 @@ struct instance_globals {
|
||||
/* do_name.c */
|
||||
struct selectionvar *gloc_filter_map;
|
||||
int gloc_filter_floodfill_match_glyph;
|
||||
int via_naming;
|
||||
|
||||
/* do_wear.c */
|
||||
/* starting equipment gets auto-worn at beginning of new game,
|
||||
|
||||
@@ -69,7 +69,9 @@ extern const char *artiname(int);
|
||||
extern struct obj *mk_artifact(struct obj *, aligntyp);
|
||||
extern const char *artifact_name(const char *, short *);
|
||||
extern boolean exist_artifact(int, const char *);
|
||||
extern void artifact_exists(struct obj *, const char *, boolean);
|
||||
extern void artifact_exists(struct obj *, const char *, boolean, boolean);
|
||||
extern void found_artifact(int);
|
||||
extern void find_artifact(struct obj *);
|
||||
extern int nartifact_exist(void);
|
||||
extern boolean arti_immune(struct obj *, int);
|
||||
extern boolean spec_ability(struct obj *, unsigned long);
|
||||
@@ -470,7 +472,7 @@ extern void new_oname(struct obj *, int);
|
||||
extern void free_oname(struct obj *);
|
||||
extern const char *safe_oname(struct obj *);
|
||||
extern struct monst *christen_monst(struct monst *, const char *);
|
||||
extern struct obj *oname(struct obj *, const char *);
|
||||
extern struct obj *oname(struct obj *, const char *, unsigned);
|
||||
extern boolean objtyp_is_callable(int);
|
||||
extern int docallcmd(void);
|
||||
extern void docall(struct obj *);
|
||||
|
||||
@@ -371,6 +371,11 @@ typedef struct sortloot_item Loot;
|
||||
#define BUCX_TYPES (BUC_ALLBKNOWN | BUC_UNKNOWN)
|
||||
#define ALL_TYPES_SELECTED -2
|
||||
|
||||
/* Flags for oname() */
|
||||
#define ONAME_NO_FLAGS 0U /* none of the below */
|
||||
#define ONAME_VIA_NAMING 1U /* oname() is being called by do_oname() */
|
||||
#define ONAME_FOUND_ARTI 2U /* if an artifact, hero becomes aware of it */
|
||||
|
||||
/* Flags to control find_mid() */
|
||||
#define FM_FMON 0x01 /* search the fmon chain */
|
||||
#define FM_MIGRATE 0x02 /* search the migrating monster chain */
|
||||
|
||||
Reference in New Issue
Block a user