MCPcopy Create free account
hub / github.com/NetHack/NetHack / find_quest_artifact

Function find_quest_artifact

src/questpgr.c:88–120  ·  view source on GitHub ↗

check several object chains for the quest artifact to determine whether it is present on the current level */

Source from the content-addressed store, hash-verified

86/* check several object chains for the quest artifact to determine
87 whether it is present on the current level */
88struct obj *
89find_quest_artifact(unsigned whichchains)
90{
91 struct monst *mtmp;
92 struct obj *qarti = 0;
93
94 if ((whichchains & (1 << OBJ_INVENT)) != 0)
95 qarti = find_qarti(gi.invent);
96 if (!qarti && (whichchains & (1 << OBJ_FLOOR)) != 0)
97 qarti = find_qarti(fobj);
98 if (!qarti && (whichchains & (1 << OBJ_MINVENT)) != 0)
99 for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
100 if (DEADMONSTER(mtmp))
101 continue;
102 if ((qarti = find_qarti(mtmp->minvent)) != 0)
103 break;
104 }
105 if (!qarti && (whichchains & (1 << OBJ_MIGRATING)) != 0) {
106 /* check migrating objects and minvent of migrating monsters */
107 for (mtmp = gm.migrating_mons; mtmp; mtmp = mtmp->nmon) {
108 if (DEADMONSTER(mtmp))
109 continue;
110 if ((qarti = find_qarti(mtmp->minvent)) != 0)
111 break;
112 }
113 if (!qarti)
114 qarti = find_qarti(gm.migrating_objs);
115 }
116 if (!qarti && (whichchains & (1 << OBJ_BURIED)) != 0)
117 qarti = find_qarti(svl.level.buriedobjlist);
118
119 return qarti;
120}
121
122/* return your role nemesis' name */
123staticfn const char *

Callers 1

on_goalFunction · 0.85

Calls 1

find_qartiFunction · 0.85

Tested by

no test coverage detected