]> git.pond.sub.org Git - empserver/commitdiff
(nstr_comp_val): Since rev. 1.10, selectors were always preferred to
authorMarkus Armbruster <armbru@pond.sub.org>
Wed, 4 Aug 2004 14:47:24 +0000 (14:47 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Wed, 4 Aug 2004 14:47:24 +0000 (14:47 +0000)
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.

src/lib/subs/nstr.c

index 501ba28b398b53d838c3a18d60275906785f93d0..5bfaeb335080a23b1d015d7e09f8b2ee30b235d0 100644 (file)
@@ -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;