summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tilereg.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-01 15:34:21 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-01 15:34:21 +0000
commitd813da0afb4ebeea2c25dbdae36060eee5424d45 (patch)
treecf89e28064ddcd3ebbfdceeb52c2148195b25303 /crawl-ref/source/tilereg.cc
parent057f3edf4f9795595f296d2beb7ed5fa4d8f04c0 (diff)
downloadcrawl-ref-d813da0afb4ebeea2c25dbdae36060eee5424d45.tar.gz
crawl-ref-d813da0afb4ebeea2c25dbdae36060eee5424d45.zip
Apply r9873 to trunk.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9874 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tilereg.cc')
-rw-r--r--crawl-ref/source/tilereg.cc25
1 files changed, 19 insertions, 6 deletions
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index 007f16c99c..3bb15874ae 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -17,6 +17,7 @@ REVISION("$Rev$");
#include "itemname.h"
#include "it_use2.h"
#include "item_use.h"
+#include "items.h"
#include "message.h"
#include "misc.h"
#include "menu.h"
@@ -1315,21 +1316,24 @@ void InventoryRegion::render()
const coord_def min_pos(sx, sy - dy);
const coord_def max_pos(ex, ey);
- std::string desc;
- if (floor)
+ std::string desc = "";
+ if (floor && is_valid_item(mitm[idx]))
desc = mitm[idx].name(DESC_PLAIN);
- else
+ else if (!floor && is_valid_item(you.inv[idx]))
desc = you.inv[idx].name(DESC_INVENTORY_EQUIP);
- m_tag_font->render_string(x, y, desc.c_str(),
- min_pos, max_pos, WHITE, false, 200);
+ if (!desc.empty())
+ {
+ m_tag_font->render_string(x, y, desc.c_str(),
+ min_pos, max_pos, WHITE, false, 200);
+ }
}
}
void InventoryRegion::add_quad_char(char c, int x, int y, int ofs_x, int ofs_y)
{
int num = c - '0';
- assert(num >=0 && num <= 9);
+ assert(num >= 0 && num <= 9);
int idx = TILE_NUM0 + num;
m_buf_main.add(idx, x, y, ofs_x, ofs_y, false);
@@ -1626,6 +1630,9 @@ bool InventoryRegion::update_tip_text(std::string& tip)
{
const item_def &item = mitm[idx];
+ if (!is_valid_item(item))
+ return (false);
+
tip = "";
if (m_items[item_idx].key)
{
@@ -1663,6 +1670,9 @@ bool InventoryRegion::update_tip_text(std::string& tip)
else
{
const item_def &item = you.inv[idx];
+ if (!is_valid_item(item))
+ return (false);
+
tip = item.name(DESC_INVENTORY_EQUIP);
if (!display_actions)
@@ -1860,6 +1870,9 @@ bool InventoryRegion::update_alt_text(std::string &alt)
else
item = &you.inv[idx];
+ if (!is_valid_item(*item))
+ return (false);
+
describe_info inf;
get_item_desc(*item, inf, true);