From b92e79306fcaad443184d8526197272f26e091a8 Mon Sep 17 00:00:00 2001 From: haranp Date: Mon, 23 Apr 2007 11:36:32 +0000 Subject: Implemented 1616309 etc: racial modifiers are now described in 'v'. Fixed a bug in print_description(). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1351 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/describe.cc | 70 ++++++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 25 deletions(-) (limited to 'crawl-ref/source/describe.cc') diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 7bff89c355..998da3b72b 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -88,8 +88,6 @@ static void print_description( const std::string &d ) const unsigned int lineWidth = 70; - bool nlSearch = true; // efficiency - textcolor(LIGHTGREY); while(currentPos < d.length()) @@ -98,31 +96,25 @@ static void print_description( const std::string &d ) gotoxy(1, wherey() + 1); // see if $ sign is within one lineWidth - if (nlSearch) - { - nextLine = d.find('$', currentPos); - - if (nextLine >= currentPos && nextLine < currentPos + lineWidth) - { - cprintf("%s", - (d.substr(currentPos, nextLine - currentPos)).c_str()); - currentPos = nextLine + 1; - continue; - } + nextLine = d.find('$', currentPos); - // Handle real line breaks. No substitutions necessary, just update - // the counts. - nextLine = d.find('\n', currentPos); - if (nextLine >= currentPos && nextLine < currentPos + lineWidth) { - cprintf("%s", (d.substr(currentPos, nextLine - currentPos)).c_str()); - currentPos = nextLine +1; - continue; - } - - if (nextLine == std::string::npos) - nlSearch = false; // there are no newlines, don't search again. + if (nextLine >= currentPos && nextLine < currentPos + lineWidth) + { + cprintf("%s", (d.substr(currentPos, nextLine-currentPos)).c_str()); + currentPos = nextLine + 1; + continue; } - + + // Handle real line breaks. No substitutions necessary, just update + // the counts. + nextLine = d.find('\n', currentPos); + if (nextLine >= currentPos && nextLine < currentPos + lineWidth) + { + cprintf("%s", (d.substr(currentPos, nextLine-currentPos)).c_str()); + currentPos = nextLine +1; + continue; + } + // no newline -- see if rest of string will fit. if (currentPos + lineWidth >= d.length()) { @@ -1254,6 +1246,13 @@ static std::string describe_weapon( const item_def &item, bool verbose) { case ISFLAG_DWARVEN: description += "$It is well-crafted and very durable."; + description += "$Dwarves are more deadly with it."; + break; + case ISFLAG_ELVEN: + description += "$Elves are more accurate with it."; + break; + case ISFLAG_ORCISH: + description += "$Orcs are more deadly with it."; break; } @@ -1372,6 +1371,22 @@ static std::string describe_ammo( const item_def &item ) break; } + switch ( get_equip_race(item) ) + { + case ISFLAG_DWARVEN: + description += + "$It is more effective in conjunction with dwarven launchers."; + break; + case ISFLAG_ELVEN: + description += + "$It is more effective in conjunction with elven launchers."; + break; + case ISFLAG_ORCISH: + description += + "$It is more effective in conjunction with orcish launchers."; + break; + } + if (item.special != 0 && item_type_known(item)) { switch (item.special) @@ -1747,13 +1762,18 @@ static std::string describe_armour( const item_def &item, bool verbose ) description += ", and helps its wearer avoid being noticed"; description += "."; + description += "$It fits elves well."; break; case ISFLAG_DWARVEN: description += "$It is well-crafted and very durable."; + description += "$It fits dwarves well."; break; case ISFLAG_ORCISH: + description += "$It fits orcs well."; + break; + default: break; } -- cgit v1.2.3-54-g00ecf