]> granicus.if.org Git - nethack/commit
generic feature_toggle
authornethack.allison <nethack.allison>
Tue, 26 Mar 2002 05:33:04 +0000 (05:33 +0000)
committernethack.allison <nethack.allison>
Tue, 26 Mar 2002 05:33:04 +0000 (05:33 +0000)
commit224eddc1d340c76c2ab289d876299cb77d44d4e2
treefff3be8824180bd97100a68aa278792c42dc2035
parentc76061312e87ca4b8f8ca3d9259ff28da2527594
generic feature_toggle

This adds a generic feature_toggle mechanism to
the game.  Code that wants to offer two different
ways of doing something can add an entry to
feature_toggles[] (in decl.c), and create a
preprocessor macro for its array index in decl.h.

Then the code can test it using
if (feature_toggle(FEATURE_NAME))
..do_this..
else
..do_that..

The player can toggle the alternate code path
on using OPTIONS=feature_toggle:feature_name_1 feature_name_2 ...

This seems better than creating brand new options
for controlling features (ala prayconfirm, which
could switch to this single option feature_toggle
mechanism as well)

My first use of it is to allow toggling of the selectors
on the loot menu, which I'm hesitant to just change back
because now people are actively using the new selectors and
the complaints would be really loud if the interface were
to just switch back after they adjusted.

The default behaviour is the new behaviour "iob", but with an
OPTIONS=feature_toggle:loot_menu_selectors
in your config file, it will revert to using "abc" as it did
in 3.3.1. I'll add a Guidebook page of "features/behaviour
that can be toggled" later.

The toggles can only be done in defaults.nh, and are
not saved with the game.
include/decl.h
include/extern.h
src/decl.c
src/options.c
src/pickup.c