Make status hilites use same color string matching as menucolors
This commit is contained in:
@@ -111,6 +111,7 @@ do allow globs with same curse/bless state to merge even when that state is
|
|||||||
fix pile mark after killing a monster carrying a potion which is destroyed
|
fix pile mark after killing a monster carrying a potion which is destroyed
|
||||||
only list known blank scrolls and known blank spellbooks as likely candidates
|
only list known blank scrolls and known blank spellbooks as likely candidates
|
||||||
when choosing an item to write on for applied magic marker
|
when choosing an item to write on for applied magic marker
|
||||||
|
make status hilites use same color names as menucolors
|
||||||
|
|
||||||
|
|
||||||
Platform- and/or Interface-Specific Fixes
|
Platform- and/or Interface-Specific Fixes
|
||||||
|
|||||||
@@ -1659,6 +1659,7 @@ E struct symparse *FDECL(match_sym, (char *));
|
|||||||
E void NDECL(set_playmode);
|
E void NDECL(set_playmode);
|
||||||
E int FDECL(sym_val, (char *));
|
E int FDECL(sym_val, (char *));
|
||||||
E const char *FDECL(clr2colorname, (int));
|
E const char *FDECL(clr2colorname, (int));
|
||||||
|
E int FDECL(match_str2clr, (char *));
|
||||||
E boolean FDECL(add_menu_coloring, (char *));
|
E boolean FDECL(add_menu_coloring, (char *));
|
||||||
E boolean FDECL(get_menu_coloring, (char *, int *, int *));
|
E boolean FDECL(get_menu_coloring, (char *, int *, int *));
|
||||||
E void NDECL(free_menu_coloring);
|
E void NDECL(free_menu_coloring);
|
||||||
|
|||||||
15
src/botl.c
15
src/botl.c
@@ -1214,21 +1214,10 @@ boolean from_configfile;
|
|||||||
} else if (strcmpi(how, "normal") == 0) {
|
} else if (strcmpi(how, "normal") == 0) {
|
||||||
normal[i] = TRUE;
|
normal[i] = TRUE;
|
||||||
} else {
|
} else {
|
||||||
int k;
|
int k = match_str2clr(how);
|
||||||
char colorname[BUFSZ];
|
|
||||||
for (k = 0; k < CLR_MAX; ++k) {
|
|
||||||
/* we have to make a copy to change space to dash */
|
|
||||||
(void) strcpy(colorname, c_obj_colors[k]);
|
|
||||||
for (tmp = index(colorname, ' '); tmp;
|
|
||||||
tmp = index(colorname, ' '))
|
|
||||||
*tmp = '-';
|
|
||||||
if (strcmpi(how, colorname) == 0) {
|
|
||||||
coloridx[i] = k;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (k >= CLR_MAX)
|
if (k >= CLR_MAX)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
coloridx[i] = k;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1274,6 +1274,26 @@ int clr;
|
|||||||
return (char *) 0;
|
return (char *) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
match_str2clr(str)
|
||||||
|
char *str;
|
||||||
|
{
|
||||||
|
int i, c = NO_COLOR;
|
||||||
|
|
||||||
|
/* allow "lightblue", "light blue", and "light-blue" to match "light blue"
|
||||||
|
(also junk like "_l i-gh_t---b l u e" but we won't worry about that);
|
||||||
|
also copes with trailing space; mungspaces removed any leading space */
|
||||||
|
for (i = 0; i < SIZE(colornames); i++)
|
||||||
|
if (colornames[i].name
|
||||||
|
&& fuzzymatch(str, colornames[i].name, " -_", TRUE)) {
|
||||||
|
c = colornames[i].color;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i == SIZE(colornames) && (*str >= '0' && *str <= '9'))
|
||||||
|
c = atoi(str);
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
attr2attrname(attr)
|
attr2attrname(attr)
|
||||||
int attr;
|
int attr;
|
||||||
@@ -1563,19 +1583,8 @@ char *str;
|
|||||||
if ((amp = index(tmps, '&')) != 0)
|
if ((amp = index(tmps, '&')) != 0)
|
||||||
*amp = '\0';
|
*amp = '\0';
|
||||||
|
|
||||||
/* allow "lightblue", "light blue", and "light-blue" to match "light blue"
|
c = match_str2clr(tmps);
|
||||||
(also junk like "_l i-gh_t---b l u e" but we won't worry about that);
|
if (c >= CLR_MAX)
|
||||||
also copes with trailing space; mungspaces removed any leading space */
|
|
||||||
for (i = 0; i < SIZE(colornames); i++)
|
|
||||||
if (colornames[i].name
|
|
||||||
&& fuzzymatch(tmps, colornames[i].name, " -_", TRUE)) {
|
|
||||||
c = colornames[i].color;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i == SIZE(colornames) && (*tmps >= '0' && *tmps <= '9'))
|
|
||||||
c = atoi(tmps);
|
|
||||||
|
|
||||||
if (c > 15)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (amp) {
|
if (amp) {
|
||||||
|
|||||||
Reference in New Issue
Block a user