Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CF: New Pickup Code Proposal



First, I'll confess,.. I'm already about 80% done with this.  I did it
because I wanted to combine pickup mode 4 (magic) and density 10.  As I
started to research the necessary code, I found the part in the TODO that
said:

- made pickup command more intelligent - you should be able to use
     words or more generic terms for things you want to pickup up.

And it seemed to fit in with what I was going to do.  I present this here
incase anybody has any tweaks, to prevent duplicatation of work and to make
sure there is interest in the main stream of crossfire.

---------------------------------------------------------------------------
First, I didn't want to change any of the structures of objects to implement
this.  I used the existing pickup mode variable.  Some of the
suggestions/tradeoffs I talk about are assuming we want to continue this
policy.

Possible pickup flags are:
    Money - types 36, 60
    Food - types 6, 7, 54
    Magic - types 3, 5, 8, 39, 43, 70, 85, 109, 124 (see below)
    Weapon - types 13, 14, 15
    Armor - types 16, 33, 34, 87, 99, 100
    Equipment - types 24, 75, 122, 221
    Inorganics - type 73
    All - pickup everything every time.
(types are the first run of the list in define.h.  I'm sure I missed a few)

This is accomplished by using the bits of the high byte of "mode" with a 
special case of 0xFF being "all".  I don't use the last of the 8 bits as "all"
to save it for the "magic cheat" I talk about below.  

I always felt that mode 4 (all magic) was sort of a cheat since at the time
of pickup, you didn't know if it was magic.  I figured it was better to hand
pick the items and include known magic items but excluding known cursed
items.  OTOH, as a player, I like being able to set the machine to 
    
The low byte of 'mode' holds the density value.  This does lower the highest
available density filter from 65535 (ish) down to 255.  (this is one point,
in particular, I wasn't sure how high people set this to on an practical
basis).

Also, this setup removes the "and stop" and "stop before" type features.  To
implement them, we'd have to do away with one of the flags or take a bit
away from the density (leaving a max of 127 or even 63).

Some design comments:

I'm using an include in the config.h file since this is a change in program
behavior (USE_NEW_PICKUP) and I've given thought to making the magic cheat a
compile time option (USE_MAGIC_CHEAT) if people want to keep that feature.
I'll change the help if I can and I'm using descriptive defines
(PICKUP_DENSITY_MASK, etc) instead of magic numbers so I've made some
changes to define.h.  As I was doing this, I made a change to the input.c
part of set_pickup_mode to report when the "density" was set in the old
code.

Questions:

If this is desirable, are the flags ok?  I tried to pull out the interesting
items.
-- 
Please cc all mailing list replies to me, also.
* http://benham.net/index.html        <gecko@benham.net>           <><  *
* Debian:                             Software in the Public Interest:  *
*   Project Secretary                   Treasurer                       *
*   Webmaster Team                                                      *
*   BTS Team                          siteROCK:                         *
*   Lintian Team                        Linux Infrastructure Engineer   *
-
[you can put yourself on the announcement list only or unsubscribe altogether
by sending an email stating your wishes to crossfire-request@ifi.uio.no]