diff options
author | Nicholas Feinberg <pleasingfung@gmail.com> | 2014-07-02 07:54:30 -0700 |
---|---|---|
committer | Nicholas Feinberg <pleasingfung@gmail.com> | 2014-07-02 07:54:30 -0700 |
commit | 981af8bb92e8360cca9ec788720c04f06900da93 (patch) | |
tree | 21daf5473ada8d6eef2249dbafc649e19837fc22 /crawl-ref/source/shopping.cc | |
parent | 886d980933ff95be25921ebadfea48feb1f37d17 (diff) | |
download | crawl-ref-981af8bb92e8360cca9ec788720c04f06900da93.tar.gz crawl-ref-981af8bb92e8360cca9ec788720c04f06900da93.zip |
Move a little more code out of misc.cc
Diffstat (limited to 'crawl-ref/source/shopping.cc')
-rw-r--r-- | crawl-ref/source/shopping.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc index ab116e2009..f43febf9ec 100644 --- a/crawl-ref/source/shopping.cc +++ b/crawl-ref/source/shopping.cc @@ -2871,3 +2871,44 @@ string ShoppingList::item_name_simple(const item_def& item, bool ident) return item.name(DESC_PLAIN, false, ident, false, false, ISFLAG_KNOW_CURSE); } + +static const char *shop_types[] = +{ + "weapon", + "armour", + "antique weapon", + "antique armour", + "antiques", + "jewellery", + "gadget", + "book", + "food", + "distillery", + "scroll", + "general", +}; + +int str_to_shoptype(const string &s) +{ + if (s == "random" || s == "any") + return SHOP_RANDOM; + + for (unsigned i = 0; i < ARRAYSZ(shop_types); ++i) + { + if (s == shop_types[i]) + return i; + } + return -1; +} + +const char *shoptype_to_str(shop_type type) +{ + return shop_types[type]; +} + +void list_shop_types() +{ + mpr_nojoin(MSGCH_PLAIN, "Available shop types: "); + for (unsigned i = 0; i < ARRAYSZ(shop_types); ++i) + mprf_nocap("%s", shop_types[i]); +} |