summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-30 19:13:17 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-30 19:13:17 +0000
commitf4bb02dd66fdf77bfd0ec304e4ae160a27916f42 (patch)
tree3548083ff164b98e4d59b36050241d64921dbe3a
parent5277bf424bbd6aeab3d8296ce68695717cfff9ed (diff)
downloadcrawl-ref-f4bb02dd66fdf77bfd0ec304e4ae160a27916f42.tar.gz
crawl-ref-f4bb02dd66fdf77bfd0ec304e4ae160a27916f42.zip
* AutoID rings of teleport control after teleporting.
* Fix 2788773: Infinite scroll uses by clicking on a stack in tiles. * Fix 2792095: Tiled menus possibly containing more than 52 items. * Fix clicking on items not setting just_clicked_on_item until after the effect happened. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9853 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/misc.cc35
-rw-r--r--crawl-ref/source/misc.h2
-rw-r--r--crawl-ref/source/spells1.cc1
-rw-r--r--crawl-ref/source/spells3.cc8
-rw-r--r--crawl-ref/source/stuff.cc1
-rw-r--r--crawl-ref/source/tilereg.cc9
6 files changed, 54 insertions, 2 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 2c181471ca..4ddd53ca1a 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -3184,3 +3184,38 @@ void swap_with_monster(monsters *mon_to_swap)
mon.del_ench(ENCH_HELD, true);
}
}
+
+// AutoID an equipped ring of teleport.
+// Code copied from fire/ice in spl-cast.cc
+void maybe_id_ring_TC()
+{
+ if (player_mutation_level(MUT_TELEPORT_CONTROL))
+ return;
+
+ int num_unknown = 0;
+ for (int i = EQ_LEFT_RING; i <= EQ_RIGHT_RING; ++i)
+ {
+ if (player_wearing_slot(i)
+ && !item_ident(you.inv[you.equip[i]], ISFLAG_KNOW_PROPERTIES))
+ {
+ ++num_unknown;
+ }
+ }
+
+ if (num_unknown != 1)
+ return;
+
+ for (int i = EQ_LEFT_RING; i <= EQ_RIGHT_RING; ++i)
+ if (player_wearing_slot(i))
+ {
+ item_def& ring = you.inv[you.equip[i]];
+ if (!item_ident(ring, ISFLAG_KNOW_PROPERTIES)
+ && ring.sub_type == RING_TELEPORT_CONTROL)
+ {
+ set_ident_type( ring.base_type, ring.sub_type, ID_KNOWN_TYPE );
+ set_ident_flags(ring, ISFLAG_KNOW_PROPERTIES);
+ mprf("You are wearing: %s",
+ ring.name(DESC_INVENTORY_EQUIP).c_str());
+ }
+ }
+}
diff --git a/crawl-ref/source/misc.h b/crawl-ref/source/misc.h
index e65afcd99b..6149bc8e0d 100644
--- a/crawl-ref/source/misc.h
+++ b/crawl-ref/source/misc.h
@@ -117,4 +117,6 @@ bool is_orckind(const actor *act);
bool is_dragonkind(const actor *act);
void swap_with_monster(monsters *mon_to_swap);
+
+void maybe_id_ring_TC();
#endif
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index 4e0aad24eb..6dceab91c7 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -221,6 +221,7 @@ void random_blink(bool allow_partial_control, bool override_abyss)
{
mpr("You may select the general direction of your translocation.");
cast_semi_controlled_blink(100);
+ maybe_id_ring_TC();
success = true;
}
#endif
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 4797251ab2..b4a4ed0dd4 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -1300,12 +1300,14 @@ static bool _teleport_player( bool allow_control, bool new_abyss_area )
}
coord_def pos(1, 0);
- bool large_change = false;
+ bool large_change = false;
+ bool check_ring_TC = false;
if (is_controlled)
{
mpr("You may choose your destination (press '.' or delete to select).");
mpr("Expect minor deviation.");
+ check_ring_TC = true;
more();
while (true)
@@ -1445,6 +1447,10 @@ static bool _teleport_player( bool allow_control, bool new_abyss_area )
if (large_change)
handle_interrupted_swap(true);
+ // Might identify unknown ring of teleport control.
+ if (check_ring_TC)
+ maybe_id_ring_TC();
+
return !is_controlled;
}
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index 903c73d6f3..6359f10f42 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -460,6 +460,7 @@ void untag_followers()
unsigned char get_ch()
{
+ mouse_control mc(MOUSE_MODE_MORE);
unsigned char gotched = getch();
if (gotched == 0)
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index 11bc7df8da..007f16c99c 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -1510,6 +1510,7 @@ int InventoryRegion::handle_mouse(MouseEvent &event)
if (event.button == MouseEvent::LEFT)
{
+ you.last_clicked_item = item_idx;
if (on_floor)
{
if (event.mod & MOD_SHIFT)
@@ -1526,12 +1527,12 @@ int InventoryRegion::handle_mouse(MouseEvent &event)
else
tile_item_use(idx);
}
- you.last_clicked_item = item_idx;
// TODO enne - need to redraw inventory here?
return CK_MOUSE_CMD;
}
else if (event.button == MouseEvent::RIGHT)
{
+ you.last_clicked_item = item_idx;
if (on_floor)
{
if (event.mod & MOD_SHIFT)
@@ -2831,6 +2832,12 @@ int MenuRegion::maxpagesize() const
int more_height = (lines + 1) * m_font_entry->char_height();
int pagesize = ((my - more_height) / 32) * m_max_columns;
+
+ // Upper limit for inventory menus. (jpeg)
+ // Non-inventory menus only have one column and need
+ // *really* big screens to cover more than 52 lines.
+ if (pagesize > 52)
+ return (52);
return (pagesize);
}