Restrict the teleportation notification to actual teleportations
teleds() is used for more than just teleportations, the teleportation message was also given when mounting a steed. Trying out a new bit flags method parameter design pattern.
This commit is contained in:
+3
-3
@@ -144,7 +144,7 @@ E void FDECL(Lift_covet_and_placebc, (int, const char *, int));
|
|||||||
#define unplacebc_and_covet_placebc() \
|
#define unplacebc_and_covet_placebc() \
|
||||||
Unplacebc_and_covet_placebc(__FUNCTION__, __LINE__)
|
Unplacebc_and_covet_placebc(__FUNCTION__, __LINE__)
|
||||||
#define lift_covet_and_placebc(x) \
|
#define lift_covet_and_placebc(x) \
|
||||||
Lift_covet_and_placebc(x, __FUNCTION__, __LINE__)
|
Lift_covet_and_placebc(x, __FUNCTION__, __LINE__)
|
||||||
#endif
|
#endif
|
||||||
E void FDECL(set_bc, (int));
|
E void FDECL(set_bc, (int));
|
||||||
E void FDECL(move_bc, (int, int, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P));
|
E void FDECL(move_bc, (int, int, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P));
|
||||||
@@ -2530,8 +2530,8 @@ E boolean FDECL(goodpos, (int, int, struct monst *, unsigned));
|
|||||||
E boolean FDECL(enexto, (coord *, XCHAR_P, XCHAR_P, struct permonst *));
|
E boolean FDECL(enexto, (coord *, XCHAR_P, XCHAR_P, struct permonst *));
|
||||||
E boolean FDECL(enexto_core, (coord *, XCHAR_P, XCHAR_P,
|
E boolean FDECL(enexto_core, (coord *, XCHAR_P, XCHAR_P,
|
||||||
struct permonst *, unsigned));
|
struct permonst *, unsigned));
|
||||||
E void FDECL(teleds, (int, int, BOOLEAN_P));
|
E void FDECL(teleds, (int, int, int));
|
||||||
E boolean FDECL(safe_teleds, (BOOLEAN_P));
|
E boolean FDECL(safe_teleds, (int));
|
||||||
E boolean FDECL(teleport_pet, (struct monst *, BOOLEAN_P));
|
E boolean FDECL(teleport_pet, (struct monst *, BOOLEAN_P));
|
||||||
E void NDECL(tele);
|
E void NDECL(tele);
|
||||||
E boolean FDECL(scrolltele, (struct obj *));
|
E boolean FDECL(scrolltele, (struct obj *));
|
||||||
|
|||||||
+1
-1
@@ -143,7 +143,7 @@ struct cross_target_s {
|
|||||||
unsigned long build_time;
|
unsigned long build_time;
|
||||||
};
|
};
|
||||||
extern struct cross_target_s cross_target;
|
extern struct cross_target_s cross_target;
|
||||||
#if defined(CROSSCOMPILE_TARGET) && !defined(MAKEDEFS_C)
|
#if defined(CROSSCOMPILE_TARGET) && !defined(MAKEDEFS_C)
|
||||||
#define BUILD_DATE cross_target.build_date /* "Wed Apr 1 00:00:01 2020" */
|
#define BUILD_DATE cross_target.build_date /* "Wed Apr 1 00:00:01 2020" */
|
||||||
#define COPYRIGHT_BANNER_C cross_target.copyright_banner_c
|
#define COPYRIGHT_BANNER_C cross_target.copyright_banner_c
|
||||||
#define NETHACK_GIT_SHA cross_target.git_sha
|
#define NETHACK_GIT_SHA cross_target.git_sha
|
||||||
|
|||||||
@@ -490,6 +490,11 @@ enum bodypart_types {
|
|||||||
#define MENU_FULL 2
|
#define MENU_FULL 2
|
||||||
#define MENU_PARTIAL 3
|
#define MENU_PARTIAL 3
|
||||||
|
|
||||||
|
/* flags to control teleds() */
|
||||||
|
#define TELEDS_NO_FLAGS 0
|
||||||
|
#define TELEDS_ALLOW_DRAG 1
|
||||||
|
#define TELEDS_TELEPORT 2
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Option flags
|
* Option flags
|
||||||
* Each higher number includes the characteristics of the numbers
|
* Each higher number includes the characteristics of the numbers
|
||||||
|
|||||||
+2
-2
@@ -1807,7 +1807,7 @@ int magic; /* 0=Physical, otherwise skill level */
|
|||||||
* and usually moves the ball if punished, but does not handle all
|
* and usually moves the ball if punished, but does not handle all
|
||||||
* the effects of landing on the final position.
|
* the effects of landing on the final position.
|
||||||
*/
|
*/
|
||||||
teleds(cc.x, cc.y, FALSE);
|
teleds(cc.x, cc.y, TELEDS_NO_FLAGS);
|
||||||
nomul(-1);
|
nomul(-1);
|
||||||
g.multi_reason = "jumping around";
|
g.multi_reason = "jumping around";
|
||||||
g.nomovemsg = "";
|
g.nomovemsg = "";
|
||||||
@@ -2755,7 +2755,7 @@ struct obj *obj;
|
|||||||
if (proficient && rn2(proficient + 2)) {
|
if (proficient && rn2(proficient + 2)) {
|
||||||
if (!mtmp || enexto(&cc, rx, ry, g.youmonst.data)) {
|
if (!mtmp || enexto(&cc, rx, ry, g.youmonst.data)) {
|
||||||
You("yank yourself out of the pit!");
|
You("yank yourself out of the pit!");
|
||||||
teleds(cc.x, cc.y, TRUE);
|
teleds(cc.x, cc.y, TELEDS_ALLOW_DRAG);
|
||||||
reset_utrap(TRUE);
|
reset_utrap(TRUE);
|
||||||
g.vision_full_recalc = 1;
|
g.vision_full_recalc = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -435,7 +435,7 @@ int xkill_flags, how;
|
|||||||
if (enexto(&xy, etmp->ex, etmp->ey, etmp->edata)) {
|
if (enexto(&xy, etmp->ex, etmp->ey, etmp->edata)) {
|
||||||
pline("A %s force teleports you away...",
|
pline("A %s force teleports you away...",
|
||||||
Hallucination ? "normal" : "strange");
|
Hallucination ? "normal" : "strange");
|
||||||
teleds(xy.x, xy.y, FALSE);
|
teleds(xy.x, xy.y, TELEDS_NO_FLAGS);
|
||||||
}
|
}
|
||||||
/* otherwise on top of the drawbridge is the
|
/* otherwise on top of the drawbridge is the
|
||||||
* only viable spot in the dungeon, so stay there
|
* only viable spot in the dungeon, so stay there
|
||||||
|
|||||||
+1
-1
@@ -453,7 +453,7 @@ register struct monst *mtmp;
|
|||||||
if (m_at(cc.x, cc.y))
|
if (m_at(cc.x, cc.y))
|
||||||
(void) enexto(&cc, u.ux, u.uy, g.youmonst.data);
|
(void) enexto(&cc, u.ux, u.uy, g.youmonst.data);
|
||||||
}
|
}
|
||||||
teleds(cc.x, cc.y, TRUE); /* move hero */
|
teleds(cc.x, cc.y, TELEDS_ALLOW_DRAG); /* move hero */
|
||||||
set_apparxy(mtmp);
|
set_apparxy(mtmp);
|
||||||
newsym(u.ux, u.uy);
|
newsym(u.ux, u.uy);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -353,7 +353,7 @@ boolean force; /* Quietly force this animal */
|
|||||||
g.unweapon = FALSE;
|
g.unweapon = FALSE;
|
||||||
u.usteed = mtmp;
|
u.usteed = mtmp;
|
||||||
remove_monster(mtmp->mx, mtmp->my);
|
remove_monster(mtmp->mx, mtmp->my);
|
||||||
teleds(mtmp->mx, mtmp->my, TRUE);
|
teleds(mtmp->mx, mtmp->my, TELEDS_ALLOW_DRAG);
|
||||||
g.context.botl = TRUE;
|
g.context.botl = TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -645,7 +645,7 @@ int reason; /* Player was thrown off etc. */
|
|||||||
* teleds() clears u.utrap
|
* teleds() clears u.utrap
|
||||||
*/
|
*/
|
||||||
g.in_steed_dismounting = TRUE;
|
g.in_steed_dismounting = TRUE;
|
||||||
teleds(cc.x, cc.y, TRUE);
|
teleds(cc.x, cc.y, TELEDS_ALLOW_DRAG);
|
||||||
g.in_steed_dismounting = FALSE;
|
g.in_steed_dismounting = FALSE;
|
||||||
|
|
||||||
/* Put your steed in your trap */
|
/* Put your steed in your trap */
|
||||||
|
|||||||
+12
-10
@@ -277,11 +277,13 @@ boolean trapok;
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
teleds(nux, nuy, allow_drag)
|
teleds(nux, nuy, teleds_flags)
|
||||||
register int nux, nuy;
|
int nux, nuy;
|
||||||
boolean allow_drag;
|
int teleds_flags;
|
||||||
{
|
{
|
||||||
boolean ball_active, ball_still_in_range;
|
boolean ball_active, ball_still_in_range;
|
||||||
|
boolean allow_drag = teleds_flags & TELEDS_ALLOW_DRAG;
|
||||||
|
boolean is_teleport = teleds_flags & TELEDS_TELEPORT;
|
||||||
struct monst *vault_guard = vault_occupied(u.urooms) ? findgd() : 0;
|
struct monst *vault_guard = vault_occupied(u.urooms) ? findgd() : 0;
|
||||||
|
|
||||||
if (u.utraptype == TT_BURIEDBALL) {
|
if (u.utraptype == TT_BURIEDBALL) {
|
||||||
@@ -356,7 +358,7 @@ boolean allow_drag;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags.verbose)
|
if (is_teleport && flags.verbose)
|
||||||
You("materialize in %s location!",
|
You("materialize in %s location!",
|
||||||
(nux == u.ux0 && nuy == u.uy0) ? "the same" : "a different");
|
(nux == u.ux0 && nuy == u.uy0) ? "the same" : "a different");
|
||||||
|
|
||||||
@@ -415,8 +417,8 @@ boolean allow_drag;
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
safe_teleds(allow_drag)
|
safe_teleds(teleds_flags)
|
||||||
boolean allow_drag;
|
int teleds_flags;
|
||||||
{
|
{
|
||||||
register int nux, nuy, tcnt = 0;
|
register int nux, nuy, tcnt = 0;
|
||||||
|
|
||||||
@@ -426,7 +428,7 @@ boolean allow_drag;
|
|||||||
} while (!teleok(nux, nuy, (boolean) (tcnt > 200)) && ++tcnt <= 400);
|
} while (!teleok(nux, nuy, (boolean) (tcnt > 200)) && ++tcnt <= 400);
|
||||||
|
|
||||||
if (tcnt <= 400) {
|
if (tcnt <= 400) {
|
||||||
teleds(nux, nuy, allow_drag);
|
teleds(nux, nuy, teleds_flags);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else
|
} else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -439,7 +441,7 @@ vault_tele()
|
|||||||
coord c;
|
coord c;
|
||||||
|
|
||||||
if (croom && somexy(croom, &c) && teleok(c.x, c.y, FALSE)) {
|
if (croom && somexy(croom, &c) && teleok(c.x, c.y, FALSE)) {
|
||||||
teleds(c.x, c.y, FALSE);
|
teleds(c.x, c.y, TELEDS_TELEPORT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tele();
|
tele();
|
||||||
@@ -529,7 +531,7 @@ struct obj *scroll;
|
|||||||
/* for scroll, discover it regardless of destination */
|
/* for scroll, discover it regardless of destination */
|
||||||
if (scroll)
|
if (scroll)
|
||||||
learnscroll(scroll);
|
learnscroll(scroll);
|
||||||
teleds(cc.x, cc.y, FALSE);
|
teleds(cc.x, cc.y, TELEDS_TELEPORT);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
pline("Sorry...");
|
pline("Sorry...");
|
||||||
@@ -543,7 +545,7 @@ struct obj *scroll;
|
|||||||
}
|
}
|
||||||
|
|
||||||
g.telescroll = scroll;
|
g.telescroll = scroll;
|
||||||
(void) safe_teleds(FALSE);
|
(void) safe_teleds(TELEDS_TELEPORT);
|
||||||
/* teleds() will leave g.telescroll intact iff random destination
|
/* teleds() will leave g.telescroll intact iff random destination
|
||||||
is far enough away for scroll discovery to be warranted */
|
is far enough away for scroll discovery to be warranted */
|
||||||
if (g.telescroll)
|
if (g.telescroll)
|
||||||
|
|||||||
+4
-4
@@ -3858,7 +3858,7 @@ drown()
|
|||||||
You("dump some of your gear to lose weight...");
|
You("dump some of your gear to lose weight...");
|
||||||
if (succ) {
|
if (succ) {
|
||||||
pline("Pheew! That was close.");
|
pline("Pheew! That was close.");
|
||||||
teleds(x, y, TRUE);
|
teleds(x, y, TELEDS_ALLOW_DRAG);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
/* still too much weight */
|
/* still too much weight */
|
||||||
@@ -3877,7 +3877,7 @@ drown()
|
|||||||
Strcpy(g.killer.name, pool_of_water);
|
Strcpy(g.killer.name, pool_of_water);
|
||||||
done(DROWNING);
|
done(DROWNING);
|
||||||
/* oops, we're still alive. better get out of the water. */
|
/* oops, we're still alive. better get out of the water. */
|
||||||
if (safe_teleds(TRUE))
|
if (safe_teleds(TELEDS_ALLOW_DRAG | TELEDS_TELEPORT))
|
||||||
break; /* successful life-save */
|
break; /* successful life-save */
|
||||||
/* nowhere safe to land; repeat drowning loop... */
|
/* nowhere safe to land; repeat drowning loop... */
|
||||||
pline("You're still drowning.");
|
pline("You're still drowning.");
|
||||||
@@ -5348,7 +5348,7 @@ lava_effects()
|
|||||||
Strcpy(g.killer.name, lava_killer);
|
Strcpy(g.killer.name, lava_killer);
|
||||||
You("%s...", boil_away ? "boil away" : "burn to a crisp");
|
You("%s...", boil_away ? "boil away" : "burn to a crisp");
|
||||||
done(BURNING);
|
done(BURNING);
|
||||||
if (safe_teleds(TRUE))
|
if (safe_teleds(TELEDS_ALLOW_DRAG | TELEDS_TELEPORT))
|
||||||
break; /* successful life-save */
|
break; /* successful life-save */
|
||||||
/* nowhere safe to land; repeat burning loop */
|
/* nowhere safe to land; repeat burning loop */
|
||||||
pline("You're still burning.");
|
pline("You're still burning.");
|
||||||
@@ -5408,7 +5408,7 @@ sink_into_lava()
|
|||||||
reset_utrap(TRUE);
|
reset_utrap(TRUE);
|
||||||
/* levitation or flight have become unblocked, otherwise Tport */
|
/* levitation or flight have become unblocked, otherwise Tport */
|
||||||
if (!Levitation && !Flying)
|
if (!Levitation && !Flying)
|
||||||
(void) safe_teleds(TRUE);
|
(void) safe_teleds(TELEDS_ALLOW_DRAG | TELEDS_TELEPORT);
|
||||||
} else if (!u.umoved) {
|
} else if (!u.umoved) {
|
||||||
/* can't fully turn into slime while in lava, but might not
|
/* can't fully turn into slime while in lava, but might not
|
||||||
have it be burned away until you've come awfully close */
|
have it be burned away until you've come awfully close */
|
||||||
|
|||||||
Reference in New Issue
Block a user