symbols file feedback (trunk only)

Pat Rankin wrote:
> When 'symbols' is missing from the playground, or is an empty
> file, picking either the symset or roguesymset option via the
> 'O' command just goes right back to the game display (or next
> pending compound option) without giving any feedback.
>
This commit is contained in:
nethack.allison
2006-09-23 18:32:21 +00:00
parent f713038a88
commit 7fce69157e
2 changed files with 23 additions and 10 deletions

View File

@@ -376,18 +376,18 @@ int nondefault;
for (i = 0; i < MAXOCLASSES; i++)
oc_syms[i] = l_oc_syms[i];
#ifdef PC9800
# ifdef PC9800
if (SYMHANDLING(H_IBM)
&& ibmgraphics_mode_callback)
(*ibmgraphics_mode_callback)();
else if (!symset[currentgraphics] && ascgraphics_mode_callback)
(*ascgraphics_mode_callback)();
#endif
#ifdef TERMLIB
# endif
# ifdef TERMLIB
if (SYMHANDLING(H_DEC)
&& decgraphics_mode_callback)
(*decgraphics_mode_callback)();
#endif
# endif
} else
#endif
init_symbols();

View File

@@ -1304,9 +1304,11 @@ boolean tinitial, tfrom_file;
symset[ROGUESET] = (char *)alloc(strlen(op) + 1);
Strcpy(symset[ROGUESET], op);
if (!read_sym_file(ROGUESET)) {
badoption(opts);
free((char *)symset[ROGUESET]);
symset[ROGUESET] = (char *)0;
raw_printf("Unable to load symbol set \"%s\" from \"%s\".",
op, SYMBOLS);
wait_synch();
} else {
if (!initial && Is_rogue_level(&u.uz))
assign_graphics(ROGUESET);
@@ -1326,9 +1328,11 @@ boolean tinitial, tfrom_file;
symset[PRIMARY] = (char *)alloc(strlen(op) + 1);
Strcpy(symset[PRIMARY], op);
if (!read_sym_file(PRIMARY)) {
badoption(opts);
free((char *)symset[PRIMARY]);
symset[PRIMARY] = (char *)0;
raw_printf("Unable to load symbol set \"%s\" from \"%s\".",
op, SYMBOLS);
wait_synch();
} else {
switch_symbols(TRUE);
need_redraw = TRUE;
@@ -3146,7 +3150,7 @@ boolean setinitial,setfromfile;
menu_item *symset_pick = (menu_item *)0;
boolean rogueflag = (*optname == 'r');
char *symset_name;
int chosen = -2, which_set =
int chosen = -2, res, which_set =
#ifdef REINCARNATION
rogueflag ? ROGUESET :
#endif
@@ -3159,7 +3163,8 @@ boolean setinitial,setfromfile;
symset_name = symset[which_set];
symset[which_set] = (char *)0;
if (read_sym_file(which_set) && symset_list) {
res = read_sym_file(which_set);
if (res && symset_list) {
int let = 'a';
struct textlist *sl;
tmpwin = create_nhwindow(NHW_MENU);
@@ -3210,8 +3215,16 @@ boolean setinitial,setfromfile;
symset_list = sl->next;
}
symset_list = (struct textlist *)0;
} else if (!res) {
/* The symbols file could not be accessed */
pline("Unable to access \"%s\" file.", SYMBOLS);
return TRUE;
} else if (!symset_list) {
/* The symbols file was empty */
pline("There were no symbol sets found in \"%s\".",
SYMBOLS);
return TRUE;
}
/* these set default symbols and clear the handling value */
# ifdef REINCARNATION
if(rogueflag) init_r_symbols();
@@ -3228,7 +3241,7 @@ boolean setinitial,setfromfile;
else {
free((genericptr_t)symset[which_set]);
symset[which_set] = (char *)0;
return 0;
return TRUE;
}
}