Reindent main loop
No code change, just reindenting the main loop, as it wasn't reindented when the inner part was split into separate function.
This commit is contained in:
+302
-302
@@ -145,356 +145,356 @@ moveloop_core(void)
|
|||||||
boolean monscanmove = FALSE;
|
boolean monscanmove = FALSE;
|
||||||
|
|
||||||
#ifdef SAFERHANGUP
|
#ifdef SAFERHANGUP
|
||||||
if (g.program_state.done_hup)
|
if (g.program_state.done_hup)
|
||||||
end_of_input();
|
end_of_input();
|
||||||
#endif
|
#endif
|
||||||
get_nh_event();
|
get_nh_event();
|
||||||
#ifdef POSITIONBAR
|
#ifdef POSITIONBAR
|
||||||
do_positionbar();
|
do_positionbar();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (g.context.bypasses)
|
if (g.context.bypasses)
|
||||||
clear_bypasses();
|
clear_bypasses();
|
||||||
|
|
||||||
if (g.context.move) {
|
if (g.context.move) {
|
||||||
/* actual time passed */
|
/* actual time passed */
|
||||||
g.youmonst.movement -= NORMAL_SPEED;
|
g.youmonst.movement -= NORMAL_SPEED;
|
||||||
|
|
||||||
do { /* hero can't move this turn loop */
|
do { /* hero can't move this turn loop */
|
||||||
mvl_wtcap = encumber_msg();
|
mvl_wtcap = encumber_msg();
|
||||||
|
|
||||||
g.context.mon_moving = TRUE;
|
g.context.mon_moving = TRUE;
|
||||||
do {
|
do {
|
||||||
monscanmove = movemon();
|
monscanmove = movemon();
|
||||||
if (g.youmonst.movement >= NORMAL_SPEED)
|
if (g.youmonst.movement >= NORMAL_SPEED)
|
||||||
break; /* it's now your turn */
|
break; /* it's now your turn */
|
||||||
} while (monscanmove);
|
} while (monscanmove);
|
||||||
g.context.mon_moving = FALSE;
|
g.context.mon_moving = FALSE;
|
||||||
|
|
||||||
if (!monscanmove && g.youmonst.movement < NORMAL_SPEED) {
|
if (!monscanmove && g.youmonst.movement < NORMAL_SPEED) {
|
||||||
/* both hero and monsters are out of steam this round */
|
/* both hero and monsters are out of steam this round */
|
||||||
struct monst *mtmp;
|
struct monst *mtmp;
|
||||||
|
|
||||||
/* set up for a new turn */
|
/* set up for a new turn */
|
||||||
mcalcdistress(); /* adjust monsters' trap, blind, etc */
|
mcalcdistress(); /* adjust monsters' trap, blind, etc */
|
||||||
|
|
||||||
/* reallocate movement rations to monsters; don't need
|
/* reallocate movement rations to monsters; don't need
|
||||||
to skip dead monsters here because they will have
|
to skip dead monsters here because they will have
|
||||||
been purged at end of their previous round of moving */
|
been purged at end of their previous round of moving */
|
||||||
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
|
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
|
||||||
mtmp->movement += mcalcmove(mtmp, TRUE);
|
mtmp->movement += mcalcmove(mtmp, TRUE);
|
||||||
|
|
||||||
/* occasionally add another monster; since this takes
|
/* occasionally add another monster; since this takes
|
||||||
place after movement has been allotted, the new
|
place after movement has been allotted, the new
|
||||||
monster effectively loses its first turn */
|
monster effectively loses its first turn */
|
||||||
if (!rn2(u.uevent.udemigod ? 25
|
if (!rn2(u.uevent.udemigod ? 25
|
||||||
: (depth(&u.uz) > depth(&stronghold_level)) ? 50
|
: (depth(&u.uz) > depth(&stronghold_level)) ? 50
|
||||||
: 70))
|
: 70))
|
||||||
(void) makemon((struct permonst *) 0, 0, 0,
|
(void) makemon((struct permonst *) 0, 0, 0,
|
||||||
NO_MM_FLAGS);
|
NO_MM_FLAGS);
|
||||||
|
|
||||||
u_calc_moveamt(mvl_wtcap);
|
u_calc_moveamt(mvl_wtcap);
|
||||||
settrack();
|
settrack();
|
||||||
|
|
||||||
g.monstermoves++; /* [obsolete (for a long time...)] */
|
g.monstermoves++; /* [obsolete (for a long time...)] */
|
||||||
g.moves++;
|
g.moves++;
|
||||||
/*
|
/*
|
||||||
* Never allow 'moves' to grow big enough to wrap.
|
* Never allow 'moves' to grow big enough to wrap.
|
||||||
* We don't care what the maximum possible 'long int'
|
* We don't care what the maximum possible 'long int'
|
||||||
* is for the current configuration, we want a value
|
* is for the current configuration, we want a value
|
||||||
* that is the same for all viable configurations.
|
* that is the same for all viable configurations.
|
||||||
* When imposing the limit, use a mystic decimal value
|
* When imposing the limit, use a mystic decimal value
|
||||||
* instead of a magic binary one such as 0x7fffffffL.
|
* instead of a magic binary one such as 0x7fffffffL.
|
||||||
*/
|
*/
|
||||||
if (g.moves >= 1000000000L) {
|
if (g.moves >= 1000000000L) {
|
||||||
display_nhwindow(WIN_MESSAGE, TRUE);
|
display_nhwindow(WIN_MESSAGE, TRUE);
|
||||||
pline_The("dungeon capitulates.");
|
pline_The("dungeon capitulates.");
|
||||||
done(ESCAPED);
|
done(ESCAPED);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags.time && !g.context.run)
|
||||||
|
iflags.time_botl = TRUE; /* 'moves' just changed */
|
||||||
|
|
||||||
|
/********************************/
|
||||||
|
/* once-per-turn things go here */
|
||||||
|
/********************************/
|
||||||
|
|
||||||
|
l_nhcore_call(NHCORE_MOVELOOP_TURN);
|
||||||
|
|
||||||
|
if (Glib)
|
||||||
|
glibr();
|
||||||
|
nh_timeout();
|
||||||
|
run_regions();
|
||||||
|
|
||||||
|
if (u.ublesscnt)
|
||||||
|
u.ublesscnt--;
|
||||||
|
|
||||||
|
/* One possible result of prayer is healing. Whether or
|
||||||
|
* not you get healed depends on your current hit points.
|
||||||
|
* If you are allowed to regenerate during the prayer,
|
||||||
|
* the end-of-prayer calculation messes up on this.
|
||||||
|
* Another possible result is rehumanization, which
|
||||||
|
* requires that encumbrance and movement rate be
|
||||||
|
* recalculated.
|
||||||
|
*/
|
||||||
|
if (u.uinvulnerable) {
|
||||||
|
/* for the moment at least, you're in tiptop shape */
|
||||||
|
mvl_wtcap = UNENCUMBERED;
|
||||||
|
} else if (!Upolyd ? (u.uhp < u.uhpmax)
|
||||||
|
: (u.mh < u.mhmax
|
||||||
|
|| g.youmonst.data->mlet == S_EEL)) {
|
||||||
|
/* maybe heal */
|
||||||
|
regen_hp(mvl_wtcap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* moving around while encumbered is hard work */
|
||||||
|
if (mvl_wtcap > MOD_ENCUMBER && u.umoved) {
|
||||||
|
if (!(mvl_wtcap < EXT_ENCUMBER ? g.moves % 30
|
||||||
|
: g.moves % 10)) {
|
||||||
|
overexert_hp();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (flags.time && !g.context.run)
|
if (u.uen < u.uenmax
|
||||||
iflags.time_botl = TRUE; /* 'moves' just changed */
|
&& ((mvl_wtcap < MOD_ENCUMBER
|
||||||
|
&& (!(g.moves % ((MAXULEV + 8 - u.ulevel)
|
||||||
|
* (Role_if(PM_WIZARD) ? 3 : 4)
|
||||||
|
/ 6)))) || Energy_regeneration)) {
|
||||||
|
u.uen += rn1(
|
||||||
|
(int) (ACURR(A_WIS) + ACURR(A_INT)) / 15 + 1, 1);
|
||||||
|
if (u.uen > u.uenmax)
|
||||||
|
u.uen = u.uenmax;
|
||||||
|
g.context.botl = TRUE;
|
||||||
|
if (u.uen == u.uenmax)
|
||||||
|
interrupt_multi("You feel full of energy.");
|
||||||
|
}
|
||||||
|
|
||||||
/********************************/
|
if (!u.uinvulnerable) {
|
||||||
/* once-per-turn things go here */
|
if (Teleportation && !rn2(85)) {
|
||||||
/********************************/
|
xchar old_ux = u.ux, old_uy = u.uy;
|
||||||
|
|
||||||
l_nhcore_call(NHCORE_MOVELOOP_TURN);
|
tele();
|
||||||
|
if (u.ux != old_ux || u.uy != old_uy) {
|
||||||
if (Glib)
|
if (!next_to_u()) {
|
||||||
glibr();
|
check_leash(old_ux, old_uy);
|
||||||
nh_timeout();
|
|
||||||
run_regions();
|
|
||||||
|
|
||||||
if (u.ublesscnt)
|
|
||||||
u.ublesscnt--;
|
|
||||||
|
|
||||||
/* One possible result of prayer is healing. Whether or
|
|
||||||
* not you get healed depends on your current hit points.
|
|
||||||
* If you are allowed to regenerate during the prayer,
|
|
||||||
* the end-of-prayer calculation messes up on this.
|
|
||||||
* Another possible result is rehumanization, which
|
|
||||||
* requires that encumbrance and movement rate be
|
|
||||||
* recalculated.
|
|
||||||
*/
|
|
||||||
if (u.uinvulnerable) {
|
|
||||||
/* for the moment at least, you're in tiptop shape */
|
|
||||||
mvl_wtcap = UNENCUMBERED;
|
|
||||||
} else if (!Upolyd ? (u.uhp < u.uhpmax)
|
|
||||||
: (u.mh < u.mhmax
|
|
||||||
|| g.youmonst.data->mlet == S_EEL)) {
|
|
||||||
/* maybe heal */
|
|
||||||
regen_hp(mvl_wtcap);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* moving around while encumbered is hard work */
|
|
||||||
if (mvl_wtcap > MOD_ENCUMBER && u.umoved) {
|
|
||||||
if (!(mvl_wtcap < EXT_ENCUMBER ? g.moves % 30
|
|
||||||
: g.moves % 10)) {
|
|
||||||
overexert_hp();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (u.uen < u.uenmax
|
|
||||||
&& ((mvl_wtcap < MOD_ENCUMBER
|
|
||||||
&& (!(g.moves % ((MAXULEV + 8 - u.ulevel)
|
|
||||||
* (Role_if(PM_WIZARD) ? 3 : 4)
|
|
||||||
/ 6)))) || Energy_regeneration)) {
|
|
||||||
u.uen += rn1(
|
|
||||||
(int) (ACURR(A_WIS) + ACURR(A_INT)) / 15 + 1, 1);
|
|
||||||
if (u.uen > u.uenmax)
|
|
||||||
u.uen = u.uenmax;
|
|
||||||
g.context.botl = TRUE;
|
|
||||||
if (u.uen == u.uenmax)
|
|
||||||
interrupt_multi("You feel full of energy.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!u.uinvulnerable) {
|
|
||||||
if (Teleportation && !rn2(85)) {
|
|
||||||
xchar old_ux = u.ux, old_uy = u.uy;
|
|
||||||
|
|
||||||
tele();
|
|
||||||
if (u.ux != old_ux || u.uy != old_uy) {
|
|
||||||
if (!next_to_u()) {
|
|
||||||
check_leash(old_ux, old_uy);
|
|
||||||
}
|
|
||||||
/* clear doagain keystrokes */
|
|
||||||
pushch(0);
|
|
||||||
savech(0);
|
|
||||||
}
|
}
|
||||||
|
/* clear doagain keystrokes */
|
||||||
|
pushch(0);
|
||||||
|
savech(0);
|
||||||
}
|
}
|
||||||
/* delayed change may not be valid anymore */
|
}
|
||||||
if ((mvl_change == 1 && !Polymorph)
|
/* delayed change may not be valid anymore */
|
||||||
|| (mvl_change == 2 && u.ulycn == NON_PM))
|
if ((mvl_change == 1 && !Polymorph)
|
||||||
|
|| (mvl_change == 2 && u.ulycn == NON_PM))
|
||||||
|
mvl_change = 0;
|
||||||
|
if (Polymorph && !rn2(100))
|
||||||
|
mvl_change = 1;
|
||||||
|
else if (u.ulycn >= LOW_PM && !Upolyd
|
||||||
|
&& !rn2(80 - (20 * night())))
|
||||||
|
mvl_change = 2;
|
||||||
|
if (mvl_change && !Unchanging) {
|
||||||
|
if (g.multi >= 0) {
|
||||||
|
stop_occupation();
|
||||||
|
if (mvl_change == 1)
|
||||||
|
polyself(0);
|
||||||
|
else
|
||||||
|
you_were();
|
||||||
mvl_change = 0;
|
mvl_change = 0;
|
||||||
if (Polymorph && !rn2(100))
|
|
||||||
mvl_change = 1;
|
|
||||||
else if (u.ulycn >= LOW_PM && !Upolyd
|
|
||||||
&& !rn2(80 - (20 * night())))
|
|
||||||
mvl_change = 2;
|
|
||||||
if (mvl_change && !Unchanging) {
|
|
||||||
if (g.multi >= 0) {
|
|
||||||
stop_occupation();
|
|
||||||
if (mvl_change == 1)
|
|
||||||
polyself(0);
|
|
||||||
else
|
|
||||||
you_were();
|
|
||||||
mvl_change = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Searching && g.multi >= 0)
|
|
||||||
(void) dosearch0(1);
|
|
||||||
if (Warning)
|
|
||||||
warnreveal();
|
|
||||||
mkot_trap_warn();
|
|
||||||
dosounds();
|
|
||||||
do_storms();
|
|
||||||
gethungry();
|
|
||||||
age_spells();
|
|
||||||
exerchk();
|
|
||||||
invault();
|
|
||||||
if (u.uhave.amulet)
|
|
||||||
amulet();
|
|
||||||
if (!rn2(40 + (int) (ACURR(A_DEX) * 3)))
|
|
||||||
u_wipe_engr(rnd(3));
|
|
||||||
if (u.uevent.udemigod && !u.uinvulnerable) {
|
|
||||||
if (u.udg_cnt)
|
|
||||||
u.udg_cnt--;
|
|
||||||
if (!u.udg_cnt) {
|
|
||||||
intervene();
|
|
||||||
u.udg_cnt = rn1(200, 50);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
restore_attrib();
|
|
||||||
/* XXX This should be recoded to use something like regions - a list of
|
|
||||||
* things that are active and need to be handled that is dynamically
|
|
||||||
* maintained and not a list of special cases. */
|
|
||||||
/* underwater and waterlevel vision are done here */
|
|
||||||
if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz))
|
|
||||||
movebubbles();
|
|
||||||
else if (Is_firelevel(&u.uz))
|
|
||||||
fumaroles();
|
|
||||||
else if (Underwater)
|
|
||||||
under_water(0);
|
|
||||||
/* vision while buried done here */
|
|
||||||
else if (u.uburied)
|
|
||||||
under_ground(0);
|
|
||||||
|
|
||||||
/* when immobile, count is in turns */
|
|
||||||
if (g.multi < 0) {
|
|
||||||
if (++g.multi == 0) { /* finished yet? */
|
|
||||||
unmul((char *) 0);
|
|
||||||
/* if unmul caused a level change, take it now */
|
|
||||||
if (u.utotype)
|
|
||||||
deferred_goto();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (g.youmonst.movement < NORMAL_SPEED); /* hero can't move */
|
|
||||||
|
|
||||||
/******************************************/
|
if (Searching && g.multi >= 0)
|
||||||
/* once-per-hero-took-time things go here */
|
(void) dosearch0(1);
|
||||||
/******************************************/
|
if (Warning)
|
||||||
|
warnreveal();
|
||||||
|
mkot_trap_warn();
|
||||||
|
dosounds();
|
||||||
|
do_storms();
|
||||||
|
gethungry();
|
||||||
|
age_spells();
|
||||||
|
exerchk();
|
||||||
|
invault();
|
||||||
|
if (u.uhave.amulet)
|
||||||
|
amulet();
|
||||||
|
if (!rn2(40 + (int) (ACURR(A_DEX) * 3)))
|
||||||
|
u_wipe_engr(rnd(3));
|
||||||
|
if (u.uevent.udemigod && !u.uinvulnerable) {
|
||||||
|
if (u.udg_cnt)
|
||||||
|
u.udg_cnt--;
|
||||||
|
if (!u.udg_cnt) {
|
||||||
|
intervene();
|
||||||
|
u.udg_cnt = rn1(200, 50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
restore_attrib();
|
||||||
|
/* XXX This should be recoded to use something like regions - a list of
|
||||||
|
* things that are active and need to be handled that is dynamically
|
||||||
|
* maintained and not a list of special cases. */
|
||||||
|
/* underwater and waterlevel vision are done here */
|
||||||
|
if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz))
|
||||||
|
movebubbles();
|
||||||
|
else if (Is_firelevel(&u.uz))
|
||||||
|
fumaroles();
|
||||||
|
else if (Underwater)
|
||||||
|
under_water(0);
|
||||||
|
/* vision while buried done here */
|
||||||
|
else if (u.uburied)
|
||||||
|
under_ground(0);
|
||||||
|
|
||||||
|
/* when immobile, count is in turns */
|
||||||
|
if (g.multi < 0) {
|
||||||
|
if (++g.multi == 0) { /* finished yet? */
|
||||||
|
unmul((char *) 0);
|
||||||
|
/* if unmul caused a level change, take it now */
|
||||||
|
if (u.utotype)
|
||||||
|
deferred_goto();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (g.youmonst.movement < NORMAL_SPEED); /* hero can't move */
|
||||||
|
|
||||||
|
/******************************************/
|
||||||
|
/* once-per-hero-took-time things go here */
|
||||||
|
/******************************************/
|
||||||
|
|
||||||
#ifdef STATUS_HILITES
|
#ifdef STATUS_HILITES
|
||||||
if (iflags.hilite_delta)
|
if (iflags.hilite_delta)
|
||||||
status_eval_next_unhilite();
|
status_eval_next_unhilite();
|
||||||
#endif
|
#endif
|
||||||
if (g.moves >= g.context.seer_turn) {
|
if (g.moves >= g.context.seer_turn) {
|
||||||
if ((u.uhave.amulet || Clairvoyant) && !In_endgame(&u.uz)
|
if ((u.uhave.amulet || Clairvoyant) && !In_endgame(&u.uz)
|
||||||
&& !BClairvoyant)
|
&& !BClairvoyant)
|
||||||
do_vicinity_map((struct obj *) 0);
|
do_vicinity_map((struct obj *) 0);
|
||||||
/* we maintain this counter even when clairvoyance isn't
|
/* we maintain this counter even when clairvoyance isn't
|
||||||
taking place; on average, go again 30 turns from now */
|
taking place; on average, go again 30 turns from now */
|
||||||
g.context.seer_turn = g.moves + (long) rn1(31, 15); /*15..45*/
|
g.context.seer_turn = g.moves + (long) rn1(31, 15); /*15..45*/
|
||||||
/* [it used to be that on every 15th turn, there was a 50%
|
/* [it used to be that on every 15th turn, there was a 50%
|
||||||
chance of farsight, so it could happen as often as every
|
chance of farsight, so it could happen as often as every
|
||||||
15 turns or theoretically never happen at all; but when
|
15 turns or theoretically never happen at all; but when
|
||||||
a fast hero got multiple moves on that 15th turn, it
|
a fast hero got multiple moves on that 15th turn, it
|
||||||
could actually happen more than once on the same turn!] */
|
could actually happen more than once on the same turn!] */
|
||||||
}
|
|
||||||
/* [fast hero who gets multiple moves per turn ends up sinking
|
|
||||||
multiple times per turn; is that what we really want?] */
|
|
||||||
if (u.utrap && u.utraptype == TT_LAVA)
|
|
||||||
sink_into_lava();
|
|
||||||
/* when/if hero escapes from lava, he can't just stay there */
|
|
||||||
else if (!u.umoved)
|
|
||||||
(void) pooleffects(FALSE);
|
|
||||||
|
|
||||||
} /* actual time passed */
|
|
||||||
|
|
||||||
/****************************************/
|
|
||||||
/* once-per-player-input things go here */
|
|
||||||
/****************************************/
|
|
||||||
|
|
||||||
clear_splitobjs();
|
|
||||||
find_ac();
|
|
||||||
if (!g.context.mv || Blind) {
|
|
||||||
/* redo monsters if hallu or wearing a helm of telepathy */
|
|
||||||
if (Hallucination) { /* update screen randomly */
|
|
||||||
see_monsters();
|
|
||||||
see_objects();
|
|
||||||
see_traps();
|
|
||||||
if (u.uswallow)
|
|
||||||
swallowed(0);
|
|
||||||
} else if (Unblind_telepat) {
|
|
||||||
see_monsters();
|
|
||||||
} else if (Warning || Warn_of_mon)
|
|
||||||
see_monsters();
|
|
||||||
|
|
||||||
if (g.vision_full_recalc)
|
|
||||||
vision_recalc(0); /* vision! */
|
|
||||||
}
|
|
||||||
if (g.context.botl || g.context.botlx) {
|
|
||||||
bot();
|
|
||||||
curs_on_u();
|
|
||||||
} else if (iflags.time_botl) {
|
|
||||||
timebot();
|
|
||||||
curs_on_u();
|
|
||||||
}
|
}
|
||||||
|
/* [fast hero who gets multiple moves per turn ends up sinking
|
||||||
|
multiple times per turn; is that what we really want?] */
|
||||||
|
if (u.utrap && u.utraptype == TT_LAVA)
|
||||||
|
sink_into_lava();
|
||||||
|
/* when/if hero escapes from lava, he can't just stay there */
|
||||||
|
else if (!u.umoved)
|
||||||
|
(void) pooleffects(FALSE);
|
||||||
|
|
||||||
g.context.move = 1;
|
} /* actual time passed */
|
||||||
|
|
||||||
if (g.multi >= 0 && g.occupation) {
|
/****************************************/
|
||||||
|
/* once-per-player-input things go here */
|
||||||
|
/****************************************/
|
||||||
|
|
||||||
|
clear_splitobjs();
|
||||||
|
find_ac();
|
||||||
|
if (!g.context.mv || Blind) {
|
||||||
|
/* redo monsters if hallu or wearing a helm of telepathy */
|
||||||
|
if (Hallucination) { /* update screen randomly */
|
||||||
|
see_monsters();
|
||||||
|
see_objects();
|
||||||
|
see_traps();
|
||||||
|
if (u.uswallow)
|
||||||
|
swallowed(0);
|
||||||
|
} else if (Unblind_telepat) {
|
||||||
|
see_monsters();
|
||||||
|
} else if (Warning || Warn_of_mon)
|
||||||
|
see_monsters();
|
||||||
|
|
||||||
|
if (g.vision_full_recalc)
|
||||||
|
vision_recalc(0); /* vision! */
|
||||||
|
}
|
||||||
|
if (g.context.botl || g.context.botlx) {
|
||||||
|
bot();
|
||||||
|
curs_on_u();
|
||||||
|
} else if (iflags.time_botl) {
|
||||||
|
timebot();
|
||||||
|
curs_on_u();
|
||||||
|
}
|
||||||
|
|
||||||
|
g.context.move = 1;
|
||||||
|
|
||||||
|
if (g.multi >= 0 && g.occupation) {
|
||||||
#if defined(MICRO) || defined(WIN32)
|
#if defined(MICRO) || defined(WIN32)
|
||||||
mvl_abort_lev = 0;
|
mvl_abort_lev = 0;
|
||||||
if (kbhit()) {
|
if (kbhit()) {
|
||||||
char ch;
|
char ch;
|
||||||
|
|
||||||
if ((ch = pgetchar()) == ABORT)
|
if ((ch = pgetchar()) == ABORT)
|
||||||
mvl_abort_lev++;
|
mvl_abort_lev++;
|
||||||
else
|
else
|
||||||
pushch(ch);
|
pushch(ch);
|
||||||
}
|
}
|
||||||
if (!mvl_abort_lev && (*g.occupation)() == 0)
|
if (!mvl_abort_lev && (*g.occupation)() == 0)
|
||||||
#else
|
#else
|
||||||
if ((*g.occupation)() == 0)
|
if ((*g.occupation)() == 0)
|
||||||
#endif
|
#endif
|
||||||
g.occupation = 0;
|
g.occupation = 0;
|
||||||
if (
|
if (
|
||||||
#if defined(MICRO) || defined(WIN32)
|
#if defined(MICRO) || defined(WIN32)
|
||||||
mvl_abort_lev ||
|
mvl_abort_lev ||
|
||||||
#endif
|
#endif
|
||||||
monster_nearby()) {
|
monster_nearby()) {
|
||||||
stop_occupation();
|
stop_occupation();
|
||||||
reset_eat();
|
reset_eat();
|
||||||
}
|
|
||||||
#if defined(MICRO) || defined(WIN32)
|
|
||||||
if (!(++g.occtime % 7))
|
|
||||||
display_nhwindow(WIN_MAP, FALSE);
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
#if defined(MICRO) || defined(WIN32)
|
||||||
|
if (!(++g.occtime % 7))
|
||||||
|
display_nhwindow(WIN_MAP, FALSE);
|
||||||
|
#endif
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (iflags.sanity_check || iflags.debug_fuzzer)
|
if (iflags.sanity_check || iflags.debug_fuzzer)
|
||||||
sanity_check();
|
sanity_check();
|
||||||
|
|
||||||
#ifdef CLIPPING
|
#ifdef CLIPPING
|
||||||
/* just before rhack */
|
/* just before rhack */
|
||||||
cliparound(u.ux, u.uy);
|
cliparound(u.ux, u.uy);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
u.umoved = FALSE;
|
u.umoved = FALSE;
|
||||||
|
|
||||||
if (g.multi > 0) {
|
if (g.multi > 0) {
|
||||||
lookaround();
|
lookaround();
|
||||||
if (!g.multi) {
|
if (!g.multi) {
|
||||||
/* lookaround may clear multi */
|
/* lookaround may clear multi */
|
||||||
g.context.move = 0;
|
g.context.move = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (g.context.mv) {
|
if (g.context.mv) {
|
||||||
if (g.multi < COLNO && !--g.multi)
|
if (g.multi < COLNO && !--g.multi)
|
||||||
g.context.travel = g.context.travel1 = g.context.mv =
|
g.context.travel = g.context.travel1 = g.context.mv =
|
||||||
g.context.run = 0;
|
g.context.run = 0;
|
||||||
domove();
|
domove();
|
||||||
} else {
|
} else {
|
||||||
--g.multi;
|
--g.multi;
|
||||||
nhassert(g.command_count != 0);
|
nhassert(g.command_count != 0);
|
||||||
rhack(g.command_line);
|
rhack(g.command_line);
|
||||||
}
|
}
|
||||||
} else if (g.multi == 0) {
|
} else if (g.multi == 0) {
|
||||||
#ifdef MAIL
|
#ifdef MAIL
|
||||||
ckmailstatus();
|
ckmailstatus();
|
||||||
#endif
|
#endif
|
||||||
rhack((char *) 0);
|
rhack((char *) 0);
|
||||||
}
|
}
|
||||||
if (u.utotype) /* change dungeon level */
|
if (u.utotype) /* change dungeon level */
|
||||||
deferred_goto(); /* after rhack() */
|
deferred_goto(); /* after rhack() */
|
||||||
|
|
||||||
if (g.vision_full_recalc)
|
if (g.vision_full_recalc)
|
||||||
vision_recalc(0); /* vision! */
|
vision_recalc(0); /* vision! */
|
||||||
/* when running in non-tport mode, this gets done through domove() */
|
/* when running in non-tport mode, this gets done through domove() */
|
||||||
if ((!g.context.run || flags.runmode == RUN_TPORT)
|
if ((!g.context.run || flags.runmode == RUN_TPORT)
|
||||||
&& (g.multi && (!g.context.travel ? !(g.multi % 7)
|
&& (g.multi && (!g.context.travel ? !(g.multi % 7)
|
||||||
: !(g.moves % 7L)))) {
|
: !(g.moves % 7L)))) {
|
||||||
if (flags.time && g.context.run)
|
if (flags.time && g.context.run)
|
||||||
g.context.botl = TRUE;
|
g.context.botl = TRUE;
|
||||||
/* [should this be flush_screen() instead?] */
|
/* [should this be flush_screen() instead?] */
|
||||||
display_nhwindow(WIN_MAP, FALSE);
|
display_nhwindow(WIN_MAP, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user