(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,10 +221,20 @@ nstr_comp_val(char *str, struct valstr*val, int type)
|
||||||
sizeof(struct castr));
|
sizeof(struct castr));
|
||||||
if (j >= 0
|
if (j >= 0
|
||||||
&& (!(cap[j].ca_flags & NSC_DEITY) || player->god)) {
|
&& (!(cap[j].ca_flags & NSC_DEITY) || player->god)) {
|
||||||
|
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_type = cap[j].ca_type;
|
||||||
val->val_cat = NSC_OFF;
|
val->val_cat = NSC_OFF;
|
||||||
val->val_as.off = cap[j].ca_off;
|
val->val_as.off = cap[j].ca_off;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
j = M_NOTFOUND;
|
j = M_NOTFOUND;
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue