From d54f454b7fc085b792e569ed131bc7be460768f7 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 25 Jan 2009 14:24:54 +0000 Subject: * Move randart book names into a new file, randbook.txt. * Remove quotes from book names (use the props vector instead for book_has_title()), and occasionally allow random owner names for Sif's gifts (25% chance), as per FR 2532818. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8741 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/spl-book.cc | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'crawl-ref/source/spl-book.cc') diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc index 616a0a0c86..711592b957 100644 --- a/crawl-ref/source/spl-book.cc +++ b/crawl-ref/source/spl-book.cc @@ -1947,8 +1947,7 @@ bool make_book_level_randart(item_def &book, int level, int num_spells) spell_vec[i] = (long) chosen_spells[i]; bool has_owner = true; - std::string name = "\""; - + std::string name = ""; if (god != GOD_NO_GOD) name += apostrophise(god_name(god, false)) + " "; else if (one_chance_in(3)) @@ -1956,6 +1955,9 @@ bool make_book_level_randart(item_def &book, int level, int num_spells) else has_owner = false; + // None of these books need a definite article prepended. + book.props["is_named"].get_bool() = true; + std::string lookup; if (level <= 3) lookup = "easy"; @@ -1980,7 +1982,6 @@ bool make_book_level_randart(item_def &book, int level, int num_spells) bookname = getRandNameString("book"); name += bookname; - name += '"'; set_randart_name(book, name); @@ -2399,21 +2400,24 @@ bool make_book_theme_randart(item_def &book, int disc1, int disc2, std::string name; - bool need_quotes = true; + const bool god_gift = (god != GOD_NO_GOD); + bool has_owner = true; if (!owner.empty()) name = owner; - else if (god != GOD_NO_GOD) + else if (god_gift && !one_chance_in(4)) name = god_name(god, false); - else if (one_chance_in(5)) // Occasionally, use a random name. + else if (god_gift || one_chance_in(5)) // Occasionally, use a random name. name = make_name(random_int(), false); else - need_quotes = false; + has_owner = false; - if (need_quotes) - name = "\"" + apostrophise(name) + " "; + if (has_owner) + { + book.props["is_named"].get_bool() = true; + name = apostrophise(name) + " "; + } - name += getRandNameString("book_noun"); - name += " of "; + name += getRandNameString("book_name") + " "; // For the actual name there's a 50% chance of getting something like // Flames and Displacement (Fire/Translocation), else @@ -2465,9 +2469,6 @@ bool make_book_theme_randart(item_def &book, int disc1, int disc2, name += bookname; } - if (need_quotes) - name += '"'; - set_randart_name(book, name); book.plus = disc1; @@ -2492,5 +2493,6 @@ bool book_has_title(const item_def &book) if (!is_artefact(book)) return (false); - return (get_artefact_name(book)[0] == '"'); + return (book.props.exists("is_named") + && book.props["is_named"].get_bool() == true); } -- cgit v1.2.3-54-g00ecf