Externify trycall() and replace many docall() calls with it
trycall() is a short docall() wrapper that is a no-op if the item is already identified or the player has called the object type already. For some reason, many calls to docall() did those same exact checks beforehand. This commit eliminates that redundancy by converting those calls into trycall(), which is now made extern rather than local to do.c. No behavior should be changed by this commit; I've checked that none of the affected places could take a different code path now that the oc_name_known and oc_uname checks are removed.
This commit is contained in:
+1
-3
@@ -1666,9 +1666,7 @@ pickup_object(struct obj *obj, long count,
|
||||
pline_The("scroll%s %s to dust as you %s %s up.", plur(obj->quan),
|
||||
otense(obj, "turn"), telekinesis ? "raise" : "pick",
|
||||
(obj->quan == 1L) ? "it" : "them");
|
||||
if (!objects[SCR_SCARE_MONSTER].oc_name_known
|
||||
&& !objects[SCR_SCARE_MONSTER].oc_uname)
|
||||
docall(obj);
|
||||
trycall(obj);
|
||||
useupf(obj, obj->quan);
|
||||
return 1; /* tried to pick something up and failed, but
|
||||
don't want to terminate pickup loop yet */
|
||||
|
||||
Reference in New Issue
Block a user