]> granicus.if.org Git - nethack/commitdiff
symbols file feedback (trunk only)
authornethack.allison <nethack.allison>
Sat, 23 Sep 2006 18:32:21 +0000 (18:32 +0000)
committernethack.allison <nethack.allison>
Sat, 23 Sep 2006 18:32:21 +0000 (18:32 +0000)
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.
>

src/drawing.c
src/options.c

index 6ab7b2e2ca80943e8bacbb5d9089993cc5497401..0f8672157f8deca2d11f0f33f5fdd6c718f025e0 100644 (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();
index f03609989c4abf431de26d37ca5c26f6f47acf13..011bce5e1bbfef9010d7d28cbf2d8e08150a9f62 100644 (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;
            }
        }