getpos() reformatting
Some miscellaneous reformatting done while looking over getpos() usage rather than reformatting of getpos() itself.
This commit is contained in:
@@ -3294,9 +3294,11 @@ use_pole(struct obj *obj, boolean autohit)
|
||||
cc.y = hitm->my;
|
||||
}
|
||||
if (!autohit) {
|
||||
getpos_sethilite(display_polearm_positions, get_valid_polearm_position);
|
||||
getpos_sethilite(display_polearm_positions,
|
||||
get_valid_polearm_position);
|
||||
if (getpos(&cc, TRUE, "the spot to hit") < 0)
|
||||
return (res|ECMD_CANCEL); /* ESC; uses turn iff polearm became wielded */
|
||||
/* ESC; uses turn iff polearm became wielded */
|
||||
return (res | ECMD_CANCEL);
|
||||
}
|
||||
|
||||
glyph = glyph_at(cc.x, cc.y);
|
||||
@@ -3537,7 +3539,8 @@ use_grapple(struct obj *obj)
|
||||
cc.y = u.uy;
|
||||
getpos_sethilite(NULL, can_grapple_location);
|
||||
if (getpos(&cc, TRUE, "the spot to hit") < 0)
|
||||
return (res|ECMD_CANCEL); /* ESC; uses turn iff grapnel became wielded */
|
||||
/* ESC; uses turn iff grapnel became wielded */
|
||||
return (res | ECMD_CANCEL);
|
||||
|
||||
/* Calculate range; unlike use_pole(), there's no minimum for range */
|
||||
typ = uwep_skill_type();
|
||||
|
||||
20
src/cmd.c
20
src/cmd.c
@@ -4869,7 +4869,7 @@ rhack(char *cmd)
|
||||
down = (key == '>' || tlist->ef_funct == dodown);
|
||||
|
||||
pline(
|
||||
"The '%s' prefix should be followed by a movement command%s.",
|
||||
"The '%s' prefix should be followed by a movement command%s.",
|
||||
which, (up || down) ? " other than up or down" : "");
|
||||
}
|
||||
res = ECMD_FAIL;
|
||||
@@ -4886,7 +4886,8 @@ rhack(char *cmd)
|
||||
if (!g.in_doagain && func != do_repeat && func != doextcmd) {
|
||||
if (!prefix_seen)
|
||||
cmdq_clear(CQ_REPEAT);
|
||||
cmdq_add_ec(CQ_REPEAT, ((struct ext_func_tab *) tlist)->ef_funct);
|
||||
cmdq_add_ec(CQ_REPEAT,
|
||||
((struct ext_func_tab *) tlist)->ef_funct);
|
||||
} else {
|
||||
if (func == doextcmd) {
|
||||
cmdq_clear(CQ_REPEAT);
|
||||
@@ -4900,7 +4901,8 @@ rhack(char *cmd)
|
||||
if (g.ext_tlist) {
|
||||
tlist = g.ext_tlist, g.ext_tlist = NULL;
|
||||
/* Add the command post-execution */
|
||||
cmdq_add_ec(CQ_REPEAT, ((struct ext_func_tab *) tlist)->ef_funct);
|
||||
cmdq_add_ec(CQ_REPEAT,
|
||||
((struct ext_func_tab *) tlist)->ef_funct);
|
||||
/* shift the command to first */
|
||||
cmdq_shift(CQ_REPEAT);
|
||||
}
|
||||
@@ -4982,8 +4984,9 @@ rhack(char *cmd)
|
||||
#if 1
|
||||
nhUse(c1);
|
||||
#else
|
||||
/* note: since prefix keys became actual commnads, we can no longer get
|
||||
here with 'prefix_seen' set so this never calls help_dir() anymore */
|
||||
/* note: since prefix keys became actual commnads, we can no longer
|
||||
get here with 'prefix_seen' set so this never calls help_dir()
|
||||
anymore */
|
||||
if (!prefix_seen
|
||||
|| !help_dir(c1, prefix_seen->key, "Invalid direction key!"))
|
||||
#endif
|
||||
@@ -6418,6 +6421,7 @@ dotravel(void)
|
||||
iflags.getloc_travelmode = TRUE;
|
||||
if (iflags.menu_requested) {
|
||||
int gf = iflags.getloc_filter;
|
||||
|
||||
iflags.getloc_filter = GFILTER_VIEW;
|
||||
if (!getpos_menu(&cc, GLOC_INTERESTING)) {
|
||||
iflags.getloc_filter = gf;
|
||||
@@ -6482,7 +6486,11 @@ doclicklook(void)
|
||||
* window port causing a buffer overflow there.
|
||||
*/
|
||||
char
|
||||
yn_function(const char *query, const char *resp, char def, boolean addcmdq)
|
||||
yn_function(
|
||||
const char *query,
|
||||
const char *resp,
|
||||
char def,
|
||||
boolean addcmdq)
|
||||
{
|
||||
char res = '\033', qbuf[QBUFSZ];
|
||||
struct _cmd_queue cq, *cmdq;
|
||||
|
||||
@@ -42,10 +42,13 @@ nextmbuf(void)
|
||||
* parameter value 0 = initialize, 1 = highlight, 2 = done
|
||||
*/
|
||||
static void (*getpos_hilitefunc)(int) = (void (*)(int)) 0;
|
||||
static boolean (*getpos_getvalid)(coordxy, coordxy) = (boolean (*)(coordxy, coordxy)) 0;
|
||||
static boolean
|
||||
(*getpos_getvalid)(coordxy, coordxy) = (boolean (*)(coordxy, coordxy)) 0;
|
||||
|
||||
void
|
||||
getpos_sethilite(void (*gp_hilitef)(int), boolean (*gp_getvalidf)(coordxy, coordxy))
|
||||
getpos_sethilite(
|
||||
void (*gp_hilitef)(int),
|
||||
boolean (*gp_getvalidf)(coordxy, coordxy))
|
||||
{
|
||||
getpos_hilitefunc = gp_hilitef;
|
||||
getpos_getvalid = gp_getvalidf;
|
||||
@@ -71,7 +74,10 @@ static const char *const gloc_filtertxt[NUM_GFILTER] = {
|
||||
};
|
||||
|
||||
static void
|
||||
getpos_help_keyxhelp(winid tmpwin, const char *k1, const char *k2, int gloc)
|
||||
getpos_help_keyxhelp(
|
||||
winid tmpwin,
|
||||
const char *k1, const char *k2,
|
||||
int gloc)
|
||||
{
|
||||
char sbuf[BUFSZ], fbuf[QBUFSZ];
|
||||
const char *move_cursor_to = "move the cursor to ",
|
||||
@@ -263,11 +269,11 @@ cmp_coord_distu(const void *a, const void *b)
|
||||
}
|
||||
|
||||
#define IS_UNEXPLORED_LOC(x,y) \
|
||||
(isok((x), (y)) \
|
||||
&& glyph_is_unexplored(levl[(x)][(y)].glyph) \
|
||||
(isok((x), (y)) \
|
||||
&& glyph_is_unexplored(levl[(x)][(y)].glyph) \
|
||||
&& !levl[(x)][(y)].seenv)
|
||||
|
||||
#define GLOC_SAME_AREA(x,y) \
|
||||
#define GLOC_SAME_AREA(x,y) \
|
||||
(isok((x), (y)) \
|
||||
&& (selection_getpoint((x),(y), g.gloc_filter_map)))
|
||||
|
||||
@@ -1060,9 +1066,9 @@ getpos(coord *ccp, boolean force, const char *goal)
|
||||
|
||||
/* allocate space for a monster's name; removes old name if there is one */
|
||||
void
|
||||
new_mgivenname(struct monst *mon,
|
||||
int lth) /* desired length (caller handles adding 1
|
||||
for terminator) */
|
||||
new_mgivenname(
|
||||
struct monst *mon,
|
||||
int lth) /* desired length (caller handles adding 1 for terminator) */
|
||||
{
|
||||
if (lth) {
|
||||
/* allocate mextra if necessary; otherwise get rid of old name */
|
||||
@@ -1090,9 +1096,9 @@ free_mgivenname(struct monst *mon)
|
||||
|
||||
/* allocate space for an object's name; removes old name if there is one */
|
||||
void
|
||||
new_oname(struct obj *obj,
|
||||
int lth) /* desired length (caller handles adding 1
|
||||
for terminator) */
|
||||
new_oname(
|
||||
struct obj *obj,
|
||||
int lth) /* desired length (caller handles adding 1 for terminator) */
|
||||
{
|
||||
if (lth) {
|
||||
/* allocate oextra if necessary; otherwise get rid of old name */
|
||||
|
||||
Reference in New Issue
Block a user