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