Remove obsolete find_skates function

find_skates was still in use for its one intended case, but objdescr_is
has been around for a few years now and can do just as good a job
without having to hardcode the first and last boots in objects[].
This commit is contained in:
copperwater
2022-08-14 10:12:54 +03:00
committed by Pasi Kallinen
parent 1a6456ad82
commit 549dfb92ea
3 changed files with 7 additions and 25 deletions
-1
View File
@@ -1876,7 +1876,6 @@ extern void tty_ibmgraphics_fixup(void);
extern void init_objects(void); extern void init_objects(void);
extern void init_oclass_probs(void); extern void init_oclass_probs(void);
extern void obj_shuffle_range(int, int *, int *); extern void obj_shuffle_range(int, int *, int *);
extern int find_skates(void);
extern boolean objdescr_is(struct obj *, const char *); extern boolean objdescr_is(struct obj *, const char *);
extern void oinit(void); extern void oinit(void);
extern void savenames(NHFILE *); extern void savenames(NHFILE *);
+5 -7
View File
@@ -2058,13 +2058,11 @@ slippery_ice_fumbling(void)
boolean on_ice = !Levitation && is_ice(u.ux, u.uy); boolean on_ice = !Levitation && is_ice(u.ux, u.uy);
if (on_ice) { if (on_ice) {
static int skates = 0; if ((uarmf && objdescr_is(uarmf, "snow boots"))
|| resists_cold(&g.youmonst) || Flying
if (!skates) || is_floater(g.youmonst.data) || is_clinger(g.youmonst.data)
skates = find_skates(); || is_whirly(g.youmonst.data)) {
if ((uarmf && uarmf->otyp == skates) || resists_cold(&g.youmonst) pline("skates!");
|| Flying || is_floater(g.youmonst.data)
|| is_clinger(g.youmonst.data) || is_whirly(g.youmonst.data)) {
on_ice = FALSE; on_ice = FALSE;
} else if (!rn2(Cold_resistance ? 3 : 2)) { } else if (!rn2(Cold_resistance ? 3 : 2)) {
HFumbling |= FROMOUTSIDE; HFumbling |= FROMOUTSIDE;
-15
View File
@@ -341,21 +341,6 @@ objdescr_is(struct obj* obj, const char * descr)
return !strcmp(objdescr, descr); return !strcmp(objdescr, descr);
} }
/* find the object index for snow boots; used [once] by slippery ice code */
int
find_skates(void)
{
register int i;
register const char *s;
for (i = SPEED_BOOTS; i <= LEVITATION_BOOTS; i++)
if ((s = OBJ_DESCR(objects[i])) != 0 && !strcmp(s, "snow boots"))
return i;
impossible("snow boots not found?");
return -1; /* not 0, or caller would try again each move */
}
/* level dependent initialization */ /* level dependent initialization */
void void
oinit(void) oinit(void)