diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index bc981a281..ade908194 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1399,6 +1399,7 @@ gold thrown or kicked at a sleeping monster with the 'greedy' attribute gets neglected to report that target monster was awakened in the process hero movement affects the water bubble movement direction pets and peacefuls avoid a location hero just kicked +shopkeepers bill you for using their bear trap or land mine Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index 85ec516c2..113984202 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2847,6 +2847,7 @@ extern void globby_bill_fixup(struct obj *, struct obj *) NONNULLARG12; /*extern void globby_donation(struct obj *, struct obj *); */ extern void credit_report(struct monst *shkp, int idx, boolean silent) NONNULLARG1; +extern void use_unpaid_trapobj(struct obj *, coordxy, coordxy) NONNULLARG1; /* ### shknam.c ### */ diff --git a/src/apply.c b/src/apply.c index 709807ffc..6c18cb039 100644 --- a/src/apply.c +++ b/src/apply.c @@ -2880,6 +2880,7 @@ use_trap(struct obj *otmp) } } You("begin setting %s%s.", shk_your(buf, otmp), trapname(ttyp, FALSE)); + use_unpaid_trapobj(otmp, u.ux, u.uy); set_occupation(set_trap, occutext, 0); return; } diff --git a/src/coloratt.c b/src/coloratt.c index 762a80bec..8e68a469d 100644 --- a/src/coloratt.c +++ b/src/coloratt.c @@ -219,6 +219,10 @@ static struct nethack_color colortable[] = { { rgb_color, 154, 138, "white", "#FFFFFF", 255, 255, 255 }, }; +#ifdef CHANGE_COLOR +staticfn int32 alt_color_spec(const char *cp); +#endif + int32 colortable_to_int32(struct nethack_color *cte) { @@ -1068,6 +1072,9 @@ alternative_palette(char *op) if (c_colorval && coloridx >= 0 && coloridx < CLR_MAX) { rgb = rgbstr_to_int32(c_colorval); + if (rgb == -1) { + rgb = alt_color_spec(c_colorval); + } if (rgb != -1) { ga.altpalette[coloridx] = (uint32) rgb | NH_ALTPALETTE; /* use COLORVAL(ga.altpalette[coloridx]) to get @@ -1085,11 +1092,68 @@ change_palette(void) for (clridx = 0; clridx < CLR_MAX; ++clridx) { if (ga.altpalette[clridx] != 0) { - long rgb = (long) (ga.altpalette[clridx] & ~NH_ALTPALETTE); + long rgb = (long) COLORVAL(ga.altpalette[clridx]); (*windowprocs.win_change_color)(clridx, rgb, 0); } } } + +staticfn int32 +alt_color_spec(const char *str) +{ + static NEARDATA const char oct[] = "01234567", dec[] = "0123456789"; + /* hexdd[] is defined in decl.c */ + + const char *dp, *cp = str; + int32 cval = -1; + int dcount, dlimit = 6; + boolean hexescape = FALSE, octescape = FALSE; + + dcount = 0; /* for decimal, octal, hexadecimal cases */ + hexescape = + (*cp == '\\' && cp[1] && (cp[1] == 'x' || cp[1] == 'X') && cp[2]); + if (!hexescape) { + octescape = + (*cp == '\\' && cp[1] && (cp[1] == 'o' || cp[1] == 'O') && cp[2]); + } + + if (hexescape || octescape) { + cval = 0; + cp += 2; + if (octescape) + dlimit = 8; + } else if (*cp == '#' && cp[1]) { + hexescape = TRUE; + cval = 0; + cp += 1; + } else if (cp[1]) { + cval = 0; + dlimit = 8; + } else if (!cp[1]) { + if (strchr(dec, *cp) != 0) { + /* simple val, or nothing left for \ to escape */ + cval = (*cp - '0'); + } + dlimit = 1; + cp++; + } + + while (*cp) { + if (!hexescape && !octescape && strchr(dec, *cp)) { + cval = (cval * 10) + (*cp - '0'); + } else if (octescape && strchr(oct, *cp)) { + cval = (cval * 8) + (*cp - '0'); + } else if (hexescape && (dp = strchr(hexdd, *cp)) != 0) { + cval = (cval * 16) + ((int) (dp - hexdd) / 2); + } + ++cp; + if (++dcount > dlimit) { + cval = -1; + break; + } + } + return cval; +} #endif /* CHANGE_COLOR */ /*coloratt.c*/ diff --git a/src/shk.c b/src/shk.c index 25fd6ebf4..e0b638ce0 100644 --- a/src/shk.c +++ b/src/shk.c @@ -5523,4 +5523,21 @@ globby_bill_fixup(struct obj *obj_absorber, struct obj *obj_absorbed) return; } +/* Shopkeeper bills for use of a land mine or bear trap they own */ +void +use_unpaid_trapobj(struct obj *otmp, coordxy x, coordxy y) +{ + if (otmp->unpaid) { + if (!Deaf) { + struct monst *shkp = find_objowner(otmp, x, y); + + if (shkp && !muteshk(shkp)) { + SetVoice(shkp, 0, 80, 0); + verbalize("You set it, you buy it!"); + } + } + bill_dummy_object(otmp); + } +} + /*shk.c*/ diff --git a/sys/windows/consoletty.c b/sys/windows/consoletty.c index 55f89dee6..0c40e18b3 100644 --- a/sys/windows/consoletty.c +++ b/sys/windows/consoletty.c @@ -2000,21 +2000,6 @@ tty_ibmgraphics_fixup(void) #endif /* VIRTUAL_TERMINAL_SEQUENCES */ } -#ifdef CHANGE_COLOR -#ifdef NO_TERMS -void -tty_change_color(int color UNUSED, long rgb UNUSED, int reverse UNUSED) -{ -} - -char * -tty_get_color_string(void) -{ - return (""); -} -#endif -#endif /* CHANGE_COLOR */ - #ifdef PORT_DEBUG void win32con_debug_keystrokes(void)