Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old June 11, 2013, 14:34   #1
PowerWyrm
Prophet
 
PowerWyrm's Avatar
 
Join Date: Apr 2008
Posts: 2,762
PowerWyrm is on a distinguished road
ENCODE_KTRL() and auto-pickup (CTRL-G)

Someone reported to me that in my variant, when you pick up gold that a monster dropped under the character with the 'g' command, it is placed as an item in the inventory instead of filling the purse.

I tracked the problem and found something quite intriguing:

- when you pick up something with 'g', there's a keymap stored in pref.prf that translates 'g' as '^Gg' for autopickup + pickup
- when the keymap is parsed in keypress_from_text(), the ctrl-G part is again translated to '\a' by the STORE() macro, which calls ENCODE_KTRL() to see if the value is between 0x40 and 0x5F and then removes 0x40 and KC_MOD_CONTROL from the value
- when the key 'g' is executed, two commands are then processed: '\a' and 'g'
- the '\a' part is discarded by textui_process_key()
- only the 'g' part is processed, which does pickup without autopickup and therefore doesn't process gold correctly, treating it as if it was an item

Since my code is roughly based on V 3.4 (and the problem still exists in my latest source which is based on V3.5-dev), I assume that the bug also exists in V.

Can someone tell me the reason for the STORE/ENCODE_KTRL macros? I don't see why values between 0x40 and 0x5F are different from other values...

Checking playing.txt for the command list, I noted that
- CTRL-I is reserved (special - tab)
- CTRL-J is reserved (special - line feed)
- CTRl-M is reserved (special - return)

This seems related to the ENCODE_KTRL() macro mapping these commands to '\t', '\n' and '\r'. For what I see, CTRL-G should not be used for the same reason. Otherwise, the checks for '\a' should be removed.
__________________
PWMAngband variant maintainer - check http://powerwyrm.monsite-orange.fr (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!
PowerWyrm 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
Close and bash doors with ctrl+direction fph Vanilla 7 September 19, 2011 13:49
Suggestions for pickup command Max Stats Vanilla 0 April 1, 2011 21:31
CTRL + S is not overriden (affects r2041) krugar Vanilla 5 September 26, 2010 15:58
Can't save via ctrl-s in curses mode Therem Harth ToME 6 September 27, 2009 00:15
r1612 bug : auto ID average weapons on pickup with same item in inventory bebo Vanilla 4 August 5, 2009 17:09


All times are GMT +1. The time now is 01:30.


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