summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/settings/food_colouring.txt124
-rw-r--r--crawl-ref/settings/init.txt2
-rw-r--r--crawl-ref/settings/menu_colours.txt55
-rw-r--r--crawl-ref/source/command.cc6
-rw-r--r--crawl-ref/source/describe.cc39
-rw-r--r--crawl-ref/source/food.cc149
-rw-r--r--crawl-ref/source/food.h6
-rw-r--r--crawl-ref/source/initfile.cc8
-rw-r--r--crawl-ref/source/invent.cc39
-rw-r--r--crawl-ref/source/itemname.cc58
-rw-r--r--crawl-ref/source/items.cc2
-rw-r--r--crawl-ref/source/menu.h8
-rw-r--r--crawl-ref/source/message.cc4
-rw-r--r--crawl-ref/source/monplace.cc4
-rw-r--r--crawl-ref/source/player.cc6
-rw-r--r--crawl-ref/source/xom.cc8
16 files changed, 285 insertions, 233 deletions
diff --git a/crawl-ref/settings/food_colouring.txt b/crawl-ref/settings/food_colouring.txt
index edf8ec99a9..ebdea7fd35 100644
--- a/crawl-ref/settings/food_colouring.txt
+++ b/crawl-ref/settings/food_colouring.txt
@@ -7,124 +7,26 @@ inv := menu_colour
# Spriggans don't care for corpses and chunks.
#
-: if you.race() == "Spriggan" then
-msg = darkgrey:.*corpse
-msg = darkgrey:.*chunk
-inv = darkgrey:.*chunks? of
-inv = darkgrey:.*corpse
-inv = yellow:.*food.*(bread ration|snozzcumber|slice of pizza)
-inv = yellow:.*food.*(orange|banana|lemon|pear|apple|apricot|choko)
-inv = yellow:.*food.*(rambutan|lychee|strawberry|grape|sultana)
-: end
-# Mummies don't care for food at all.
-#
-: if you.race() == "Mummy" then
-msg = darkgrey:.*corpse
-msg = darkgrey:.*chunk
-inv = darkgrey:.*food.*
-: end
+msg = darkgrey:.*inedible.*
+inv = darkgrey:.*inedible.*
-# Rotten chunks eaters: Ghouls, Ogres, Kobolds, Trolls, Hill Orcs
-#
-: if you.race() == "Ghoul" then
-msg = yellow:rot.*chunks? of
-msg = yellow:rot.*corpse
-inv = yellow:.*rot.*chunks? of
-< elseif you.race() == "Ogre" or
- you.race() == "Kobold" or
- you.race() == "Troll" or
- you.race() == "Hill Orc" then >
-# color rotten chunks as normal chunks
-: else
-msg = lightred:rot.*chunks? of
-msg = lightred:rot.*corpse
-inv = lightred:.*rot.*chunks? of
-inv = lightred:.*rot.*corpse
-autopickup_exceptions = >rot.*chunks? of
-: end
+msg = yellow:.*preferred.*
+inv = yellow:.*preferred.*
-# Kobolds don't want fruits but meat.
-#
-: if you.race() == "Kobold" then
-inv = darkgrey:.*food.*(bread ration|snozzcumber|slice of pizza)
-inv = darkgrey:.*food.*(orange|banana|lemon|pear|apple|apricot)
-inv = darkgrey:.*food.*(rambutan|lychee|strawberry|grape|sultana)
-inv = yellow:.*chunks? of
-: end
-
-# Undead corpses/chunks
-#
-msg = lightred:chunks? of.*(ghoul|necrophage|death drake)
-msg = lightred:(ghoul | necrophage|death drake).*corpse
-inv = lightred:.*chunks? of.*(ghoul|necrophage|death drake)
+# Corpses of undead (necrophages etc.)
+msg = lightred:.*rot-inducing.*
+inv = lightred:.*rot-inducing.*
# Mutagenic corpses/chunks
-#
-msg = magenta:chunks? of.*(draining|orange brain|great orb)
-msg = magenta:chunks? of.*(guardian naga|shapeshifter|very ugly)
-msg = magenta:(draining|orange brain|great orb).*corpse
-msg = magenta:(guardian naga|shapeshifter|very ugly).*corpse
-inv = magenta:.*chunks? of.*(draining|orange brain|great orb)
-inv = magenta:.*chunks? of.*(guardian naga|shapeshifter|very ugly)
+msg = magenta:.*mutagenic.*
+inv = magenta:.*mutagenic.*
# Poisonous corpses/chunks
-#
-msg = lightgreen:chunks? of.*(ant larva|kobold|beetle)
-msg = lightgreen:chunks? of.*(brain worm|green draconian)
-msg = lightgreen:chunks? of.*((black|brown|yellow) snake)
-msg = lightgreen:chunks? of.*(bee|death yak|slug|amoeba)
-msg = lightgreen:chunks? of.*(centipede|mite|snail|gila|hydra)
-msg = lightgreen:chunks? of.*(iron troll|naga|queen|wasp)
-msg = lightgreen:chunks? of.*(redback|(golden|mottled) dragon)
-msg = lightgreen:chunks? of.*((orange|green) rat)
-msg = lightgreen:chunks? of.*(scorpion|soldier ant|spiny|spider)
-msg = lightgreen:(ant larva|kobold|beetle).*corpse
-msg = lightgreen:(brain worm|green draconian).*corpse
-msg = lightgreen:((black|brown|yellow) snake).*corpse
-msg = lightgreen:(bee|death yak|slug|amoeba).*corpse
-msg = lightgreen:(centipede|mite|snail|gila|hydra).*corpse
-msg = lightgreen:(iron troll|naga|queen|wasp).*corpse
-msg = lightgreen:(redback|(golden|mottled) dragon).*corpse
-msg = lightgreen:((orange|green) rat).*corpse
-msg = lightgreen:(scorpion|soldier ant|spiny|spider).*corpse
-inv = lightgreen:.*chunks? of.*(ant larva|kobold|beetle)
-inv = lightgreen:.*chunks? of.*(brain worm|green draconian)
-inv = lightgreen:.*chunks? of.*((black|brown|yellow) snake)
-inv = lightgreen:.*chunks? of.*(bee|death yak|slug|amoeba)
-inv = lightgreen:.*chunks? of.*(centipede|mite|snail|gila|hydra)
-inv = lightgreen:.*chunks? of.*(iron troll|naga|queen|wasp)
-inv = lightgreen:.*chunks? of.*(redback|(golden|mottled) dragon)
-inv = lightgreen:.*chunks? of.*((orange|green) rat)
-inv = lightgreen:.*chunks? of.*(scorpion|soldier ant|spiny|spider)
+msg = lightgreen:.*poisonous.*
+inv = lightgreen:.*poisonous.*
# Contaminated corpses/chunks
-#
-msg = brown:chunks? of.*(elf|human|drake|blowfly|cockroach)
-msg = brown:chunks? of.*((fire|hill|frost|stone) giant)
-msg = brown:chunks? of.*(mosquito|gnoll|goblin|jackal)
-msg = brown:chunks? of.*(manticore|minotaur|ogre|orc)
-msg = brown:chunks? of.*(war dog|warg|((rock|deep) )?troll)
-msg = brown:chunks? of.*(grey rat|ugly thing|draconian)
-msg = brown:chunks? of.*((quicksilver|iron|swamp|komodo) dragon)
-msg = brown:chunks? of.*(mer(folk|maid))
-msg = brown:(elf|human|drake|blowfly|cockroach).*corpse
-msg = brown:((fire|hill|frost|stone) giant).*corpse
-msg = brown:(mosquito|gnoll|goblin|jackal).*corpse
-msg = brown:(manticore|minotaur|ogre|orc).*corpse
-msg = brown:(war dog|warg|((rock|deep) )?troll).*corpse
-msg = brown:(grey rat|ugly thing|draconian).*corpse
-msg = brown:((quicksilver|iron|swamp|komodo) dragon).*corpse
-msg = brown:(mer(folk|maid)).*corpse
-inv = brown:.*chunks? of.*(elf|human|drake|blowfly|cockroach)
-inv = brown:.*chunks? of.*((fire|hill|frost|stone) giant)
-inv = brown:.*chunks? of.*(mosquito|gnoll|goblin|jackal)
-inv = brown:.*chunks? of.*(manticore|minotaur|ogre|orc)
-inv = brown:.*chunks? of.*(war dog|warg|((rock|deep) )?troll)
-inv = brown:.*chunks? of.*(grey rat|ugly thing|draconian)
-inv = brown:.*chunks? of.*((quicksilver|iron|swamp|komodo) dragon)
-inv = brown:.*chunks? of.*(mer(folk|maid))
+msg = brown:.*contaminated.*
+inv = brown:.*contaminated.*
-# Other food
-#
-inv = lightgrey:^food \ No newline at end of file
diff --git a/crawl-ref/settings/init.txt b/crawl-ref/settings/init.txt
index 60851d5681..92cf07cab0 100644
--- a/crawl-ref/settings/init.txt
+++ b/crawl-ref/settings/init.txt
@@ -239,7 +239,7 @@ menu_colour_prefix_class = true
#
# yellow = preferred food
# lightgrey = normal food
-# darkgey = cannot be eaten at all
+# darkgrey = cannot be eaten at all
# lightred = extremely dangerous
# magenta = mutagenic
# lightgreen = poisonous
diff --git a/crawl-ref/settings/menu_colours.txt b/crawl-ref/settings/menu_colours.txt
index 01f5718212..cc6ef2b685 100644
--- a/crawl-ref/settings/menu_colours.txt
+++ b/crawl-ref/settings/menu_colours.txt
@@ -8,49 +8,13 @@ ae := autopickup_exceptions
menu = lightmagenta:.*misc.*rune( of Zot)?
menu = lightmagenta:.*orb.*Zot
-# Identified artefacts
-#
-menu = magenta:.*(weapon|armour|jewellery|staff).*[+-] the
-
-# Unidentified weapon artefacts
-#
-menu = magenta:.*weapon.* ((brightly|faintly) glowing|smoking|twisted)
-menu = magenta:.*weapon.* (bloodstained|shimmering|warped|crystal)
-menu = magenta:.*weapon.* (jewelled|transparent|encrusted|pitted|slimy)
-menu = magenta:.*weapon.* (polished|fine|crude|ancient|ichor-stained)
-menu = magenta:.*weapon.* (steaming|shiny|polka-dotted)
-menu = magenta:.*weapon.* (golden|purple|bone|serpentine|ruby|chunky)
-menu = magenta:.*weapon.* (thin|green|ivory|ephemeral|blackened)
-menu = magenta:.*weapon.* (sapphire|rusty|blue|brutal|adamantine|ebony)
-menu = magenta:.*weapon.* (mangy|mithril|black|very long|steel|tiny)
-menu = magenta:.*weapon.* flaming crossbow
-
-# Unidentified armour artefacts
-#
-menu = lightgrey:.*armour.* jewelled helm(et)?
-menu = magenta:.*armour.* ((brightly|faintly) glowing|smoking|twisted)
-menu = magenta:.*armour.* (bloodstained|shimmering|warped|heavily runed)
-menu = magenta:.*armour.* (jewelled|transparent|encrusted|pitted|slimy)
-menu = magenta:.*armour.* (polished|fine|crude|ancient|ichor-stained)
-menu = magenta:.*armour.* (steaming|distressingly furry|plaid|tie-dyed)
-menu = magenta:.*armour.* (dull|golden|silk|tattered|round|bronze)
-menu = magenta:.*armour.* (fabulously|vibrating|soft|smelly|red|thick)
-menu = magenta:.*armour.* (weird-looking|blue|black|dirty|paisley)
-menu = magenta:.*armour.* (chartreuse)
-
-# Unidentified jewellery artefacts
-#
-menu = magenta:.*jewellery.* ((brightly|faintly) glowing|smoking)
-menu = magenta:.*jewellery.* (shimmering|warped|crystal|diamond)
-menu = magenta:.*jewellery.* (transparent|pitted|slimy|polished|fine)
-menu = magenta:.*jewellery.* (crude|ancient|steaming|scintillating)
-menu = magenta:.*jewellery.* (sparkling|flickering|glittering)
-menu = magenta:.*jewellery.* (black |blood-stained|cast-iron)
-menu = magenta:.*jewellery.* (phosphorescent)
-menu = magenta:.*jewellery.* an (encrusted|emerald) (ring|amulet)
-menu = magenta:.*jewellery.* a (runed|twisted|shiny|ruby) (ring|amulet)
-menu = magenta:.*jewellery.* a (sapphire) ring
-menu = magenta:.*jewellery.* a (jade) amulet
+# Artefacts
+menu = white:.*artefact.*
+
+# If Options.menu_colour_prefix_id is set to true, you can
+# differentiate further.
+#menu = white:.*identified.*artefact.*
+#menu = magenta:.*unidentified.*artefact.*
# Possible ego items
#
@@ -137,9 +101,8 @@ menu = yellow:.*potion.*(porridge|gluggy white)
# Defaults for normal items
#
-menu = lightgreen:uncursed.*\(.*(worn|neck|hand|weapon).*\)
-menu = lightred:cursed.*\(.*(worn|neck|hand|weapon).*\)
-menu = white:\(.*(worn|neck|hand|weapon).*\)
+menu = lightred:.*equipped.*cursed
+menu = lightgreen:.*equipped.*
menu = green:uncursed
menu = red:cursed
menu = lightgrey:^(scroll|potion|ring|amulet)
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index c1f211caac..db47d0442c 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -458,8 +458,10 @@ void list_armour()
(i == EQ_SHIELD) ? "Shield " :
(i == EQ_BODY_ARMOUR) ? "Armour " :
(i == EQ_BOOTS) ?
- ((you.species == SP_CENTAUR || you.species == SP_NAGA) ?
- "Barding" : "Boots ") : "unknown")
+ ((you.species == SP_CENTAUR
+ || you.species == SP_NAGA) ? "Barding"
+ : "Boots ")
+ : "unknown")
<< " : ";
if (armour_id != -1)
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 9423d9bf8c..18007cd6ea 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -1645,21 +1645,48 @@ std::string get_item_description( const item_def &item, bool verbose,
description << "It looks nice and ripe.";
else
{
- description << "In fact, it is "
- "rotting away before your eyes.";
+ description << "In fact, it is rotting away before your "
+ "eyes.";
- if (you.is_undead != US_UNDEAD
- && you.species != SP_VAMPIRE)
+ if (!you.is_undead
+ && !player_mutation_level(MUT_SAPROVOROUS))
{
- description << " Eating it would "
- "probably be unwise.";
+ description << " Eating it is completely out of the "
+ "question!";
}
}
}
else if (player_mutation_level(MUT_SAPROVOROUS) < 3)
description << "It looks rather unpleasant.";
+ switch (mons_corpse_effect(item.plus))
+ {
+ case CE_POISONOUS:
+ description << "$$This meat is poisonous.";
+ break;
+ case CE_MUTAGEN_RANDOM:
+ if (you.species != SP_GHOUL)
+ {
+ description << "$$Eating this meat will cause random "
+ "mutations.";
+ }
+ break;
+ case CE_HCL:
+ if (you.species != SP_GHOUL)
+ description << "$$Eating this meat will cause rotting.";
+ break;
+ case CE_CONTAMINATED:
+ if (player_mutation_level(MUT_SAPROVOROUS) < 3)
+ {
+ description << "$$Chunks like this may occasionally cause "
+ "sickness.";
+ }
+ break;
+ default:
+ break;
+ }
description << "$";
+
}
break;
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index 00cbf52926..d63f7cca1d 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -1634,6 +1634,97 @@ void vampire_nutrition_per_turn(const item_def &corpse, int feeding)
lessen_hunger(food_value / duration, !start_feeding);
}
+bool is_poisonous(const item_def &food)
+{
+ if (food.base_type != OBJ_FOOD && food.base_type != OBJ_CORPSES)
+ return (false);
+
+ return (mons_corpse_effect(food.plus) == CE_POISONOUS);
+}
+
+bool is_mutagenic(const item_def &food)
+{
+ if (food.base_type != OBJ_FOOD || food.base_type != OBJ_CORPSES)
+ return (false);
+
+ return (mons_corpse_effect(food.plus) == CE_MUTAGEN_RANDOM);
+}
+
+bool is_contaminated(const item_def &food)
+{
+ if (food.base_type != OBJ_FOOD || food.base_type != OBJ_CORPSES)
+ return (false);
+
+ return (mons_corpse_effect(food.plus) == CE_CONTAMINATED);
+}
+
+bool causes_rot(const item_def &food)
+{
+ if (food.base_type != OBJ_FOOD || food.sub_type != FOOD_CHUNK)
+ return (false);
+
+ return (mons_corpse_effect(food.plus) == CE_HCL);
+}
+
+// Returns 1 for herbivores, -1 for carnivores and 0 for either.
+static int _player_likes_food_type(int food_type)
+{
+ switch (food_type)
+ {
+ case FOOD_BREAD_RATION:
+ case FOOD_PEAR:
+ case FOOD_APPLE:
+ case FOOD_CHOKO:
+ case FOOD_SNOZZCUMBER:
+ case FOOD_PIZZA:
+ case FOOD_APRICOT:
+ case FOOD_ORANGE:
+ case FOOD_BANANA:
+ case FOOD_STRAWBERRY:
+ case FOOD_RAMBUTAN:
+ case FOOD_LEMON:
+ case FOOD_GRAPE:
+ case FOOD_SULTANA:
+ case FOOD_LYCHEE:
+ case FOOD_CHEESE:
+ return 1;
+
+ case FOOD_CHUNK:
+ case FOOD_MEAT_RATION:
+ case FOOD_SAUSAGE:
+ return -1;
+ }
+
+ // Anything missing?
+ return 0;
+}
+
+// As we want to avoid autocolouring the entire food selection, this should
+// be restricted to the absolute highlights, even though other stuff may
+// still be edible or even delicious.
+bool is_preferred_food(const item_def &food)
+{
+ if (food.base_type != OBJ_FOOD)
+ return (false);
+
+ // Honeycombs are tasty for everyone.
+ if (food.sub_type == FOOD_HONEYCOMB || food.sub_type == FOOD_ROYAL_JELLY)
+ return (true);
+
+ // Ghouls specifically like rotten food.
+ if (you.species == SP_GHOUL)
+ return (food_is_rotten(food));
+
+ if (player_mutation_level(MUT_CARNIVOROUS) == 3)
+ return (_player_likes_food_type(food.sub_type) < 0);
+
+ if (player_mutation_level(MUT_HERBIVOROUS) == 3)
+ return (_player_likes_food_type(food.sub_type) > 0);
+
+ // No food preference.
+ return (false);
+}
+
bool can_ingest(int what_isit, int kindof_thing, bool suppress_msg, bool reqid,
bool check_hunger)
{
@@ -1685,6 +1776,7 @@ bool can_ingest(int what_isit, int kindof_thing, bool suppress_msg, bool reqid,
switch (what_isit)
{
case OBJ_FOOD:
+ {
if (you.species == SP_VAMPIRE)
{
if (!suppress_msg)
@@ -1692,43 +1784,32 @@ bool can_ingest(int what_isit, int kindof_thing, bool suppress_msg, bool reqid,
return false;
}
- switch (kindof_thing)
+ int vorous = _player_likes_food_type(kindof_thing);
+ if (vorous > 0) // Herbivorous food.
{
- case FOOD_BREAD_RATION:
- case FOOD_PEAR:
- case FOOD_APPLE:
- case FOOD_CHOKO:
- case FOOD_SNOZZCUMBER:
- case FOOD_PIZZA:
- case FOOD_APRICOT:
- case FOOD_ORANGE:
- case FOOD_BANANA:
- case FOOD_STRAWBERRY:
- case FOOD_RAMBUTAN:
- case FOOD_LEMON:
- case FOOD_GRAPE:
- case FOOD_SULTANA:
- case FOOD_LYCHEE:
- case FOOD_CHEESE:
if (ur_carnivorous)
{
- survey_says = false;
if (!suppress_msg)
mpr("Sorry, you're a carnivore.");
+ return (false);
}
else
- survey_says = true;
- break;
-
- case FOOD_CHUNK:
+ return (true);
+ }
+ else if (vorous < 0) // Carnivorous food.
+ {
if (ur_herbivorous)
{
- survey_says = false;
if (!suppress_msg)
mpr("You can't eat raw meat!");
+ return (false);
}
- else if (!ur_chunkslover)
+ else if (kindof_thing == FOOD_CHUNK)
{
+ if (ur_chunkslover)
+ return (true);
+
+ // Else, we're not hungry enough.
if (wearing_amulet(AMU_THE_GOURMAND, !reqid))
{
const int amulet = you.equip[EQ_AMULET];
@@ -1742,21 +1823,17 @@ bool can_ingest(int what_isit, int kindof_thing, bool suppress_msg, bool reqid,
ID_KNOWN_TYPE );
mpr(you.inv[amulet].name(DESC_INVENTORY, false).c_str());
}
- return true;
+ return (true);
}
- survey_says = false;
if (!suppress_msg)
mpr("You aren't quite hungry enough to eat that!");
+ return (false);
}
- else
- survey_says = true;
- break;
-
- default:
- return (true);
}
- break;
-
+ // Any food types not specifically handled until here (e.g. meat
+ // rations for non-herbivores) are okay.
+ return (true);
+ }
case OBJ_CORPSES:
if (you.species == SP_VAMPIRE)
{
@@ -1821,7 +1898,7 @@ bool can_ingest(int what_isit, int kindof_thing, bool suppress_msg, bool reqid,
return (survey_says);
} // end can_ingest()
-// see if you can follow along here -- except for the Amulet of the Gourmand
+// See if you can follow along here -- except for the Amulet of the Gourmand
// addition (long missing and requested), what follows is an expansion of how
// chunks were handled in the codebase up to this date ... {dlb}
static int _determine_chunk_effect(int which_chunk_type, bool rotten_chunk)
@@ -1866,7 +1943,7 @@ static int _determine_chunk_effect(int which_chunk_type, bool rotten_chunk)
break;
}
- // determine effects of rotting on base chunk effect {dlb}:
+ // Determine effects of rotting on base chunk effect {dlb}:
if (rotten_chunk)
{
switch (this_chunk_effect)
diff --git a/crawl-ref/source/food.h b/crawl-ref/source/food.h
index 3257ed26f8..0fffa89981 100644
--- a/crawl-ref/source/food.h
+++ b/crawl-ref/source/food.h
@@ -83,6 +83,12 @@ void set_hunger(int new_hunger_level, bool suppress_msg);
* *********************************************************************** */
void weapon_switch( int targ );
+bool is_poisonous(const item_def &food);
+bool is_mutagenic(const item_def &food);
+bool is_contaminated(const item_def &food);
+bool causes_rot(const item_def &food);
+bool is_preferred_food(const item_def &food);
+
bool can_ingest(int what_isit, int kindof_thing, bool suppress_msg,
bool reqid = false, bool check_hunger = true);
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 2410102252..0df51a676a 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -2512,18 +2512,18 @@ void game_options::read_option_line(const std::string &str, bool runscript)
}
}
// MSVC has a limit on how many if/else if can be chained together.
- /* else */ if (key == "menu_colour" || key == "menu_color")
+ if (key == "menu_colour" || key == "menu_color")
{
std::vector<std::string> seg = split_string(",", field);
for (int i = 0, count = seg.size(); i < count; ++i)
{
- // format: tag:string:colour
+ // Format is "tag:colour:pattern" or "colour:pattern" (default tag).
// FIXME: arrange so that you can use ':' inside a pattern
std::vector<std::string> subseg = split_string(":", seg[i], false);
std::string tagname, patname, colname;
- if ( subseg.size() < 2 )
+ if (subseg.size() < 2)
continue;
- if ( subseg.size() >= 3 )
+ if (subseg.size() >= 3)
{
tagname = subseg[0];
colname = subseg[1];
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index 9ed94b4425..9d8112ba93 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -67,7 +67,43 @@ std::string InvTitle::get_text() const
return titlefn? titlefn( m, MenuEntry::get_text() ) :
MenuEntry::get_text();
}
+/*
+static std::string _get_item_prefix(const item_def &item)
+{
+ std::vector<std::string> prefixes;
+ switch (item.base_type)
+ {
+ case OBJ_FOOD:
+ if (!can_ingest(item.base_type, item.sub_type, true, true, false))
+ prefixes.push_back("inedible");
+
+ // intentional fall-through
+ case OBJ_CORPSES:
+ if (is_poisonous(item) && !player_res_poison())
+ prefixes.push_back("poisonous");
+
+ if (is_mutagenic(item))
+ prefixes.push_back("mutagenic");
+
+ if (is_snack(item))
+ prefixes.push_back("snack");
+ break;
+ case OBJ_WEAPONS:
+ case OBJ_ARMOUR:
+ case OBJ_JEWELLERY:
+ if (item_is_equipped(item))
+ prefixes.push_back("equipped");
+ if (is_artefact(item))
+ prefixes.push_back("artefact");
+ default:
+ break;
+ }
+
+ return comma_separated_line(prefixes.begin(), prefixes.end(),
+ ",", ",");
+}
+*/
InvEntry::InvEntry( const item_def &i ) : MenuEntry( "", MEL_ITEM ), item( &i )
{
data = const_cast<item_def *>( item );
@@ -82,6 +118,9 @@ InvEntry::InvEntry( const item_def &i ) : MenuEntry( "", MEL_ITEM ), item( &i )
else
text = i.name(DESC_NOCAP_A, false);
+// prefix = _get_item_prefix(i);
+// mpr(prefix.c_str());
+
if (i.base_type != OBJ_GOLD && in_inventory(i))
add_hotkey(index_to_letter( i.link ));
else
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 70ecb6fa8f..4b3ca9f252 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -36,6 +36,7 @@
#include "makeitem.h"
#include "mon-util.h"
#include "notes.h"
+#include "player.h"
#include "quiver.h"
#include "randart.h"
#include "skills2.h"
@@ -2150,7 +2151,7 @@ bool is_interesting_item( const item_def& item )
const std::string menu_colour_item_prefix(const item_def &item)
{
- std::string str = "";
+ std::vector<std::string> prefixes;
if (Options.menu_colour_prefix_id)
{
@@ -2158,7 +2159,7 @@ const std::string menu_colour_item_prefix(const item_def &item)
|| item.base_type == OBJ_FOOD
|| item.base_type == OBJ_CORPSES)
{
- str += "identified ";
+ prefixes.push_back("identified");
}
else
{
@@ -2168,7 +2169,8 @@ const std::string menu_colour_item_prefix(const item_def &item)
// Wands are only fully identified if we know the
// number of charges.
if (item.base_type == OBJ_WANDS)
- str += "known ";
+ prefixes.push_back("known");
+
// Rings are fully identified simply by knowing their
// type, unless the ring has plusses, like a ring of
// dexterity.
@@ -2176,26 +2178,62 @@ const std::string menu_colour_item_prefix(const item_def &item)
&& !jewellery_is_amulet(item))
{
if (item.plus == 0 && item.plus2 == 0)
- str += "identified ";
+ prefixes.push_back("identified");
else
- str += "known ";
+ prefixes.push_back("known");
}
// All other types of magical items are fully identified
// simply by knowing the type
else
- str += "identified ";
+ prefixes.push_back("identified");
}
else
- str += "unidentified ";
+ prefixes.push_back("unidentified");
}
}
- if (Options.menu_colour_prefix_class)
+ switch (item.base_type)
{
- str += item_class_name(item.base_type, true) + " ";
+ case OBJ_FOOD:
+ if (!can_ingest(item.base_type, item.sub_type, true, true, false)
+ || food_is_rotten(item)
+ && !player_mutation_level(MUT_SAPROVOROUS))
+ {
+ prefixes.push_back("inedible");
+ }
+ else if (is_preferred_food(item))
+ prefixes.push_back("preferred");
+
+ // intentional fall-through
+ case OBJ_CORPSES:
+ if (is_poisonous(item) && !player_res_poison())
+ prefixes.push_back("poisonous");
+ else if (is_mutagenic(item))
+ prefixes.push_back("mutagenic");
+ else if (is_contaminated(item))
+ prefixes.push_back("contaminated");
+ else if (causes_rot(item))
+ prefixes.push_back("rot-inducing");
+ break;
+
+ case OBJ_WEAPONS:
+ case OBJ_ARMOUR:
+ case OBJ_JEWELLERY:
+ if (item_is_equipped(item))
+ prefixes.push_back("equipped");
+ if (is_artefact(item))
+ prefixes.push_back("artefact");
+ default:
+ break;
}
- return str;
+ if (Options.menu_colour_prefix_class)
+ prefixes.push_back(item_class_name(item.base_type, true));
+
+ std::string result = comma_separated_line(prefixes.begin(), prefixes.end(),
+ " ", " ");
+
+ return result;
}
typedef std::map<std::string, item_types_pair> item_names_map;
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index c8f20d1cf0..a8a7d9811c 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -837,7 +837,6 @@ static void _pickup_menu(int item_link)
redraw_screen();
for (int i = 0, count = selected.size(); i < count; ++i)
- {
for (int j = item_link; j != NON_ITEM; j = mitm[j].link)
{
if (&mitm[j] == selected[i].item)
@@ -870,7 +869,6 @@ static void _pickup_menu(int item_link)
break;
}
}
- }
}
bool origin_known(const item_def &item)
diff --git a/crawl-ref/source/menu.h b/crawl-ref/source/menu.h
index 652a68cd87..fdb1ff2ba2 100644
--- a/crawl-ref/source/menu.h
+++ b/crawl-ref/source/menu.h
@@ -74,7 +74,7 @@ struct MenuEntry
MenuEntry( const std::string &txt = std::string(),
MenuEntryLevel lev = MEL_ITEM,
- int qty = 0,
+ int qty = 0,
int hotk = 0 ) :
text(txt), quantity(qty), selected_qty(0), colour(-1),
hotkeys(), level(lev), data(NULL)
@@ -105,7 +105,7 @@ struct MenuEntry
bool is_primary_hotkey( int key ) const
{
- return hotkeys.size()? hotkeys[0] == key : false;
+ return (hotkeys.size()? hotkeys[0] == key : false);
}
virtual std::string get_text() const
@@ -127,7 +127,7 @@ struct MenuEntry
virtual bool selected() const
{
- return selected_qty > 0 && quantity;
+ return (selected_qty > 0 && quantity);
}
virtual void select( int qty = -1 )
@@ -135,7 +135,7 @@ struct MenuEntry
if (selected())
selected_qty = 0;
else if (quantity)
- selected_qty = qty == -1? quantity : qty;
+ selected_qty = (qty == -1? quantity : qty);
}
};
diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc
index 998a402315..009a7d789f 100644
--- a/crawl-ref/source/message.cc
+++ b/crawl-ref/source/message.cc
@@ -604,7 +604,7 @@ static int prepare_message(const std::string& imsg, msg_channel_type channel,
= Options.message_colour_mappings;
typedef std::vector<message_colour_mapping>::const_iterator mcmci;
- for ( mcmci ci = mcm.begin(); ci != mcm.end(); ++ci )
+ for (mcmci ci = mcm.begin(); ci != mcm.end(); ++ci)
{
if (ci->message.is_filtered(channel, imsg))
{
@@ -613,7 +613,7 @@ static int prepare_message(const std::string& imsg, msg_channel_type channel,
}
}
- if ( colour != MSGCOL_MUTED )
+ if (colour != MSGCOL_MUTED)
{
mpr_check_patterns(imsg, channel, param);
flush_input_buffer( FLUSH_ON_MESSAGE );
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index 2ffebbe20c..215d41e16b 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -65,8 +65,8 @@ bool grid_compatible(dungeon_feature_type grid_wanted,
if (grid_wanted == DNGN_FLOOR)
{
return (actual_grid >= DNGN_FLOOR
- && actual_grid != DNGN_BUILDER_SPECIAL_WALL
- || !generation && actual_grid == DNGN_SHALLOW_WATER);
+ && actual_grid != DNGN_BUILDER_SPECIAL_WALL
+ || !generation && actual_grid == DNGN_SHALLOW_WATER);
}
if (grid_wanted >= DNGN_ROCK_WALL
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index bd026800e8..cc1d679618 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -1473,13 +1473,13 @@ int player_res_poison(bool calc_unid, bool temp)
if (you.species == SP_VAMPIRE && you.hunger_state < HS_SATIATED)
rp++;
- /* rings of poison resistance */
+ // rings of poison resistance
rp += player_equip( EQ_RINGS, RING_POISON_RESISTANCE, calc_unid );
- /* Staves */
+ // Staves
rp += player_equip( EQ_STAFF, STAFF_POISON, calc_unid );
- /* the staff of Olgreb: */
+ // the staff of Olgreb:
if (you.equip[EQ_WEAPON] != -1
&& you.inv[you.equip[EQ_WEAPON]].base_type == OBJ_WEAPONS
&& you.inv[you.equip[EQ_WEAPON]].special == SPWPN_STAFF_OF_OLGREB)
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 851537ff3d..9734f57534 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -647,8 +647,8 @@ static bool xom_is_good(int sever)
&& !mon->has_ench(ENCH_GLOWING_SHAPESHIFTER,
ENCH_SHAPESHIFTER))
{
- mon->add_ench(coinflip() ? ENCH_SHAPESHIFTER
- : ENCH_GLOWING_SHAPESHIFTER);
+ mon->add_ench(!one_chance_in(3) ? ENCH_SHAPESHIFTER
+ : ENCH_GLOWING_SHAPESHIFTER);
}
done = true;
@@ -844,8 +844,8 @@ static bool xom_is_bad(int sever)
&& !mon->has_ench(ENCH_GLOWING_SHAPESHIFTER,
ENCH_SHAPESHIFTER))
{
- mon->add_ench(coinflip() ? ENCH_SHAPESHIFTER
- : ENCH_GLOWING_SHAPESHIFTER);
+ mon->add_ench(!one_chance_in(3)? ENCH_SHAPESHIFTER
+ : ENCH_GLOWING_SHAPESHIFTER);
}
done = true;