summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-23 21:08:10 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-23 21:08:10 +0000
commit2bcedfdf3c59078e54d15d03b3a9473ed4bdd44b (patch)
treeba54660d8b3ecaa06b113aa13c9f4c104a9d0fd1 /crawl-ref
parentc38a52f9377b9f87e66cdccfeab2abbaa72faad8 (diff)
downloadcrawl-ref-2bcedfdf3c59078e54d15d03b3a9473ed4bdd44b.tar.gz
crawl-ref-2bcedfdf3c59078e54d15d03b3a9473ed4bdd44b.zip
* Allow viewing of card descriptions from Triple Draw and Stack Deck.
* Sort items in 'V' screen according to pickup menu sort order. * Name Xom's randart book gifts more randomly. * Colour items seen by 'x' with message colour tags and same for pickup messages. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9541 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/settings/init.txt3
-rw-r--r--crawl-ref/source/abl-show.cc2
-rw-r--r--crawl-ref/source/command.cc5
-rw-r--r--crawl-ref/source/dat/database/randbook.txt32
-rw-r--r--crawl-ref/source/dat/descript/cards.txt110
-rw-r--r--crawl-ref/source/debug.cc2
-rw-r--r--crawl-ref/source/decks.cc80
-rw-r--r--crawl-ref/source/describe.cc46
-rw-r--r--crawl-ref/source/directn.cc45
-rw-r--r--crawl-ref/source/invent.cc6
-rw-r--r--crawl-ref/source/invent.h6
-rw-r--r--crawl-ref/source/itemname.cc8
-rw-r--r--crawl-ref/source/items.cc18
-rw-r--r--crawl-ref/source/menu.cc6
-rw-r--r--crawl-ref/source/spl-book.cc115
-rw-r--r--crawl-ref/source/tilesdl.cc4
-rw-r--r--crawl-ref/source/travel.cc2
-rw-r--r--crawl-ref/source/view.cc15
-rw-r--r--crawl-ref/source/view.h2
19 files changed, 321 insertions, 186 deletions
diff --git a/crawl-ref/settings/init.txt b/crawl-ref/settings/init.txt
index b31e0a30aa..02737c06dc 100644
--- a/crawl-ref/settings/init.txt
+++ b/crawl-ref/settings/init.txt
@@ -228,8 +228,7 @@ stash_filter = ring of hunger, amulet of inaccuracy
# easy_quit_item_prompts = false
# easy_exit_menu = false
# msg_condense_repeats = false
-# sort_menus = pickup: true : basename, qualname, curse, qty
-
+# sort_menus = pickup: true : art, ego, basename, qualname, curse, qty
sort_menus = inv: true : equipped, freshness
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index dd74d1c66e..ec8109285e 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -334,7 +334,7 @@ std::string print_abilities()
const std::vector<talent> talents = your_talents(false);
- if ( talents.empty() )
+ if (talents.empty())
text += "no special abilities";
else
{
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 3b090e6646..69bb351ef6 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -1113,6 +1113,11 @@ static bool _card_filter(std::string key, std::string body)
{
key = lowercase_string(key);
std::string name;
+
+ // Every card description contains the keyword "card".
+ if (key.find("card") != std::string::npos)
+ return (false);
+
for (int i = 0; i < NUM_CARDS; ++i)
{
name = lowercase_string(card_name((card_type) i));
diff --git a/crawl-ref/source/dat/database/randbook.txt b/crawl-ref/source/dat/database/randbook.txt
index 80de91d40f..603c144c3c 100644
--- a/crawl-ref/source/dat/database/randbook.txt
+++ b/crawl-ref/source/dat/database/randbook.txt
@@ -144,6 +144,38 @@ w:6
@armour_animal@
%%%%
+Xom_book_title
+
+w:30
+@random_book_title@
+
+# increased chances (obviously!)
+@chaos_name@
+
+w:1
+@game_name@
+
+w:2
+@player_death@
+
+w:8
+@wacky_armour_name@
+
+w:1
+@politics_name_armour@
+
+w:5
+@power_name@
+
+w:3
+@discomfort_and_inaction@
+
+w:3
+@discomfort_weapon@
+
+w:3
+@mental_illness_weapon@
+%%%%
book_adjective
glistering
diff --git a/crawl-ref/source/dat/descript/cards.txt b/crawl-ref/source/dat/descript/cards.txt
index 0130ebfd58..fb23071241 100644
--- a/crawl-ref/source/dat/descript/cards.txt
+++ b/crawl-ref/source/dat/descript/cards.txt
@@ -1,284 +1,284 @@
%%%%
# decks of transport -> escape
-the Portal
+the Portal card
This card teleports you to a random location. At higher power levels this may be instantaneous, controlled or both.
It is usually found in decks of escape and war, or in Nemelex's deck of punishment.
%%%%
-the Warp
+the Warp card
This card translocates you a short distance, either randomly or with increasing levels of control at higher power levels.
It is usually found in decks of escape and war.
%%%%
-Swap
+Swap card
This card swaps your position with that of a nearby monster.
It is usually found in decks of escape and war.
%%%%
-Velocity
+Velocity card
This card makes you move or even act faster.
It is usually found in decks of escape and war.
%%%%
# decks of emergency -> escape
-the Tomb
+the Tomb card
This card entombs the player in protective walls of solid rock. At lower power levels, the tomb may be imperfect. Use with caution!
It is usually found in decks of defence, escape and war, or in Nemelex's deck of punishment.
%%%%
-the Banshee
+the Banshee card
The wail of the Banshee instils fear in nearby creatures.
It is usually found in decks of defence, escape and war.
%%%%
-Damnation
+Damnation card
This card banishes one or more nearby creatures to the Abyss, possibly including you.
It is usually found in decks of defence, escape and war, or in Nemelex's deck of punishment.
%%%%
-Solitude
+Solitude card
This card randomly teleports creatures adjacent to you.
It is usually found in decks of defence, escape and war.
%%%%
-Warpwright
+Warpwright card
This card may create teleporters.
It is usually found in decks of defence, escape and war.
%%%%
-Flight
+Flight card
This card helps you run away by transforming you, speeding you up or creating other avenues of escape.
It is usually found in decks of defence, escape and war.
%%%%
# deck of battle -> changes, defence, war
-the Elixir
+the Elixir card
This card heals you and may also drain or restore your magical energy in the process.
It is usually found in decks of changes, defence and war.
%%%%
-Battlelust
+Battlelust card
This card makes your more powerful in physical combat.
It is usually found in decks of changes, defence and war.
%%%%
-Metamorphosis
+Metamorphosis card
This card temporarily transforms you.
It is usually found in decks of changes, defence and war.
%%%%
-the Helm
+the Helm card
This card increases your defences.
It is usually found in decks of changes, defence and war.
%%%%
-the Blade
+the Blade card
This card temporarily enchants or even animates your weapon.
It is usually found in decks of changes, defence and war.
%%%%
-the Shadow
+the Shadow card
This card lets you blend into the shadows, making you less perceptible.
It is usually found in decks of changes, defence and war.
%%%%
# deck of wonders -> also changes
-the Potion
+the Potion card
This card has the same effect, positive or negative, as drinking a random magical potion.
It is usually found in decks of changes and wonders.
%%%%
-Focus
+Focus card
This card further boosts your strongest attribute at the cost of your worst.
It is usually found in decks of changes and wonders.
%%%%
-Shuffle
+Shuffle card
This card interchanges your three attributes. Use with caution!
It is usually found in decks of changes and wonders.
%%%%
-Experience
+Experience card
This card makes you more experienced.
It is usually found in decks of changes and wonders.
%%%%
-the Helix
+the Helix card
This cards changes your mutations. Higher power levels make the change more likely to be beneficial.
It is usually found in decks of changes and wonders.
%%%%
-the Sage
+the Sage card
This card will funnel some of your earned experience towards a training specific skill and train it faster than it normally would.
It is usually found in decks of changes and wonders.
%%%%
# deck of dungeons -> also changes
-Water
+Water card
This card changes the floor around you into water.
It is usually found in decks of changes and dungeons.
%%%%
-Vitrification
+Vitrification card
This card turns walls translucent.
It is usually found in decks of changes and dungeons.
%%%%
-the Map
+the Map card
This card reveals your surroundings.
It is usually found in decks of changes and dungeons.
%%%%
-Dowsing
+Dowsing card
This card lets you detect secret doors, traps, creatures or some combination thereof.
It is usually found in decks of changes and dungeons.
%%%%
-the Spade
+the Spade card
This card digs a tunnel through unworked rock.
It is usually found in decks of changes and dungeons.
%%%%
-the Trowel
+the Trowel card
This card may create an altar, a statue, a golem or a portal.
It is usually found in decks of changes and dungeons.
%%%%
-the Minefield
+the Minefield card
This card makes your immediate surroundings more dangerous.
It is usually found in decks of changes and dungeons, or in Nemelex's deck of punishment.
%%%%
# deck of summonings
-the Crusade
+the Crusade card
This card tries to convert nearby creatures to your cause.
It is usually found in decks of summonings and war.
%%%%
-the Herd
+the Herd card
This card summons animals.
It is usually found in decks of summonings and war.
%%%%
-the Pentagram
+the Pentagram card
This card summons a demon to your aid.
It is usually found in decks of summonings and war.
%%%%
-the Dance
+the Dance card
This card summons a dancing weapon.
It is usually found in decks of summonings and war.
%%%%
-Foxfire
+Foxfire card
This card summons flying creatures.
It is usually found in decks of summonings and war.
%%%%
-the Bones
+the Bones card
This card summons a skeletal monster.
It is usually found in decks of summonings and war.
%%%%
-Repulsiveness
+Repulsiveness card
This card summons an ugly or very ugly thing.
It is usually found in decks of summonings and war.
%%%%
-Vitriol
+Vitriol card
This card unleashes a corrosive or degenerating attack spell.
It is usually found in decks of destruction and war.
%%%%
-Flame
+Flame card
This card unleashes a fiery attack spell.
It is usually found in decks of destruction and war.
%%%%
-Frost
+Frost card
This card unleashes an icy attack spell.
It is usually found in decks of destruction and war.
%%%%
-Venom
+Venom card
This card unleashes a poisonous attack spell, which may affect you as well.
It is usually found in decks of destruction and war.
%%%%
-the Spark
+the Spark card
This card unleashes an electrical attack spell.
It is usually found in decks of destruction and war.
%%%%
-the Hammer
+the Hammer card
This card unleashes a physical attack spell.
It is usually found in decks of destruction and war.
%%%%
-Pain
+Pain card
The Pain card unleashes a necromantic attack spell, which may affect you as well.
It is usually found in decks of destruction and war.
%%%%
-Torment
+Torment card
This card calls on the powers of Hell to agonising injury to any nearby living creature.
It is usually found in decks of destruction and war.
%%%%
# deck of punishment (along with a few others)
-Wrath
+Wrath card
This card draws a god's wrath against you.
It is usually only found in Nemelex's deck of punishment.
%%%%
-the Wraith
+the Wraith card
This card will drain you.
It is usually only found in Nemelex's deck of punishment.
%%%%
-the Curse
+the Curse card
This card places curses on your possessions and may even spoil your potions.
It is usually only found in Nemelex's deck of punishment.
%%%%
-Xom
+Xom card
This card draws the attention of Xom on yourself.
It is usually only found in Nemelex's deck of punishment.
%%%%
-Famine
+Famine card
This card starves you.
It is usually only found in Nemelex's deck of punishment.
%%%%
-Wild Magic
+Wild Magic card
This card causes wild magic, as if from miscasting a spell, to act upon you.
It is usually only found in Nemelex's deck of punishment.
%%%%
# deck of oddities (random card, along with a few others)
-the Bargain
+the Bargain card
This card grants you a temporary discount in shops.
It is not normally part of any deck.
%%%%
-the Genie
+the Genie card
The Genie may grant you an acquirement or punish you for trying.
It is not normally part of any deck.
%%%%
-the Feast
+the Feast card
This card feeds you.
It is not normally part of any deck.
%%%%
# cards for wizmode testing (&c)
-the Stairs
+the Stairs card
This card makes staircases slide towards or away from you.
(It is a bug if you ever encounter this card.)
%%%%
-Summoning
+Summoning card
This card summons random creatures.
(It is a bug if you ever encounter this card.)
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index c51e569988..f8c473e42e 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -1278,9 +1278,7 @@ void wizard_create_spec_object()
dummy.type = mon;
if (mons_genus(mon) == MONS_HYDRA)
- {
dummy.number = _debug_prompt_for_int("How many heads?", false);
- }
if (fill_out_corpse(&dummy, mitm[thing_created], true) == -1)
{
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index bf4da0ac89..8d9d1fc039 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -17,6 +17,7 @@ REVISION("$Rev$");
#include "beam.h"
#include "cio.h"
+#include "database.h"
#include "dungeon.h"
#include "effects.h"
#include "files.h"
@@ -927,6 +928,26 @@ static void _redraw_stacked_cards(const std::vector<card_type>& draws,
}
}
+static void _describe_cards(std::vector<card_type> cards)
+{
+ ASSERT(!cards.empty());
+
+ std::ostringstream data;
+ for (unsigned int i = 0; i < cards.size(); ++i)
+ {
+ std::string name = card_name(cards[i]);
+ std::string desc = getLongDescription(name + " card");
+ if (desc.empty())
+ desc = "No description found.";
+
+ data << name << "$$" << desc << "$$";
+ }
+ print_description(data.str());
+ if (getch() == 0)
+ getch();
+
+ redraw_screen();
+}
// Stack a deck: look at the next five cards, put them back in any
// order, discard the rest of the deck.
@@ -985,20 +1006,26 @@ bool deck_stack()
if (draws.size() > 1)
{
+ bool need_prompt_redraw = true;
unsigned int selected = draws.size();
- clrscr();
- cgotoxy(1,1);
- textcolor(WHITE);
- cprintf("Press a digit to select a card, "
- "then another digit to swap it.");
- cgotoxy(1,10);
- cprintf("Press Enter to accept.");
-
- _redraw_stacked_cards(draws, selected);
-
- // Hand-hacked implementation, instead of using Menu. Oh well.
while (true)
{
+ if (need_prompt_redraw)
+ {
+ clrscr();
+ cgotoxy(1,1);
+ textcolor(WHITE);
+ cprintf("Press a digit to select a card, then another digit "
+ "to swap it.");
+ cgotoxy(1,10);
+ cprintf("Press ? for the card descriptions, or Enter to "
+ "accept.");
+
+ _redraw_stacked_cards(draws, selected);
+ need_prompt_redraw = false;
+ }
+
+ // Hand-hacked implementation, instead of using Menu. Oh well.
const int c = getch();
if (c == CK_ENTER)
{
@@ -1013,7 +1040,12 @@ bool deck_stack()
continue;
}
- if (c >= '1' && c <= '0' + static_cast<int>(draws.size()))
+ if (c == '?')
+ {
+ _describe_cards(draws);
+ need_prompt_redraw = true;
+ }
+ else if (c >= '1' && c <= '0' + static_cast<int>(draws.size()))
{
const unsigned int new_selected = c - '1';
if (selected < draws.size())
@@ -1088,17 +1120,27 @@ bool deck_triple_draw()
flags.push_back(_flags);
}
- mpr("You draw... (choose one card)");
- for (int i = 0; i < num_to_draw; ++i)
- {
- msg::streams(MSGCH_PROMPT) << (static_cast<char>(i + 'a')) << " - "
- << card_name(draws[i]) << std::endl;
- }
int selected = -1;
+ bool need_prompt_redraw = true;
while (true)
{
+ if (need_prompt_redraw)
+ {
+ mpr("You draw... (choose one card, ? for their descriptions)");
+ for (int i = 0; i < num_to_draw; ++i)
+ {
+ msg::streams(MSGCH_PROMPT) << (static_cast<char>(i + 'a')) << " - "
+ << card_name(draws[i]) << std::endl;
+ }
+ need_prompt_redraw = false;
+ }
const int keyin = tolower(get_ch());
- if (keyin >= 'a' && keyin < 'a' + num_to_draw)
+ if (keyin == '?')
+ {
+ _describe_cards(draws);
+ need_prompt_redraw = true;
+ }
+ else if (keyin >= 'a' && keyin < 'a' + num_to_draw)
{
selected = keyin - 'a';
break;
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index c57a3beb73..2150e15e31 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -1966,29 +1966,40 @@ std::string get_item_description( const item_def &item, bool verbose,
case OBJ_STAVES:
if (item_is_rod( item ))
{
- description <<
- "$It uses its own mana reservoir for casting spells, and "
- "recharges automatically by channeling mana from its "
- "wielder.";
-
- const int max_charges = MAX_ROD_CHARGE;
- if (item_ident(item, ISFLAG_KNOW_PLUSES))
+ if (verbose)
{
- const int num_charges = item.plus2 / ROD_CHARGE_MULT;
- if (max_charges > num_charges)
+ description <<
+ "$It uses its own mana reservoir for casting spells, and "
+ "recharges automatically by channeling mana from its "
+ "wielder.";
+
+ const int max_charges = MAX_ROD_CHARGE;
+ if (item_ident(item, ISFLAG_KNOW_PLUSES))
{
- description << "$It can currently hold " << num_charges
- << " charges. It can be magically recharged "
- << "to contain up to " << max_charges
- << " charges.";
+ const int num_charges = item.plus2 / ROD_CHARGE_MULT;
+ if (max_charges > num_charges)
+ {
+ description << "$It can currently hold " << num_charges
+ << " charges. It can be magically recharged "
+ << "to contain up to " << max_charges
+ << " charges.";
+ }
+ else
+ description << "$It is fully charged.";
}
else
- description << "$It is fully charged.";
+ {
+ description << "$It can have at most " << max_charges
+ << " charges.";
+ }
}
- else
+ else if (Options.dump_book_spells)
{
- description << "$It can have at most " << max_charges
- << " charges.";
+ append_spells( desc, item );
+ if (desc.empty())
+ need_extra_line = false;
+ else
+ description << desc;
}
}
else
@@ -2208,7 +2219,6 @@ static bool _show_item_description(const item_def &item)
const unsigned int lineWidth = get_number_of_cols() - 1;
const int height = get_number_of_lines();
- describe_info inf;
std::string desc =
get_item_description(item, true, false, Options.tutorial_left);
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 3f10cf7ce8..943057e7c5 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -512,8 +512,8 @@ void full_describe_view()
return;
}
- InvMenu desc_menu(MF_SINGLESELECT | MF_ANYPRINTABLE |
- /*MF_ALWAYS_SHOW_MORE |*/ MF_ALLOW_FORMATTING);
+ InvMenu desc_menu(MF_SINGLESELECT | MF_ANYPRINTABLE
+ | MF_ALLOW_FORMATTING);
desc_menu.set_highlighter(NULL);
// FIXME: Need different title for the opposite toggle:
@@ -522,7 +522,8 @@ void full_describe_view()
new MenuEntry("Visible Monsters/Items (select for more detail, '!' to view/travel):",
MEL_TITLE));
- desc_menu.set_tag("description");
+ desc_menu.set_tag("pickup");
+ desc_menu.set_type(MT_PICKUP); // necessary for sorting of the item submenu
desc_menu.allow_toggle = true;
int menu_index = -1;
@@ -539,7 +540,7 @@ void full_describe_view()
const char letter = index_to_letter(menu_index);
// Get colour-coded letter.
- unsigned char colour = mons_class_colour(list_mons[i]->type);
+ unsigned char colour = get_mons_colour(list_mons[i]);
if (colour == BLACK)
colour = LIGHTGREY;
@@ -580,7 +581,6 @@ void full_describe_view()
{
me = new MenuEntry(prefix + str, MEL_ITEM, 1, letter);
me->data = (void*) list_mons[i];
- me->tag = "m";
me->quantity = 1; // Hack to make monsters selectable.
}
else
@@ -597,19 +597,24 @@ void full_describe_view()
// Build menu entries for items.
if (list_items.size())
{
- desc_menu.add_entry( new MenuEntry( "Items", MEL_SUBTITLE ) );
+ std::vector<InvEntry*> all_items;
for (unsigned int i = 0; i < list_items.size(); ++i)
+ all_items.push_back( new InvEntry(list_items[i]) );
+
+ const menu_sort_condition *cond = desc_menu.find_menu_sort_condition();
+ desc_menu.sort_menu(all_items, cond);
+
+ desc_menu.add_entry( new MenuEntry( "Items", MEL_SUBTITLE ) );
+ for (unsigned int i = 0; i < all_items.size(); ++i)
{
++menu_index;
const char letter = index_to_letter(menu_index);
- const item_def &item = list_items[i];
-
- InvEntry *me = new InvEntry(item);
+ InvEntry *me = all_items[i];
#ifndef USE_TILE
// Show glyphs only for ASCII.
me->set_show_glyph(true);
#endif
- me->tag = "i";
+ me->tag = "pickup";
me->hotkeys[0] = letter;
me->quantity = 2; // Hack to make items selectable.
@@ -693,6 +698,7 @@ void full_describe_view()
me->set_show_glyph(false);
}
#else
+ // Clear cursor placement.
tiles.place_cursor(CURSOR_TUTORIAL, Region::NO_CURSOR);
tiles.clear_text_tags(TAG_TUTORIAL);
#endif
@@ -3180,15 +3186,25 @@ static void _describe_cell(const coord_def& where, bool in_range)
goto look_clouds;
#endif
- _describe_monster(mon);
-
if (mons_is_mimic(mon->type))
{
+ if (mons_is_known_mimic(mon))
+ _describe_monster(mon);
+ else
+ {
+ item_def item;
+ get_mimic_item( mon, item );
+ std::string name = get_message_colour_tags(item, DESC_NOCAP_A,
+ MSGCH_FLOOR_ITEMS);
+ mprf("You see %s here.", name.c_str());
+ }
mimic_item = true;
item_described = true;
}
else
{
+ _describe_monster(mon);
+
if (!in_range)
{
mprf(MSGCH_EXAMINE_FILTER, "%s is out of range.",
@@ -3244,8 +3260,11 @@ static void _describe_cell(const coord_def& where, bool in_range)
mprf( MSGCH_FLOOR_ITEMS, "A pile of gold coins." );
else
{
+ std::string name = get_message_colour_tags(mitm[targ_item],
+ DESC_NOCAP_A,
+ MSGCH_FLOOR_ITEMS);
mprf( MSGCH_FLOOR_ITEMS, "You see %s here.",
- mitm[targ_item].name(DESC_NOCAP_A).c_str());
+ name.c_str());
}
if (mitm[ targ_item ].link != NON_ITEM)
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index 7ee1b3b064..d2f8447f14 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -149,8 +149,8 @@ const bool InvEntry::is_item_equipped() const
return (false);
}
-// returns values < 0 for edible chunks (non-rotten except for Saprovores),
-// 0 for non-chunks, and values > 0 for rotten chunks for non-Saprovores
+// Returns values < 0 for edible chunks (non-rotten except for Saprovores),
+// 0 for non-chunks, and values > 0 for rotten chunks for non-Saprovores.
const int InvEntry::item_freshness() const
{
if (item->base_type != OBJ_FOOD || item->sub_type != FOOD_CHUNK)
@@ -739,7 +739,7 @@ void InvMenu::load_items(const std::vector<const item_def*> &mitems,
_get_class_hotkeys(i, glyphs);
if (!glyphs.empty())
{
- const std::string str = "Magical Devices"; // longest string
+ const std::string str = "Magical Staves and Rods"; // longest string
subtitle += std::string(str.length()
- subtitle.length() + 1, ' ');
subtitle += "(select all with <w>";
diff --git a/crawl-ref/source/invent.h b/crawl-ref/source/invent.h
index 315cdb0f7c..366b747ea6 100644
--- a/crawl-ref/source/invent.h
+++ b/crawl-ref/source/invent.h
@@ -156,12 +156,12 @@ public:
// of the use of the item pointers, or mayhem results!
static std::vector<const item_def*> xlat_itemvect(
const std::vector<item_def> &);
+ const menu_sort_condition *find_menu_sort_condition() const;
+ void sort_menu(std::vector<InvEntry*> &items,
+ const menu_sort_condition *cond);
protected:
bool process_key(int key);
void do_preselect(InvEntry *ie);
- void sort_menu(std::vector<InvEntry*> &items,
- const menu_sort_condition *cond);
- const menu_sort_condition *find_menu_sort_condition() const;
virtual bool is_selectable(int index) const;
protected:
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 185e9b86f4..b118743137 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -1933,14 +1933,16 @@ bool check_item_knowledge(bool quiet)
std::sort(items.begin(), items.end(), item_names);
InvMenu menu;
menu.set_title("You recognise:");
- menu.load_items(items, discoveries_item_mangle);
menu.set_flags(MF_NOSELECT);
+ menu.load_items(items, discoveries_item_mangle);
menu.show();
redraw_screen();
- for ( std::vector<const item_def*>::iterator iter = items.begin();
- iter != items.end(); ++iter )
+ for (std::vector<const item_def*>::iterator iter = items.begin();
+ iter != items.end(); ++iter)
+ {
delete *iter;
+ }
}
return (rc);
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 566fb08874..c368440068 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -301,7 +301,7 @@ void inc_inv_item_quantity( int obj, int amount, bool suppress_burden )
you.m_quiver->on_inv_quantity_changed(obj, amount);
you.inv[obj].quantity += amount;
- if ( !suppress_burden )
+ if (!suppress_burden)
burden_change();
}
@@ -1300,7 +1300,7 @@ void pickup()
if (!pickup_warning.empty())
mpr(pickup_warning.c_str());
}
-} // end pickup()
+}
bool is_stackable_item( const item_def &item )
{
@@ -1615,8 +1615,10 @@ int move_item_to_player( int obj, int quant_got, bool quiet,
_got_item(mitm[obj], quant_got);
if (!quiet)
- mpr( you.inv[m].name(DESC_INVENTORY).c_str() );
-
+ {
+ mpr(get_message_colour_tags(you.inv[m],
+ DESC_INVENTORY).c_str());
+ }
you.turn_is_over = true;
return (retval);
@@ -1624,7 +1626,7 @@ int move_item_to_player( int obj, int quant_got, bool quiet,
}
}
- // can't combine, check for slot space
+ // Can't combine, check for slot space.
if (inv_count() >= ENDOFPACK)
return (-1);
@@ -1681,8 +1683,10 @@ int move_item_to_player( int obj, int quant_got, bool quiet,
burden_change();
if (!quiet)
- mpr( you.inv[freeslot].name(DESC_INVENTORY).c_str() );
-
+ {
+ mpr(get_message_colour_tags(you.inv[freeslot],
+ DESC_INVENTORY).c_str());
+ }
if (Options.tutorial_left)
{
taken_new_item(item.base_type);
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index 8f2e2e822b..175e098c12 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -1418,7 +1418,9 @@ void column_composer::add_formatted(
// be added at page boundaries.
if (add_separator && col.lines && !segs.empty()
&& (!pagesize || col.lines % pagesize))
+ {
newlines.push_back(formatted_string());
+ }
for (unsigned i = 0, size = segs.size(); i < size; ++i)
{
@@ -1747,8 +1749,8 @@ bool formatted_scroller::page_up()
bool formatted_scroller::line_down()
{
- if (first_entry + pagesize < static_cast<int>(items.size()) &&
- items[first_entry + pagesize]->level != MEL_TITLE )
+ if (first_entry + pagesize < static_cast<int>(items.size())
+ && items[first_entry + pagesize]->level != MEL_TITLE)
{
++first_entry;
return (true);
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc
index 7f6c98f44e..5d0a71b08e 100644
--- a/crawl-ref/source/spl-book.cc
+++ b/crawl-ref/source/spl-book.cc
@@ -1525,7 +1525,7 @@ int count_staff_spells(const item_def &item, bool need_id)
return (0);
const int type = item.book_number();
- if ( !item_is_rod(item) || type == -1)
+ if (!item_is_rod(item) || type == -1)
return (0);
int nspel = 0;
@@ -2042,61 +2042,69 @@ bool make_book_level_randart(item_def &book, int level, int num_spells,
// None of these books need a definite article prepended.
book.props["is_named"].get_bool() = true;
- std::string lookup;
- if (level == 1)
- lookup = "starting";
- else if (level <= 3 || level == 4 && coinflip())
- lookup = "easy";
- else if (level <= 6)
- lookup = "moderate";
+ std::string bookname;
+ if (god == GOD_XOM && coinflip())
+ {
+ bookname = getRandNameString("book_noun") + " of "
+ + getRandNameString("Xom_book_title");
+ }
else
- lookup = "difficult";
-
- lookup += " level book";
+ {
+ std::string lookup;
+ if (level == 1)
+ lookup = "starting";
+ else if (level <= 3 || level == 4 && coinflip())
+ lookup = "easy";
+ else if (level <= 6)
+ lookup = "moderate";
+ else
+ lookup = "difficult";
- std::string bookname;
- // First try for names respecting the book's previous owner/author
- // (if one exists), then check for general difficulty.
- if (has_owner)
- bookname = getRandNameString(lookup + " owner");
+ lookup += " level book";
- if (!has_owner || bookname.empty())
- bookname = getRandNameString(lookup);
+ // First try for names respecting the book's previous owner/author
+ // (if one exists), then check for general difficulty.
+ if (has_owner)
+ bookname = getRandNameString(lookup + " owner");
- bookname = uppercase_first(bookname);
- if (has_owner)
- {
- if (bookname.substr(0, 4) == "The ")
- bookname = bookname.substr(4);
- else if (bookname.substr(0, 2) == "A ")
- bookname = bookname.substr(2);
- else if (bookname.substr(0, 3) == "An ")
- bookname = bookname.substr(3);
- }
+ if (!has_owner || bookname.empty())
+ bookname = getRandNameString(lookup);
- if (bookname.empty())
- bookname = getRandNameString("book");
+ bookname = uppercase_first(bookname);
+ if (has_owner)
+ {
+ if (bookname.substr(0, 4) == "The ")
+ bookname = bookname.substr(4);
+ else if (bookname.substr(0, 2) == "A ")
+ bookname = bookname.substr(2);
+ else if (bookname.substr(0, 3) == "An ")
+ bookname = bookname.substr(3);
+ }
- if (bookname.find("@level@", 0) != std::string::npos)
- {
- std::string number;
- switch (level)
+ if (bookname.find("@level@", 0) != std::string::npos)
{
- case 1: number = "One"; break;
- case 2: number = "Two"; break;
- case 3: number = "Three"; break;
- case 4: number = "Four"; break;
- case 5: number = "Five"; break;
- case 6: number = "Six"; break;
- case 7: number = "Seven"; break;
- case 8: number = "Eight"; break;
- case 9: number = "Nine"; break;
- default:
- number = ""; break;
+ std::string number;
+ switch (level)
+ {
+ case 1: number = "One"; break;
+ case 2: number = "Two"; break;
+ case 3: number = "Three"; break;
+ case 4: number = "Four"; break;
+ case 5: number = "Five"; break;
+ case 6: number = "Six"; break;
+ case 7: number = "Seven"; break;
+ case 8: number = "Eight"; break;
+ case 9: number = "Nine"; break;
+ default:
+ number = ""; break;
+ }
+ bookname = replace_all(bookname, "@level@", number);
}
- bookname = replace_all(bookname, "@level@", number);
}
+ if (bookname.empty())
+ bookname = getRandNameString("book");
+
name += bookname;
set_randart_name(book, name);
@@ -2353,7 +2361,16 @@ bool make_book_theme_randart(item_def &book, int disc1, int disc2,
if (disc1 == 0 && disc2 == 0)
{
if (!_get_weighted_discs(completely_random, god, disc1, disc2))
- return (false);
+ {
+ if (completely_random)
+ return (false);
+
+ // Rather than give up at this point, choose schools randomly.
+ // This way, an acquirement won't fail once the player has
+ // seen all spells.
+ if (!_get_weighted_discs(true, god, disc1, disc2))
+ return (false);
+ }
}
else if (disc2 == 0)
disc2 = disc1;
@@ -2625,7 +2642,9 @@ bool make_book_theme_randart(item_def &book, int disc1, int disc2,
// Sometimes use a completely random title.
std::string bookname = "";
- if (one_chance_in(20) && (owner.empty() || one_chance_in(3)))
+ if (owner == "Xom" && !one_chance_in(20))
+ bookname = getRandNameString("Xom_book_title");
+ else if (one_chance_in(20) && (owner.empty() || one_chance_in(3)))
bookname = getRandNameString("random_book_title");
if (!bookname.empty())
diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc
index f253f91f66..335867182d 100644
--- a/crawl-ref/source/tilesdl.cc
+++ b/crawl-ref/source/tilesdl.cc
@@ -1305,7 +1305,7 @@ static void _fill_item_info(InventoryTile &desc, const item_def &item)
|| type == OBJ_POTIONS || type == OBJ_MISSILES)
{
// -1 specifies don't display anything
- desc.quantity = item.quantity == 1 ? -1 : item.quantity;
+ desc.quantity = (item.quantity == 1) ? -1 : item.quantity;
}
else if (type == OBJ_WANDS
&& ((item.flags & ISFLAG_KNOW_PLUSES)
@@ -1313,6 +1313,8 @@ static void _fill_item_info(InventoryTile &desc, const item_def &item)
{
desc.quantity = item.plus;
}
+ else if (item_is_rod(item) && item.flags & ISFLAG_KNOW_PLUSES)
+ desc.quantity = item.plus / ROD_CHARGE_MULT;
else
desc.quantity = -1;
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index cb00257661..9d6438e299 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -313,7 +313,7 @@ void travel_exclude::set_exclude_show()
{
// ignores clouds
feature_grid fgrid = _map_to_grid(pos);
- losight(show, fgrid, pos, false, true);
+ losight(show, fgrid, pos, false, true, true);
uptodate = true;
}
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index eae37eed80..681a26ed34 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -2812,7 +2812,7 @@ int num_feats_between(const coord_def& source, const coord_def& target,
// done by updating with a second array.
void losight(env_show_grid &sh,
feature_grid &gr, const coord_def& center,
- bool clear_walls_block, bool ignore_clouds)
+ bool clear_walls_block, bool ignore_clouds, bool inwards)
{
raycast();
const int x_p = center.x;
@@ -2850,6 +2850,7 @@ void losight(env_show_grid &sh,
// kill all blocked rays
const unsigned long* inptr = los_blockrays;
+
for (int xdiff = 0; xdiff <= LOS_MAX_RANGE_X; ++xdiff)
for (int ydiff = 0; ydiff <= LOS_MAX_RANGE_Y;
++ydiff, inptr += num_words)
@@ -3984,8 +3985,8 @@ bool see_grid( const env_show_grid &show,
bool see_grid( const coord_def &p )
{
return ((crawl_state.arena || crawl_state.arena_suspended)
- && crawl_view.in_grid_los(p))
- || see_grid(env.show, you.pos(), p);
+ && crawl_view.in_grid_los(p))
+ || see_grid(env.show, you.pos(), p);
}
// Answers the question: "Would a grid be within character's line of sight,
@@ -4859,10 +4860,10 @@ std::string screenshot( bool fullscreen )
const coord_def gc = view2grid(coord_def(count_x, count_y));
int ch =
- (!map_bounds(gc)) ? 0
- : (!crawl_view.in_grid_los(gc)) ? get_envmap_char(gc.x, gc.y)
- : (gc == you.pos()) ? you.symbol
- : get_screen_glyph(gc.x, gc.y);
+ (!map_bounds(gc)) ? 0 :
+ (!crawl_view.in_grid_los(gc)) ? get_envmap_char(gc.x, gc.y) :
+ (gc == you.pos()) ? you.symbol
+ : get_screen_glyph(gc.x, gc.y);
if (ch && !isprint(ch))
{
diff --git a/crawl-ref/source/view.h b/crawl-ref/source/view.h
index 4cba2a9dbb..57ea1baf34 100644
--- a/crawl-ref/source/view.h
+++ b/crawl-ref/source/view.h
@@ -72,7 +72,7 @@ void find_features(const std::vector<coord_def>& features,
void losight(env_show_grid &sh, feature_grid &gr,
const coord_def& center, bool clear_walls_block = false,
- bool ignore_clouds = false);
+ bool ignore_clouds = false, bool inwards = false);
bool magic_mapping(int map_radius, int proportion, bool suppress_msg,