From 8ee15e29f95da59fa00c59e22db79a4e104794f4 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Wed, 11 Jul 2007 09:56:56 +0000 Subject: [1737348] Allow stash.lua to annotate item names for autopickup so autopickup can use matches like s", item, &ann); + if (!clua.callfn(s, "u>s", item, &ann)) + mprf(MSGCH_WARN, "Lua error: %s", clua.error.c_str()); if (exclusive) lua_set_exclusive_item(NULL); return (ann); - #else return (""); #endif @@ -72,11 +68,11 @@ std::string stash_annotate_item(const char *s, bool exclusive = false) { std::string text = userdef_annotate_item(s, item, exclusive); - if ( (item->base_type == OBJ_BOOKS && - item_type_known(*item) && - item->sub_type != BOOK_MANUAL && - item->sub_type != BOOK_DESTRUCTION) - || count_staff_spells(*item, true) > 1 ) + if ((item->base_type == OBJ_BOOKS + && item_type_known(*item) + && item->sub_type != BOOK_MANUAL + && item->sub_type != BOOK_DESTRUCTION) + || count_staff_spells(*item, true) > 1) { formatted_string fs; item_def dup = *item; @@ -510,7 +506,7 @@ bool Stash::matches_search(const std::string &prefix, const item_def &item = items[i]; std::string s = stash_item_name(item); std::string ann = stash_annotate_item( - LUA_SEARCH_ANNOTATE, &item); + STASH_LUA_SEARCH_ANNOTATE, &item); if (search.matches(prefix + " " + ann + s)) { if (!res.count++) @@ -578,7 +574,7 @@ void Stash::write(std::ostream &os, strncpy(buf, s.c_str(), sizeof buf); std::string ann = userdef_annotate_item( - LUA_DUMP_ANNOTATE, &item); + STASH_LUA_DUMP_ANNOTATE, &item); if (!ann.empty()) { @@ -823,7 +819,7 @@ bool ShopInfo::matches_search(const std::string &prefix, { std::string sname = shop_item_name(items[i]); std::string ann = stash_annotate_item( - LUA_SEARCH_ANNOTATE, &items[i].item, true); + STASH_LUA_SEARCH_ANNOTATE, &items[i].item, true); bool thismatch = false; if (search.matches(prefix + " " + ann + sname)) -- cgit v1.2.3-54-g00ecf