handle 0 in DUNGEONS et al
As suggested by <Someone>, treat 0 entries in the various graphics symbol specifications as leaving the value unchanged.
This commit is contained in:
@@ -1602,6 +1602,8 @@ or
|
|||||||
option in a different syntax,
|
option in a different syntax,
|
||||||
a sequence of decimal numbers giving the character position
|
a sequence of decimal numbers giving the character position
|
||||||
in the current font to be used in displaying each entry.
|
in the current font to be used in displaying each entry.
|
||||||
|
A zero in any entry in such a sequence leaves the display of that
|
||||||
|
entry unchanged; this feature is not available using the option syntax.
|
||||||
Such a sequence can be continued to multiple lines by putting a `\e'
|
Such a sequence can be continued to multiple lines by putting a `\e'
|
||||||
at the end of each line to be continued.
|
at the end of each line to be continued.
|
||||||
Any line starting with `#' is treated as a comment.
|
Any line starting with `#' is treated as a comment.
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
\begin{document}
|
\begin{document}
|
||||||
%
|
%
|
||||||
% input file: guidebook.mn
|
% input file: guidebook.mn
|
||||||
% $Revision: 1.49 $ $Date: 2002/08/07 03:26:50 $
|
% $Revision: 1.50 $ $Date: 2002/08/12 01:39:55 $
|
||||||
%
|
%
|
||||||
%.ds h0 "
|
%.ds h0 "
|
||||||
%.ds h1 %.ds h2 \%
|
%.ds h1 %.ds h2 \%
|
||||||
@@ -2008,6 +2008,8 @@ is taken as defining the corresponding {\it dungeon},
|
|||||||
{\it boulder\/} option in a different syntax,
|
{\it boulder\/} option in a different syntax,
|
||||||
a sequence of decimal numbers giving the character position
|
a sequence of decimal numbers giving the character position
|
||||||
in the current font to be used in displaying each entry.
|
in the current font to be used in displaying each entry.
|
||||||
|
A zero in any entry in such a sequence leaves the display of that
|
||||||
|
entry unchanged; this feature is not available using the option syntax.
|
||||||
Such a sequence can be continued to multiple lines by putting a
|
Such a sequence can be continued to multiple lines by putting a
|
||||||
`{\tt \verb+\+}' at the end of each line to be continued.
|
`{\tt \verb+\+}' at the end of each line to be continued.
|
||||||
Any line starting with `{\tt \#}' is treated as a comment.
|
Any line starting with `{\tt \#}' is treated as a comment.
|
||||||
|
|||||||
@@ -203,6 +203,8 @@ when polymorphed into a hider, cease hiding during level changes
|
|||||||
let mind flayer grow up into master mind flayer; also giant/sewer rat and
|
let mind flayer grow up into master mind flayer; also giant/sewer rat and
|
||||||
cave/large spider
|
cave/large spider
|
||||||
engulfing green slime as a purple worm was causing stoning not sliming
|
engulfing green slime as a purple worm was causing stoning not sliming
|
||||||
|
zero entries in DUNGEON, MONSTERS, et al, of config file are now treated
|
||||||
|
as preserving the default rather than being ignored
|
||||||
|
|
||||||
|
|
||||||
Platform- and/or Interface-Specific Fixes
|
Platform- and/or Interface-Specific Fixes
|
||||||
|
|||||||
38
src/files.c
38
src/files.c
@@ -127,7 +127,7 @@ STATIC_DCL void FDECL(docompress_file, (const char *,BOOLEAN_P));
|
|||||||
#endif
|
#endif
|
||||||
STATIC_DCL char *FDECL(make_lockname, (const char *,char *));
|
STATIC_DCL char *FDECL(make_lockname, (const char *,char *));
|
||||||
STATIC_DCL FILE *FDECL(fopen_config_file, (const char *));
|
STATIC_DCL FILE *FDECL(fopen_config_file, (const char *));
|
||||||
STATIC_DCL int FDECL(get_uchars, (FILE *,char *,char *,uchar *,int,const char *));
|
STATIC_DCL int FDECL(get_uchars, (FILE *,char *,char *,uchar *,BOOLEAN_P,int,const char *));
|
||||||
int FDECL(parse_config_line, (FILE *,char *,char *,char *));
|
int FDECL(parse_config_line, (FILE *,char *,char *,char *));
|
||||||
#ifdef NOCWD_ASSUMPTIONS
|
#ifdef NOCWD_ASSUMPTIONS
|
||||||
STATIC_DCL void FDECL(adjust_prefix, (char *, int));
|
STATIC_DCL void FDECL(adjust_prefix, (char *, int));
|
||||||
@@ -1430,27 +1430,33 @@ const char *filename;
|
|||||||
/*
|
/*
|
||||||
* Retrieve a list of integers from a file into a uchar array.
|
* Retrieve a list of integers from a file into a uchar array.
|
||||||
*
|
*
|
||||||
* NOTE: This routine is unable to read a value of 0.
|
* NOTE: zeros are inserted unless modlist is TRUE, in which case the list
|
||||||
|
* location is unchanged. Callers must handle zeros if modlist is FALSE.
|
||||||
*/
|
*/
|
||||||
STATIC_OVL int
|
STATIC_OVL int
|
||||||
get_uchars(fp, buf, bufp, list, size, name)
|
get_uchars(fp, buf, bufp, list, modlist, size, name)
|
||||||
FILE *fp; /* input file pointer */
|
FILE *fp; /* input file pointer */
|
||||||
char *buf; /* read buffer, must be of size BUFSZ */
|
char *buf; /* read buffer, must be of size BUFSZ */
|
||||||
char *bufp; /* current pointer */
|
char *bufp; /* current pointer */
|
||||||
uchar *list; /* return list */
|
uchar *list; /* return list */
|
||||||
|
boolean modlist; /* TRUE: list is being modified in place */
|
||||||
int size; /* return list size */
|
int size; /* return list size */
|
||||||
const char *name; /* name of option for error message */
|
const char *name; /* name of option for error message */
|
||||||
{
|
{
|
||||||
unsigned int num = 0;
|
unsigned int num = 0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
boolean havenum = FALSE;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
switch(*bufp) {
|
switch(*bufp) {
|
||||||
case ' ': case '\0':
|
case ' ': case '\0':
|
||||||
case '\t': case '\n':
|
case '\t': case '\n':
|
||||||
if (num) {
|
if (havenum) {
|
||||||
list[count++] = num;
|
/* if modifying in place, don't insert zeros */
|
||||||
|
if (num || !modlist) list[count] = num;
|
||||||
|
count++;
|
||||||
num = 0;
|
num = 0;
|
||||||
|
havenum = FALSE;
|
||||||
}
|
}
|
||||||
if (count == size || !*bufp) return count;
|
if (count == size || !*bufp) return count;
|
||||||
bufp++;
|
bufp++;
|
||||||
@@ -1459,6 +1465,7 @@ get_uchars(fp, buf, bufp, list, size, name)
|
|||||||
case '0': case '1': case '2': case '3':
|
case '0': case '1': case '2': case '3':
|
||||||
case '4': case '5': case '6': case '7':
|
case '4': case '5': case '6': case '7':
|
||||||
case '8': case '9':
|
case '8': case '9':
|
||||||
|
havenum = TRUE;
|
||||||
num = num*10 + (*bufp-'0');
|
num = num*10 + (*bufp-'0');
|
||||||
bufp++;
|
bufp++;
|
||||||
break;
|
break;
|
||||||
@@ -1620,30 +1627,35 @@ char *tmp_levels;
|
|||||||
(void) strncpy(catname, bufp, PL_PSIZ-1);
|
(void) strncpy(catname, bufp, PL_PSIZ-1);
|
||||||
|
|
||||||
} else if (match_varname(buf, "BOULDER", 3)) {
|
} else if (match_varname(buf, "BOULDER", 3)) {
|
||||||
(void) get_uchars(fp, buf, bufp, &iflags.bouldersym, 1, "BOULDER");
|
(void) get_uchars(fp, buf, bufp, &iflags.bouldersym, TRUE,
|
||||||
|
1, "BOULDER");
|
||||||
} else if (match_varname(buf, "GRAPHICS", 4)) {
|
} else if (match_varname(buf, "GRAPHICS", 4)) {
|
||||||
len = get_uchars(fp, buf, bufp, translate, MAXPCHARS, "GRAPHICS");
|
len = get_uchars(fp, buf, bufp, translate, FALSE,
|
||||||
|
MAXPCHARS, "GRAPHICS");
|
||||||
assign_graphics(translate, len, MAXPCHARS, 0);
|
assign_graphics(translate, len, MAXPCHARS, 0);
|
||||||
} else if (match_varname(buf, "DUNGEON", 4)) {
|
} else if (match_varname(buf, "DUNGEON", 4)) {
|
||||||
len = get_uchars(fp, buf, bufp, translate, MAXDCHARS, "DUNGEON");
|
len = get_uchars(fp, buf, bufp, translate, FALSE,
|
||||||
|
MAXDCHARS, "DUNGEON");
|
||||||
assign_graphics(translate, len, MAXDCHARS, 0);
|
assign_graphics(translate, len, MAXDCHARS, 0);
|
||||||
} else if (match_varname(buf, "TRAPS", 4)) {
|
} else if (match_varname(buf, "TRAPS", 4)) {
|
||||||
len = get_uchars(fp, buf, bufp, translate, MAXTCHARS, "TRAPS");
|
len = get_uchars(fp, buf, bufp, translate, FALSE,
|
||||||
|
MAXTCHARS, "TRAPS");
|
||||||
assign_graphics(translate, len, MAXTCHARS, MAXDCHARS);
|
assign_graphics(translate, len, MAXTCHARS, MAXDCHARS);
|
||||||
} else if (match_varname(buf, "EFFECTS", 4)) {
|
} else if (match_varname(buf, "EFFECTS", 4)) {
|
||||||
len = get_uchars(fp, buf, bufp, translate, MAXECHARS, "EFFECTS");
|
len = get_uchars(fp, buf, bufp, translate, FALSE,
|
||||||
|
MAXECHARS, "EFFECTS");
|
||||||
assign_graphics(translate, len, MAXECHARS, MAXDCHARS+MAXTCHARS);
|
assign_graphics(translate, len, MAXECHARS, MAXDCHARS+MAXTCHARS);
|
||||||
|
|
||||||
} else if (match_varname(buf, "OBJECTS", 3)) {
|
} else if (match_varname(buf, "OBJECTS", 3)) {
|
||||||
/* oc_syms[0] is the RANDOM object, unused */
|
/* oc_syms[0] is the RANDOM object, unused */
|
||||||
(void) get_uchars(fp, buf, bufp, &(oc_syms[1]),
|
(void) get_uchars(fp, buf, bufp, &(oc_syms[1]), TRUE,
|
||||||
MAXOCLASSES-1, "OBJECTS");
|
MAXOCLASSES-1, "OBJECTS");
|
||||||
} else if (match_varname(buf, "MONSTERS", 3)) {
|
} else if (match_varname(buf, "MONSTERS", 3)) {
|
||||||
/* monsyms[0] is unused */
|
/* monsyms[0] is unused */
|
||||||
(void) get_uchars(fp, buf, bufp, &(monsyms[1]),
|
(void) get_uchars(fp, buf, bufp, &(monsyms[1]), TRUE,
|
||||||
MAXMCLASSES-1, "MONSTERS");
|
MAXMCLASSES-1, "MONSTERS");
|
||||||
} else if (match_varname(buf, "WARNINGS", 5)) {
|
} else if (match_varname(buf, "WARNINGS", 5)) {
|
||||||
(void) get_uchars(fp, buf, bufp, translate,
|
(void) get_uchars(fp, buf, bufp, translate, FALSE,
|
||||||
WARNCOUNT, "WARNINGS");
|
WARNCOUNT, "WARNINGS");
|
||||||
assign_warnings(translate);
|
assign_warnings(translate);
|
||||||
#ifdef WIZARD
|
#ifdef WIZARD
|
||||||
|
|||||||
@@ -831,7 +831,7 @@ register uchar *graph_chars;
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < WARNCOUNT; i++)
|
for (i = 0; i < WARNCOUNT; i++)
|
||||||
warnsyms[i] = graph_chars[i];
|
if (graph_chars[i]) warnsyms[i] = graph_chars[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC_OVL int
|
STATIC_OVL int
|
||||||
|
|||||||
Reference in New Issue
Block a user