Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old February 27, 2011, 22:15   #1
Max Stats
Swordsman
 
Join Date: Jun 2010
Posts: 324
Max Stats is on a distinguished road
Code snippet to use character class as default filename when saving macros/keymaps

When saving macros and keymaps, I find that it is much more useful to save them to a class pref file instead of one named for my character. This is because macros and keymaps tend to have references to spells, like 'maa' or 'm1a' to cast Magic Missile for mages. I decided to change the default filename when saving macros or keymaps to use the character class.

Here is the change I made. I edited function dump_pref_file in ui-options.c and changed the line:
Code:
       strnfmt(ftmp, sizeof ftmp, "%s.prf", op_ptr->base_name);
to this:
Code:
        if (strcmp(title,"Dump macros")==0 || strcmp(title,"Dump keymaps")==0)
                strnfmt(ftmp, sizeof ftmp, "%s.prf", cp_ptr->name);
        else
                strnfmt(ftmp, sizeof ftmp, "%s.prf", op_ptr->base_name);
This is kind of quick-and-dirty. There might be a more elegant way to test for dumping macros or keymaps, but I didn't want to change more than necessary. Would this be a useful change to make? Do most experienced users do like I do and save macros/keymaps to class-specific pref files?
Max Stats is offline   Reply With Quote
Old February 28, 2011, 00:27   #2
d_m
Angband Devteam member
 
d_m's Avatar
 
Join Date: Aug 2008
Location: Philadelphia, PA, USA
Age: 39
Posts: 1,516
d_m is on a distinguished road
Quote:
Originally Posted by Max Stats View Post
When saving macros and keymaps, I find that it is much more useful to save them to a class pref file instead of one named for my character. This is because macros and keymaps tend to have references to spells, like 'maa' or 'm1a' to cast Magic Missile for mages.
I have a (possibly wrong) idea that there was consensus on this point awhile ago and that Magnate was working on it. I just asked him and Takkaria what they think. It seems like a good idea to me.

If anyone thinks this is a bad idea please speak up.
__________________
linux->xterm->screen->pmacs
d_m is offline   Reply With Quote
Old February 28, 2011, 00:34   #3
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,936
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by d_m View Post
I have a (possibly wrong) idea that there was consensus on this point awhile ago and that Magnate was working on it. I just asked him and Takkaria what they think. It seems like a good idea to me.

If anyone thinks this is a bad idea please speak up.
Seems like a pretty sensible change. Another useful change to make this more future-proof would be to add some kind of marker to the individual keymaps on whether they came from a game pref file or from the user, and then only dump user keymaps to file... kind of independent of the class change, but it would make the pref files a lot cleaner.
__________________
takkaria whispers something about options. -more-
takkaria is offline   Reply With Quote
Old March 16, 2011, 14:05   #4
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,057
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate
Quote:
Originally Posted by d_m View Post
I have a (possibly wrong) idea that there was consensus on this point awhile ago and that Magnate was working on it. I just asked him and Takkaria what they think. It seems like a good idea to me.

If anyone thinks this is a bad idea please speak up.
It seems like an excellent idea in the meantime. I have collected a bunch of tickets about pref files and deem them connected with the whole savefile/knowledge file issue, which is my 2nd highest priority for my dev time - a piece of work which cleans up and organises what gets saved where and when. Unfortunately my highest priority is getting to the rewrite of obj-power.c and that seems to be more important at the moment - though I am willing to reconsider that view.
Magnate is offline   Reply With Quote
Reply


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
(Hopefully) useful code snippet modifies "]" command to highlight unidentified items Max Stats Vanilla 31 January 11, 2011 22:12
Different character class, different game. Fendell Orcbane Vanilla 5 September 16, 2010 18:54
Swap macros / keymaps / inscriptions PaulBlay Vanilla 3 February 24, 2009 16:16
Some questions about macros and keymaps danvari Vanilla 4 August 14, 2008 22:44
Macros/keymaps question Jude Variants 7 November 18, 2007 22:45


All times are GMT +1. The time now is 07:18.


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