Tweak showmood to be a bit more resilient to invalid data (not that it

should ever show up)
develop
Quietust 2012-01-24 08:10:14 -06:00
parent 6adadb396e
commit 404a9e8876
1 changed files with 2 additions and 2 deletions

@ -174,7 +174,7 @@ DFhackCExport command_result df_showmood (Core * c, vector <string> & parameters
case item_type::BAR: case item_type::BAR:
if (mat_name == "rock") if (mat_name == "rock")
mat_name = "metal"; mat_name = "metal";
if ((matinfo.mode == MaterialInfo::Inorganic) && (matinfo.inorganic->flags.is_set(inorganic_flags::WAFERS))) if ((matinfo.inorganic) && (matinfo.inorganic->flags.is_set(inorganic_flags::WAFERS)))
c->con.print("%s wafers", mat_name.c_str()); c->con.print("%s wafers", mat_name.c_str());
else else
c->con.print("%s bars", mat_name.c_str()); c->con.print("%s bars", mat_name.c_str());
@ -228,7 +228,7 @@ DFhackCExport command_result df_showmood (Core * c, vector <string> & parameters
break; break;
default: default:
c->con.print("item %s:%s with flags %08x,%08x,%08x", c->con.print("item %s:%s with flags %08x,%08x,%08x",
df::enums::item_type::get_key(item->item_type), ENUM_KEY_STR(item_type, item->item_type),
(item->item_subtype == -1) ? "NONE" : "???", (item->item_subtype == -1) ? "NONE" : "???",
item->flags1.whole, item->flags1.whole,
item->flags2.whole, item->flags2.whole,