Attached Files:
|
crawl-label_edibility.diff [^] (6,794 bytes) 2011-10-09 16:58 [Show Content] [Hide Content]commit 8b3d114f0e40c720e21c1c670dee1fe0794d809f
Author: Neil Moore <neil@s-z.org>
Date: Sun Oct 9 10:44:46 2011 -0400
Make food edibility labelling an option.
The option is label_edibility and values are "true" (long labels as
before), "short" (five-to-six-character labels), and "none" (no labels
at all). For the moment it's with the autoinscription options.
diff --git a/crawl-ref/docs/options_guide.txt b/crawl-ref/docs/options_guide.txt
index a674edc..aeec5eb 100644
--- a/crawl-ref/docs/options_guide.txt
+++ b/crawl-ref/docs/options_guide.txt
@@ -69,7 +69,7 @@ The contents of this text are:
show_inventory_weights, show_newturn_mark, show_gold_turns,
show_game_turns, show_beam, item_stack_summary_minimum,
list_rotten, mlist_min_height, msg_min_height, msg_max_height,
- messages_at_top, show_no_ctele, skill_focus
+ messages_at_top, show_no_ctele, skill_focus,
mlist_allow_alternate_layout, mlist_targetting, classic_hud,
menu_colour, menu_colour_prefix_class, menu_colour_shops,
message_colour, force_more_message,
@@ -83,7 +83,8 @@ The contents of this text are:
monster_damage, rotten_meat, equipment, floor, multiturn,
examine, examine_filter, diagnostics, error, tutorial
4-m Inscriptions.
- autoinscribe, autoinscribe_artefacts, autoinscribe_cursed
+ autoinscribe, autoinscribe_artefacts, autoinscribe_cursed,
+ label_edibility
4-n Macro related Options.
flush.failure, flush.command, flush.message,
additional_macro_file, bindkey
@@ -1667,6 +1668,12 @@ autoinscribe_cursed = true
Automatically inscribes items with "was cursed" when using a scroll of
remove curse.
+label_edibility = true
+ Add a false inscription to food indicating the highest satiation
+ level at which it may be eaten. If "short", adds an abbreviated
+ form (ST = starving, VH = very hungry, etc.). This is not a true
+ inscription, and cannot be removed except through this option.
+
4-n Macro related Options.
------------------------------
diff --git a/crawl-ref/settings/init.txt b/crawl-ref/settings/init.txt
index 874cae2..1827fc4 100644
--- a/crawl-ref/settings/init.txt
+++ b/crawl-ref/settings/init.txt
@@ -341,6 +341,7 @@ force_more_message = distant snort
# autoinscribe_artefacts = false
# autoinscribe_cursed = false
# autoinscribe = fruit:!e
+# label_edibility = false
##### 4-n Macro related Options #################
#
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 5941d5e..9df0af9 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -2936,6 +2936,13 @@ enum skill_focus_mode
SKM_FOCUS_TOGGLE,
};
+enum label_edibility_mode
+{
+ OPT_EDLAB_NONE,
+ OPT_EDLAB_LONG,
+ OPT_EDLAB_SHORT
+};
+
// order is important on these (see player_speed())
enum speed_type
{
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 6cdeea8..0430bf4 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -1022,6 +1022,7 @@ void game_options::reset_options()
autoinscriptions.clear();
autoinscribe_artefacts = true;
autoinscribe_cursed = true;
+ label_edibility = OPT_EDLAB_LONG;
note_items.clear();
note_skill_levels.clear();
auto_spell_letters.clear();
@@ -2635,6 +2636,15 @@ void game_options::read_option_line(const std::string &str, bool runscript)
}
else BOOL_OPTION(autoinscribe_artefacts);
else BOOL_OPTION(autoinscribe_cursed);
+ else if (key == "label_edibility")
+ {
+ if (field == "short")
+ label_edibility = OPT_EDLAB_SHORT;
+ else if (field == "none" || !_read_bool(field, true))
+ label_edibility = OPT_EDLAB_NONE;
+ else
+ label_edibility = OPT_EDLAB_LONG;
+ }
#ifndef DGAMELAUNCH
else if (key == "map_file_name")
map_file_name = field;
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index bbe090a..0cab8b4 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -345,23 +345,28 @@ std::string item_def::name(description_level_type descrip,
if (tried)
insparts.push_back(tried_str);
- if (this->base_type == OBJ_FOOD)
+ if (Options.label_edibility != OPT_EDLAB_NONE
+ && this->base_type == OBJ_FOOD)
{
std::string sat;
+ std::string ssat;
switch (maximum_satiation(*this))
{
- case HS_STARVING: sat = "starving"; break;
- case HS_NEAR_STARVING: sat = "near starving"; break;
- case HS_VERY_HUNGRY: sat = "very hungry"; break;
- case HS_HUNGRY: sat = "hungry"; break;
- case HS_SATIATED: sat = "satiated"; break;
- case HS_FULL: sat = "full"; break;
- case HS_VERY_FULL: sat = "very full"; break;
- case HS_ENGORGED: sat = "engorged"; break;
+ case HS_STARVING: sat = "starving"; ssat = "ST"; break;
+ case HS_NEAR_STARVING: sat = "near starving"; ssat = "NS"; break;
+ case HS_VERY_HUNGRY: sat = "very hungry"; ssat = "VH"; break;
+ case HS_HUNGRY: sat = "hungry"; ssat = "H"; break;
+ case HS_SATIATED: sat = "satiated"; ssat = "S"; break;
+ case HS_FULL: sat = "full"; ssat = "F"; break;
+ case HS_VERY_FULL: sat = "very full"; ssat = "VF"; break;
+ case HS_ENGORGED: sat = "engorged"; ssat = "E"; break;
}
- insparts.push_back("edible when "+sat);
+ if (Options.label_edibility == OPT_EDLAB_SHORT)
+ insparts.push_back("eat:"+ssat);
+ else // OPT_EDLAB_LONG
+ insparts.push_back("edible when "+sat);
}
if (with_inscription && !(this->inscription.empty()))
diff --git a/crawl-ref/source/options.h b/crawl-ref/source/options.h
index 2b8058f..e7bd34a 100644
--- a/crawl-ref/source/options.h
+++ b/crawl-ref/source/options.h
@@ -194,6 +194,8 @@ public:
bool autoinscribe_artefacts; // Auto-inscribe identified artefacts.
bool autoinscribe_cursed; // Auto-inscribe previosly cursed items.
+
+ label_edibility_mode label_edibility; // show edibility labels on food
bool pickup_thrown; // Pickup thrown missiles
bool pickup_dropped; // Pickup dropped objects
|