From a58a5788137ad5c8e81286c534ade1e82840041c Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Mon, 14 Sep 2009 14:25:03 +0000 Subject: 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 --- crawl-ref/source/tilereg.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/tilereg.cc') 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; -- cgit v1.2.3-54-g00ecf