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-09-14 14:25:03 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-09-14 14:25:03 +0000
commita58a5788137ad5c8e81286c534ade1e82840041c (patch)
tree03b9dd0f4e90dd67c0a0b9cff0b64ef60ef92c15 /crawl-ref/source/tilereg.cc
parentce630aeacdfb03552b7750156df37ff2a3725826 (diff)
downloadcrawl-ref-a58a5788137ad5c8e81286c534ade1e82840041c.tar.gz
crawl-ref-a58a5788137ad5c8e81286c534ade1e82840041c.zip
Fix 2858572: tiles spell memorisation crashes.
Also handles dangerous spellbooks correctly now, prompts and all. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10675 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tilereg.cc')
-rw-r--r--crawl-ref/source/tilereg.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index 608f174b13..b5892abc37 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -1789,7 +1789,7 @@ void InventoryRegion::pack_buffers()
add_quad_char('0' + c1, x, y, offset_x, offset_y);
}
- if (item.special)
+ if (Options.tile_display == TDSP_INVENT && item.special)
m_buf_main.add(item.special, x, y, 0, 0, false);
if (item.flag & TILEI_FLAG_TRIED)
@@ -1831,9 +1831,9 @@ void InventoryRegion::place_cursor(const coord_def &cursor)
m_dirty = true;
}
-static int _handle_spells_mouse(MouseEvent &event, int idx, int item_idx)
+int InventoryRegion::handle_spells_mouse(MouseEvent &event, int item_idx)
{
- const spell_type spell = (spell_type) idx;
+ const spell_type spell = (spell_type) m_items[item_idx].idx;
if (event.button == MouseEvent::LEFT)
{
if (spell == NUM_SPELLS)
@@ -1862,7 +1862,7 @@ static int _handle_spells_mouse(MouseEvent &event, int idx, int item_idx)
{
you.last_clicked_item = item_idx;
tiles.set_need_redraw();
- if (!learn_spell(spell))
+ if (!learn_spell(spell, m_items[item_idx].special))
flush_input_buffer( FLUSH_ON_FAILURE );
// if (!can_learn_spell(true) || !has_spells_to_memorise())
@@ -1910,7 +1910,7 @@ int InventoryRegion::handle_mouse(MouseEvent &event)
int idx = m_items[item_idx].idx;
if (m_items[item_idx].key == 0 && Options.tile_display != TDSP_INVENT)
- return _handle_spells_mouse(event, idx, item_idx);
+ return handle_spells_mouse(event, item_idx);
bool on_floor = m_items[item_idx].flag & TILEI_FLAG_FLOOR;