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:
@@ -440,8 +440,7 @@ doread(void)
|
||||
|
||||
/* yet another note: despite the fact that player will recognize
|
||||
the object type, don't make it become a discovery for hero */
|
||||
if (!objects[otyp].oc_name_known && !objects[otyp].oc_uname)
|
||||
docall(scroll);
|
||||
trycall(scroll);
|
||||
return ECMD_TIME;
|
||||
} else if (otyp == CREDIT_CARD) {
|
||||
static const char *const card_msgs[] = {
|
||||
@@ -631,8 +630,8 @@ doread(void)
|
||||
if (!objects[otyp].oc_name_known) {
|
||||
if (g.known)
|
||||
learnscroll(scroll);
|
||||
else if (!objects[otyp].oc_uname)
|
||||
docall(scroll);
|
||||
else
|
||||
trycall(scroll);
|
||||
}
|
||||
scroll->in_use = FALSE;
|
||||
if (otyp != SCR_BLANK_PAPER)
|
||||
|
||||
Reference in New Issue
Block a user