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:
@@ -4787,7 +4787,7 @@ readobjnam(char *bp, struct obj *no_wish)
|
||||
d.name = novelname;
|
||||
}
|
||||
|
||||
d.otmp = oname(d.otmp, d.name);
|
||||
d.otmp = oname(d.otmp, d.name, ONAME_NO_FLAGS);
|
||||
/* name==aname => wished for artifact (otmp->oartifact => got it) */
|
||||
if (d.otmp->oartifact || d.name == aname) {
|
||||
d.otmp->quan = 1L;
|
||||
@@ -4799,7 +4799,7 @@ readobjnam(char *bp, struct obj *no_wish)
|
||||
/* and make them pay; charge them for the wish anyway! */
|
||||
if ((is_quest_artifact(d.otmp)
|
||||
|| (d.otmp->oartifact && rn2(nartifact_exist()) > 1)) && !wizard) {
|
||||
artifact_exists(d.otmp, safe_oname(d.otmp), FALSE);
|
||||
artifact_exists(d.otmp, safe_oname(d.otmp), FALSE, FALSE);
|
||||
obfree(d.otmp, (struct obj *) 0);
|
||||
d.otmp = (struct obj *) &cg.zeroobj;
|
||||
pline("For a moment, you feel %s in your %s, but it disappears!",
|
||||
|
||||
Reference in New Issue
Block a user