re-implement pull req #334 - sorting discoveries

The pull request changed \ and ` output to unconditionally show
discoveries in alphabetical order.  That's nearly useless except
when looking at prediscovered weapons and armor that fighter
types start out knowing.

This allows the player to choose sorting order via the new
'sortdiscoveries' option.  In addition to setting it via
config file or 'O', it can be set via 'm' prefix for \ and `.
Choices are:
 o - sort by class, by order of discovery in class (default);
 s - sort by 'sortloot' classification which groups sub-class
     items (so all helmets before any other armor, then all
     gloves, then boots, and so on); within each sub-class, or
     whole class for classes which don't subdivide so usefully,
     partly-discovered types (where a name has been assigned)
     come before fully ID'd types;
 c - sort by class, alphabetically within class;
 a - sort alphabetically across all classes.

Turned out to be a large amount of work for fairly little gain,
although I suspect that 'sortdiscoveries:s' will eventually be
more popular than the default.

Invalidates existing save files so that current sort setting can
persist across save/restore cycles.

Closes #334
This commit is contained in:
PatR
2020-12-19 17:45:49 -08:00
parent 44f4085f69
commit 4cf6727b4e
12 changed files with 402 additions and 43 deletions

View File

@@ -45,7 +45,7 @@
%.au
\author{Original version - Eric S. Raymond\\
(Edited and expanded for 3.7 by Mike Stephenson and others)}
\date{December 16, 2020}
\date{December 19, 2020}
\maketitle
@@ -1154,9 +1154,15 @@ ordering.)
%.lp
\item[\tb{$\backslash$}]
Show what types of objects have been discovered.
\\
%.lp ""
May be preceded by `{\tt m}' to select preferred display order.
%.lp
\item[\tb{\`}]
Show discovered types for one class of objects.
\\
.lp ""
May be preceded by `{\tt m}' to select preferred display order.
%.lp
\item[\tb{!}]
Escape to a shell.
@@ -1340,10 +1346,18 @@ and also `{\tt k}' if {\it number\verb+_+pad\/} is on.
\item[\tb{\#known}]
Show what object types have been discovered.
Default key is `{\tt $\backslash$}'.
\\
%.lp ""
The `{\tt m}' prefix allows assigning a new value to the
{\it sortdiscoveries\/}
option to control the order in which the discoveries are displayed.
%.lp
\item[\tb{\#knownclass}]
Show discovered types for one class of objects.
Default key is `{\tt `}'.
\\
%.lp ""
The `{\tt m}' prefix operates the same as for \(lq#known\(rq.
%.lp
\item[\tb{\#levelchange}]
Change your experience level.
@@ -4450,17 +4464,44 @@ Persistent.
\item[\ib{silent}]
Suppress terminal beeps (default on). Persistent.
%.lp
\item[\ib{sortdiscoveries}]
Controls the sorting behavior for the output of the `{\tt $\backslash$}'
and `{\tt \`}' commands.
Persistent.
\\
%.lp ""
The possible values are:
%.PS o
%.PL o
(\tt o} --- list object types by class, in discovery order within each class;
default;
%.PL s
{\tt s} --- list object types by {\it sortloot\/}
classification: by class, by sub-class within class for classes which
have substantial groupings (like helmets, boots, gloves, and so forth
for armor), with object types partly-discovered via assigned name coming
before fully identified types;
\\
%.PL c
{\tt c} --- list by class, alphabetically within each class;\\
%.PL a
{\tt a} --- list alphabetically across all classes.\\
%.PE
Can be interactively set via the `{\tt O}' command or via using
the `{\tt m}' prefix before the `{\tt $\backslash$}'
or `{\tt \`}' command.
%.lp
\item[\ib{sortloot}]
Controls the sorting behavior of pickup lists for inventory
and \#loot commands and some others. Persistent.
\\
The possible values are:
%.sd
%.si
{\tt full} --- always sort the lists;\\
{\tt loot} --- only sort the lists that don't use inventory
letters, like with the \#loot and pickup commands;\\
{\tt none} --- show lists the traditional way without sorting.
{\tt none} --- show lists the traditional way without sorting; default.
%.ei
%.ed
%.lp