diff --git a/src/objnam.c b/src/objnam.c index 617bc1f7a..b2422de54 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -3306,6 +3306,7 @@ static const struct alt_spellings { { "grapnel", GRAPPLING_HOOK }, { "grapple", GRAPPLING_HOOK }, { "protection from shape shifters", RIN_PROTECTION_FROM_SHAPE_CHAN }, + { "accuracy", RIN_INCREASE_ACCURACY }, /* if we ever add other sizes, move this to o_ranges[] with "bag" */ { "box", LARGE_BOX }, /* normally we wouldn't have to worry about unnecessary , but @@ -4746,6 +4747,21 @@ readobjnam_postparse3(struct _readobjnam_data *d) } } + /* got a class, but not specific type; + check alternate spellings of items with matching classes */ + if (d->oclass && !d->typ) { + const struct alt_spellings *as = spellings; + + while (as->sp) { + if (objects[as->ob].oc_class == d->oclass + && wishymatch(d->bp, as->sp, TRUE)) { + d->typ = as->ob; + return 2; /*goto typfnd;*/ + } + as++; + } + } + return 0; } diff --git a/test/testwish.lua b/test/testwish.lua index 2fe5d869b..3220ef9ed 100644 --- a/test/testwish.lua +++ b/test/testwish.lua @@ -60,6 +60,9 @@ local wishtest_objects = { ["blessed fireproof +2 pair of speed boots"] = { otyp_name = "speed boots", oclass = "[", oerodeproof = 1, blessed = 1, spe = 2 }, ["tooled horn"] = { otyp_name = "tooled horn", oclass = "(" }, ["meat ring"] = { otyp_name = "meat ring", oclass = "%" }, + ["cursed +3 ring of increase accuracy"] = { otyp_name = "increase accuracy", oclass = "=", spe = 3, cursed = 1 }, + ["ring of accuracy"] = { otyp_name = "increase accuracy", oclass = "=", spe = 5 }, + ["accuracy"] = { otyp_name = "increase accuracy", oclass = "=" }, ["beartrap"] = { otyp_name = "beartrap", oclass = "(" }, ["bear trap"] = { otyp_name = "beartrap", oclass = "(" }, ["landmine"] = { otyp_name = "land mine", oclass = "(" }, @@ -94,3 +97,4 @@ for str, tbl in pairs(wishtest_objects) do end end end +pline("testwish: OK");