diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-04-28 13:49:28 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-04-28 13:49:28 +0000 |
commit | 90629939ac4ba4ba84acf7b768c8673d4188c108 (patch) | |
tree | 1c7ff76f2716b6d9ca193dc29f2edc7fc7d388fc /crawl-ref/source/stash.cc | |
parent | 5b1c13035877e9a9fcfad7b322244a309b49f212 (diff) | |
download | crawl-ref-90629939ac4ba4ba84acf7b768c8673d4188c108.tar.gz crawl-ref-90629939ac4ba4ba84acf7b768c8673d4188c108.zip |
Some code review and cleanup.
extern char info[] is almost gone.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1387 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/stash.cc')
-rw-r--r-- | crawl-ref/source/stash.cc | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc index 3d874cd044..4a90487dff 100644 --- a/crawl-ref/source/stash.cc +++ b/crawl-ref/source/stash.cc @@ -31,6 +31,7 @@ #include <cctype> #include <cstdio> #include <fstream> +#include <sstream> #include <algorithm> #define ST_MAJOR_VER ((unsigned char) 4) @@ -1461,26 +1462,13 @@ void StashTracker::display_search_results( for (unsigned i = 0; i < results.size(); ++i, ++hotkey) { stash_search_result &res = results[i]; - char matchtitle[ITEMNAME_SIZE]; - std::string place = short_place_name(res.pos.id); + std::ostringstream matchtitle; + matchtitle << "[" << short_place_name(res.pos.id) << "] " + << res.match; if (res.matches > 1 && res.count > 1) - { - snprintf(matchtitle, sizeof matchtitle, - "[%s] %s (%d)", - place.c_str(), - res.match.c_str(), - res.matches); - } - else - { - snprintf(matchtitle, sizeof matchtitle, - "[%s] %s", - place.c_str(), - res.match.c_str()); - } - std::string mename = matchtitle; - - MenuEntry *me = new MenuEntry(mename, MEL_ITEM, 1, hotkey); + matchtitle << " (" << res.matches << ")"; + + MenuEntry *me = new MenuEntry(matchtitle.str(), MEL_ITEM, 1, hotkey); me->data = &res; if (res.shop && !res.shop->is_visited()) me->colour = CYAN; |