summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/tilereg.cc3
-rw-r--r--crawl-ref/source/tiles.h15
-rw-r--r--crawl-ref/source/tilesdl.cc28
3 files changed, 29 insertions, 17 deletions
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index 479f3a58a9..53946df599 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -1338,6 +1338,9 @@ void InventoryRegion::pack_verts()
if (item.flag & TILEI_FLAG_TRIED)
add_quad(TEX_DEFAULT, TILE_TRIED, x, y, 0, TILE_Y / 2, false);
+
+ if (item.flag & TILEI_FLAG_INVALID)
+ add_quad(TEX_DEFAULT, TILE_MESH, x, y);
}
}
}
diff --git a/crawl-ref/source/tiles.h b/crawl-ref/source/tiles.h
index eaa6c5c10f..b3ce5cf2cf 100644
--- a/crawl-ref/source/tiles.h
+++ b/crawl-ref/source/tiles.h
@@ -173,13 +173,14 @@ enum tile_flags
enum
{
- TILEI_FLAG_SELECT = 0x0100,
- TILEI_FLAG_TRIED = 0x0200,
- TILEI_FLAG_EQUIP = 0x0400,
- TILEI_FLAG_FLOOR = 0x0800,
- TILEI_FLAG_CURSE = 0x1000,
- TILEI_FLAG_CURSOR = 0x2000,
- TILEI_FLAG_MELDED = 0x4000
+ TILEI_FLAG_SELECT = 0x0100,
+ TILEI_FLAG_TRIED = 0x0200,
+ TILEI_FLAG_EQUIP = 0x0400,
+ TILEI_FLAG_FLOOR = 0x0800,
+ TILEI_FLAG_CURSE = 0x1000,
+ TILEI_FLAG_CURSOR = 0x2000,
+ TILEI_FLAG_MELDED = 0x4000,
+ TILEI_FLAG_INVALID = 0x8000
};
enum
diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc
index 2985abd18d..64f7e8d5b0 100644
--- a/crawl-ref/source/tilesdl.cc
+++ b/crawl-ref/source/tilesdl.cc
@@ -1179,19 +1179,20 @@ void TilesFramework::update_inventory()
// item.base_type <-> char conversion table
const static char *obj_syms = ")([/%#?=!#+\\0}x";
- const unsigned int mx = m_region_self_inv->mx;
- const unsigned int my = m_region_self_inv->my;
+ const int mx = m_region_self_inv->mx;
+ const int my = m_region_self_inv->my;
- unsigned int max_pack_row = (ENDOFPACK-1) / mx + 1;
- unsigned int max_pack_items = max_pack_row * mx;
+ int max_pack_row = (ENDOFPACK-1) / mx + 1;
+ int max_pack_items = max_pack_row * mx;
- unsigned int num_ground = 0;
+ int num_ground = 0;
for (int i = igrd(you.pos()); i != NON_ITEM; i = mitm[i].link)
num_ground++;
// If the inventory is full, show at least one row of the ground.
- unsigned int min_ground = std::min(num_ground, mx);
+ int min_ground = std::min(num_ground, mx);
max_pack_items = std::min(max_pack_items, mx * my - min_ground);
+ max_pack_items = std::min(ENDOFPACK, max_pack_items);
for (unsigned int c = 0; c < strlen(Options.tile_show_items); c++)
{
@@ -1234,19 +1235,21 @@ void TilesFramework::update_inventory()
}
}
- int remaining = mx*my- inv.size();
+ int remaining = mx*my - inv.size();
int empty_on_this_row = mx - inv.size() % mx;
// If we're not on the last row...
if (inv.size() < mx * (my-1))
{
- if ((int)num_ground > remaining - empty_on_this_row)
+ if (num_ground > remaining - empty_on_this_row)
{
// Fill out part of this row.
int fill = remaining - num_ground;
for (int i = 0; i < fill; i++)
{
InventoryTile desc;
+ if (inv.size() >= max_pack_items)
+ desc.flag |= TILEI_FLAG_INVALID;
inv.push_back(desc);
}
}
@@ -1256,18 +1259,23 @@ void TilesFramework::update_inventory()
while (inv.size() % mx != 0)
{
InventoryTile desc;
+ if (inv.size() >= max_pack_items)
+ desc.flag |= TILEI_FLAG_INVALID;
inv.push_back(desc);
}
// Add extra rows, if needed.
unsigned int ground_rows =
- std::max(((int)num_ground-1) / (int)mx + 1, 1);
+ std::max((num_ground-1) / mx + 1, 1);
- while (inv.size() / mx + ground_rows < my)
+ while (inv.size() / mx + ground_rows < my
+ && inv.size() < max_pack_items)
{
for (unsigned int i = 0; i < mx; i++)
{
InventoryTile desc;
+ if (inv.size() >= max_pack_items)
+ desc.flag |= TILEI_FLAG_INVALID;
inv.push_back(desc);
}
}