Detection map redisplay routine code deduplication
This commit is contained in:
61
src/detect.c
61
src/detect.c
@@ -13,6 +13,7 @@
|
||||
|
||||
static boolean NDECL(unconstrain_map);
|
||||
static void NDECL(reconstrain_map);
|
||||
static void NDECL(map_redisplay);
|
||||
static void FDECL(browse_map, (int, const char *));
|
||||
static void FDECL(map_monst, (struct monst *, BOOLEAN_P));
|
||||
static void FDECL(do_dknown_of, (struct obj *));
|
||||
@@ -52,6 +53,17 @@ reconstrain_map()
|
||||
u.uswallow = iflags.save_uswallow, iflags.save_uswallow = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
map_redisplay()
|
||||
{
|
||||
reconstrain_map();
|
||||
docrt(); /* redraw the screen to remove unseen traps from the map */
|
||||
if (Underwater)
|
||||
under_water(2);
|
||||
if (u.uburied)
|
||||
under_ground(2);
|
||||
}
|
||||
|
||||
/* use getpos()'s 'autodescribe' to view whatever is currently shown on map */
|
||||
static void
|
||||
browse_map(ter_typ, ter_explain)
|
||||
@@ -440,12 +452,7 @@ register struct obj *sobj;
|
||||
|
||||
browse_map(ter_typ, "gold");
|
||||
|
||||
reconstrain_map();
|
||||
docrt();
|
||||
if (Underwater)
|
||||
under_water(2);
|
||||
if (u.uburied)
|
||||
under_ground(2);
|
||||
map_redisplay();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -564,12 +571,7 @@ register struct obj *sobj;
|
||||
|
||||
browse_map(ter_typ, "food");
|
||||
|
||||
reconstrain_map();
|
||||
docrt();
|
||||
if (Underwater)
|
||||
under_water(2);
|
||||
if (u.uburied)
|
||||
under_ground(2);
|
||||
map_redisplay();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -765,12 +767,7 @@ int class; /* an object class, 0 for all */
|
||||
else
|
||||
browse_map(ter_typ, "object");
|
||||
|
||||
reconstrain_map();
|
||||
docrt(); /* this will correctly reset vision */
|
||||
if (Underwater)
|
||||
under_water(2);
|
||||
if (u.uburied)
|
||||
under_ground(2);
|
||||
map_redisplay();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -844,12 +841,7 @@ int mclass; /* monster class, 0 for all */
|
||||
EDetect_monsters &= ~I_SPECIAL;
|
||||
}
|
||||
|
||||
reconstrain_map();
|
||||
docrt(); /* redraw the screen to remove unseen monsters from map */
|
||||
if (Underwater)
|
||||
under_water(2);
|
||||
if (u.uburied)
|
||||
under_ground(2);
|
||||
map_redisplay();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1032,12 +1024,7 @@ struct obj *sobj; /* null if crystal ball, *scroll if gold detection scroll */
|
||||
|
||||
browse_map(ter_typ, "trap of interest");
|
||||
|
||||
reconstrain_map();
|
||||
docrt(); /* redraw the screen to remove unseen traps from the map */
|
||||
if (Underwater)
|
||||
under_water(2);
|
||||
if (u.uburied)
|
||||
under_ground(2);
|
||||
map_redisplay();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1082,12 +1069,7 @@ furniture_detect()
|
||||
browse_map(TER_DETECT | TER_MAP | TER_TRP | TER_OBJ | TER_MON,
|
||||
"location");
|
||||
|
||||
reconstrain_map();
|
||||
docrt(); /* redraw everything */
|
||||
if (Underwater)
|
||||
under_water(2);
|
||||
if (u.uburied)
|
||||
under_ground(2);
|
||||
map_redisplay();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2108,12 +2090,7 @@ int which_subset; /* when not full, whether to suppress objs and/or traps */
|
||||
which_subset |= TER_MAP; /* guarantee non-zero */
|
||||
browse_map(which_subset, "anything of interest");
|
||||
|
||||
reconstrain_map();
|
||||
docrt(); /* redraw the screen, restoring regular map */
|
||||
if (Underwater)
|
||||
under_water(2);
|
||||
if (u.uburied)
|
||||
under_ground(2);
|
||||
map_redisplay();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user