(nstr_comp_val): Since rev. 1.10, selectors were always preferred to
type literals, unless type inference rejects the selector. This doesn't work for NSC_TYPE selectors: `?des=n' is interpreted as `?des=newdes'. Prefer type literal to NSC_TYPE selector. Closes #982021.
This commit is contained in:
parent
153595a253
commit
c8afd40eb8
1 changed files with 13 additions and 3 deletions
|
@ -221,9 +221,19 @@ nstr_comp_val(char *str, struct valstr*val, int type)
|
|||
sizeof(struct castr));
|
||||
if (j >= 0
|
||||
&& (!(cap[j].ca_flags & NSC_DEITY) || player->god)) {
|
||||
val->val_type = cap[j].ca_type;
|
||||
val->val_cat = NSC_OFF;
|
||||
val->val_as.off = cap[j].ca_off;
|
||||
if (cap[j].ca_type == NSC_TYPEID && val->val_as_type >= 0)
|
||||
/*
|
||||
* Got two matches of type NSC_TYPEID, need to
|
||||
* choose. Prefer typematch(), because ?des=n
|
||||
* would be interpreted as ?des=newdes
|
||||
* otherwise
|
||||
*/
|
||||
;
|
||||
else {
|
||||
val->val_type = cap[j].ca_type;
|
||||
val->val_cat = NSC_OFF;
|
||||
val->val_as.off = cap[j].ca_off;
|
||||
}
|
||||
}
|
||||
} else
|
||||
j = M_NOTFOUND;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue