Go Back   Angband Forums > Angband > Development

Thread Tools Display Modes
Old April 19, 2019, 02:50   #1
Join Date: Jan 2011
Location: Columbus Ohio USA
Posts: 64
fruviad is on a distinguished road
"List visible monsters" and "List visible items" behavior

This is about a trivial annoyance, but it occurs constantly.

You are playing a mage at depth, in an empty corridor next to a massive crypt. Type '[' to show the monster list and it informs you that you can see no monsters. Then, you absently type ']' twice to flip over to the item list, and the (empty) monster list disappears, having been replaced by the item list.

Now, cast Reveal Monsters. XP from your wildest dreams -- with promise of loot to follow -- is displayed on the other side of that stone wall. You view the monster list with '[' and scan the top of the list, satisfying yourself that it'll be easy.

Then, you type ']' to make the monster list go away like it did 10 seconds before. But that no longer works.

The UI has changed because the monster list now extends past the bottom of your window. You've been shunted to src/ui-output.c, line 195, which handles closing the display of text longer than your window:

   else if (ch.code== ESCAPE || ch.code == 'q')
Ten seconds ago, any key closed your monster list. Suddenly, for arbitrary reasons, you have to hit ESCAPE (or "q") to get out of the monster list.

The UI should be consistent for the user, but this isn't consistent.

Without having done any review of the implications of the change, I tried changing the src/ui-output.c line 195 code to this:

   else if (ch.code == ESCAPE || ch.code == 'q' || ch.code == ']' || ch.code == '[')
I recompiled, tested for all of 30 seconds, and COOL, it worked! Very impressive, given that I don't know what I'm doing.

Then I stepped back and tried to figure out the implications of this. I grepped through files and figured out that the textui_textblock_show() function is used in several of the ui-*.c files, so maybe isn't a good solution?

I've done a little more testing -- but nothing exhaustive -- and it seems as though this doesn't break anything, although I can see why might be a bad thing from a code management perspective to modify the function to suit two specific uses of it.

To my untrained eye, it looks like many of the instances where the function is called are dealing with short amounts of text that wouldn't trigger the above "else if" case. I padded the copyright text (one thing that's displayed using this function) and nothing bad seemed to occur with the function in that context; the altered code simply gave me 2 more keys that would close that text display.

Thoughts? Is this itch even worth scratching? Is this entirely the wrong way to go about it?
fruviad is offline   Reply With Quote
Old April 19, 2019, 02:56   #2
Vanilla maintainer
Nick's Avatar
Join Date: Apr 2007
Location: Canberra, Australia
Age: 56
Posts: 9,356
Donated: $60
Nick will become famous soon enoughNick will become famous soon enough
Looks good at first glance
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bug with "Turn" in the "Player History" dump bron Vanilla 3 January 17, 2014 16:35
Configuring "run" behavior? fruviad Vanilla 6 August 24, 2013 17:46
[3.3.2] Bug in monster list "@ 1 <player>" bunnies Vanilla 2 March 10, 2012 00:10
Improving the monster list "[" buzzkill Development 8 January 2, 2010 10:27
What do you want from the list of visible monsters? Magnate Vanilla 42 January 1, 2010 09:56

All times are GMT +1. The time now is 03:38.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.