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 12:32:31 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-09-14 12:32:31 +0000
commit3f413ab79f31be4a7ae0de336ce11329505e7eed (patch)
tree16baa418a4975137cb09df1c51ff34c00179a8ac /crawl-ref/source/tilereg.cc
parent72d421a98654a1d73704397dfd9a4be3177289d0 (diff)
downloadcrawl-ref-3f413ab79f31be4a7ae0de336ce11329505e7eed.tar.gz
crawl-ref-3f413ab79f31be4a7ae0de336ce11329505e7eed.zip
* Show item type shortcuts in inventory. I think it's too intrusive for
ASCII even though it works well in tiles. * Always display memorise button because it's less confusing that way. I still can't work out why the error messages disappear right away. *sighs* * Add a short document on tiles creation. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10673 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tilereg.cc')
-rw-r--r--crawl-ref/source/tilereg.cc37
1 files changed, 27 insertions, 10 deletions
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index cbe24ec1b6..608f174b13 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -1838,8 +1838,17 @@ static int _handle_spells_mouse(MouseEvent &event, int idx, int item_idx)
{
if (spell == NUM_SPELLS)
{
- Options.tile_display = TDSP_MEMORISE;
- tiles.update_inventory();
+ if (can_learn_spell() && has_spells_to_memorise(false))
+ {
+ Options.tile_display = TDSP_MEMORISE;
+ tiles.update_inventory();
+ }
+ else
+ {
+ // FIXME: Doesn't work. The message still disappears instantly!
+ you.last_clicked_item = item_idx;
+ tiles.set_need_redraw();
+ }
return CK_MOUSE_CMD;
}
if (Options.tile_display == TDSP_SPELLS)
@@ -1916,6 +1925,7 @@ int InventoryRegion::handle_mouse(MouseEvent &event)
if (event.button == MouseEvent::LEFT)
{
you.last_clicked_item = item_idx;
+ tiles.set_need_redraw();
if (on_floor)
{
if (event.mod & MOD_SHIFT)
@@ -1937,13 +1947,13 @@ int InventoryRegion::handle_mouse(MouseEvent &event)
}
else if (event.button == MouseEvent::RIGHT)
{
- you.last_clicked_item = item_idx;
if (on_floor)
{
if (event.mod & MOD_SHIFT)
{
- tile_item_eat_floor(idx);
you.last_clicked_item = item_idx;
+ tiles.set_need_redraw();
+ tile_item_eat_floor(idx);
}
else
{
@@ -2017,6 +2027,8 @@ void _update_spell_tip_text(std::string& tip, int flag)
tip = "You cannot cast this spell right now.";
else
tip = "[L-Click] Cast (z)";
+
+ tip += "\n[R-Click] Describe (I)";
}
else if (Options.tile_display == TDSP_MEMORISE)
{
@@ -2024,9 +2036,9 @@ void _update_spell_tip_text(std::string& tip, int flag)
tip = "You don't have enough slots for this spell right now.";
else
tip = "[L-Click] Memorise (M)";
- }
- tip += "\n[R-Click] Describe (I)";
+ tip += "\n[R-Click] Describe";
+ }
}
bool InventoryRegion::update_tip_text(std::string& tip)
@@ -2048,7 +2060,12 @@ bool InventoryRegion::update_tip_text(std::string& tip)
if (display_actions && Options.tile_display != TDSP_INVENT)
{
if (m_items[item_idx].idx == NUM_SPELLS)
- tip = "Memorise spells (M)";
+ {
+ if (m_items[item_idx].flag & TILEI_FLAG_MELDED)
+ tip = "You cannot learn any spells right now.";
+ else
+ tip = "Memorise spells (M)";
+ }
else
_update_spell_tip_text(tip, m_items[item_idx].flag);
return (true);
@@ -2356,7 +2373,7 @@ void MapRegion::on_resize()
delete[] m_buf;
int size = mx * my;
- m_buf = new unsigned char[size];
+ m_buf = new unsigned char[size];
memset(m_buf, 0, sizeof(unsigned char) * size);
}
@@ -3986,8 +4003,8 @@ static void _copy_into(unsigned char *dest, unsigned char *pixels,
int total_ofs_x = inf.offset_x + ofs_x;
int total_ofs_y = inf.offset_y + ofs_y;
- int src_height = inf.ey - inf.sy;
- int src_width = inf.ex - inf.sx;
+ int src_height = inf.ey - inf.sy;
+ int src_width = inf.ex - inf.sx;
if (total_ofs_x < 0)
{