hangup vs u.uinwater again (trunk only)
Redo the fix that prevents hangup from putting hero on top of water if it occurs during magic mapping or object/gold/trap detection. Instead of copying u.uinwater into another field in struct u so that it can be reset during restore, copy it into a new field in struct iflags and reset it during save so that no fixup upon restore is needed.
This commit is contained in:
@@ -306,6 +306,11 @@ struct instance_flags {
|
|||||||
#define MAX_ALTKEYHANDLER 25
|
#define MAX_ALTKEYHANDLER 25
|
||||||
char altkeyhandler[MAX_ALTKEYHANDLER];
|
char altkeyhandler[MAX_ALTKEYHANDLER];
|
||||||
#endif
|
#endif
|
||||||
|
/* copies of values in struct u, used during detection when the
|
||||||
|
originals are temporarily cleared; kept here rather than
|
||||||
|
locally so that they can be restored during a hangup save */
|
||||||
|
Bitfield(save_uinwater,1);
|
||||||
|
Bitfield(save_uburied,1);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -227,14 +227,6 @@ struct Align {
|
|||||||
|
|
||||||
extern const struct Align aligns[]; /* table of available alignments */
|
extern const struct Align aligns[]; /* table of available alignments */
|
||||||
|
|
||||||
/* hangup handling; sometimes u.uinwater is overridden, and we need to
|
|
||||||
be able to reset it in the event of restoring from a hangup save;
|
|
||||||
save/override/restore takes place during normal execution, so this
|
|
||||||
isn't dependent upon current port's signal handling capability */
|
|
||||||
struct huphack {
|
|
||||||
Bitfield(hup_uinwater,1);
|
|
||||||
Bitfield(hup_uburied,1);
|
|
||||||
};
|
|
||||||
|
|
||||||
/*** Information about the player ***/
|
/*** Information about the player ***/
|
||||||
struct you {
|
struct you {
|
||||||
@@ -368,7 +360,6 @@ struct you {
|
|||||||
xchar skill_record[P_SKILL_LIMIT]; /* skill advancements */
|
xchar skill_record[P_SKILL_LIMIT]; /* skill advancements */
|
||||||
struct skills weapon_skills[P_NUM_SKILLS];
|
struct skills weapon_skills[P_NUM_SKILLS];
|
||||||
boolean twoweap; /* KMH -- Using two-weapon combat */
|
boolean twoweap; /* KMH -- Using two-weapon combat */
|
||||||
struct huphack save; /* hup_{uinwater,uburied} */
|
|
||||||
|
|
||||||
}; /* end of `struct you' */
|
}; /* end of `struct you' */
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -233,7 +233,7 @@ register struct obj *sobj;
|
|||||||
outgoldmap:
|
outgoldmap:
|
||||||
cls();
|
cls();
|
||||||
|
|
||||||
u.save.hup_uinwater = u.uinwater, u.save.hup_uburied = u.uburied;
|
iflags.save_uinwater = u.uinwater, iflags.save_uburied = u.uburied;
|
||||||
u.uinwater = u.uburied = 0;
|
u.uinwater = u.uburied = 0;
|
||||||
/* Discover gold locations. */
|
/* Discover gold locations. */
|
||||||
for (obj = fobj; obj; obj = obj->nobj) {
|
for (obj = fobj; obj; obj = obj->nobj) {
|
||||||
@@ -278,7 +278,7 @@ outgoldmap:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
newsym(u.ux,u.uy);
|
newsym(u.ux,u.uy);
|
||||||
u.uinwater = u.save.hup_uinwater, u.uburied = u.save.hup_uburied;
|
u.uinwater = iflags.save_uinwater, u.uburied = iflags.save_uburied;
|
||||||
You_feel("very greedy, and sense gold!");
|
You_feel("very greedy, and sense gold!");
|
||||||
exercise(A_WIS, TRUE);
|
exercise(A_WIS, TRUE);
|
||||||
display_nhwindow(WIN_MAP, TRUE);
|
display_nhwindow(WIN_MAP, TRUE);
|
||||||
@@ -351,7 +351,7 @@ register struct obj *sobj;
|
|||||||
struct obj *temp;
|
struct obj *temp;
|
||||||
known = TRUE;
|
known = TRUE;
|
||||||
cls();
|
cls();
|
||||||
u.save.hup_uinwater = u.uinwater, u.save.hup_uburied = u.uburied;
|
iflags.save_uinwater = u.uinwater, iflags.save_uburied = u.uburied;
|
||||||
u.uinwater = u.uburied = 0;
|
u.uinwater = u.uburied = 0;
|
||||||
for (obj = fobj; obj; obj = obj->nobj)
|
for (obj = fobj; obj; obj = obj->nobj)
|
||||||
if ((temp = o_in(obj, oclass)) != 0) {
|
if ((temp = o_in(obj, oclass)) != 0) {
|
||||||
@@ -371,7 +371,7 @@ register struct obj *sobj;
|
|||||||
break; /* skip rest of this monster's inventory */
|
break; /* skip rest of this monster's inventory */
|
||||||
}
|
}
|
||||||
newsym(u.ux,u.uy);
|
newsym(u.ux,u.uy);
|
||||||
u.uinwater = u.save.hup_uinwater, u.uburied = u.save.hup_uburied;
|
u.uinwater = iflags.save_uinwater, u.uburied = iflags.save_uburied;
|
||||||
if (sobj) {
|
if (sobj) {
|
||||||
if (sobj->blessed) {
|
if (sobj->blessed) {
|
||||||
Your("%s %s to tingle and you smell %s.", body_part(NOSE),
|
Your("%s %s to tingle and you smell %s.", body_part(NOSE),
|
||||||
@@ -482,7 +482,7 @@ int class; /* an object class, 0 for all */
|
|||||||
|
|
||||||
cls();
|
cls();
|
||||||
|
|
||||||
u.save.hup_uinwater = u.uinwater, u.save.hup_uburied = u.uburied;
|
iflags.save_uinwater = u.uinwater, iflags.save_uburied = u.uburied;
|
||||||
u.uinwater = u.uburied = 0;
|
u.uinwater = u.uburied = 0;
|
||||||
/*
|
/*
|
||||||
* Map all buried objects first.
|
* Map all buried objects first.
|
||||||
@@ -560,7 +560,7 @@ int class; /* an object class, 0 for all */
|
|||||||
}
|
}
|
||||||
|
|
||||||
newsym(u.ux,u.uy);
|
newsym(u.ux,u.uy);
|
||||||
u.uinwater = u.save.hup_uinwater, u.uburied = u.save.hup_uburied;
|
u.uinwater = iflags.save_uinwater, u.uburied = iflags.save_uburied;
|
||||||
You("detect the %s of %s.", ct ? "presence" : "absence", stuff);
|
You("detect the %s of %s.", ct ? "presence" : "absence", stuff);
|
||||||
display_nhwindow(WIN_MAP, TRUE);
|
display_nhwindow(WIN_MAP, TRUE);
|
||||||
/*
|
/*
|
||||||
@@ -766,7 +766,7 @@ register struct obj *sobj;
|
|||||||
outtrapmap:
|
outtrapmap:
|
||||||
cls();
|
cls();
|
||||||
|
|
||||||
u.save.hup_uinwater = u.uinwater, u.save.hup_uburied = u.uburied;
|
iflags.save_uinwater = u.uinwater, iflags.save_uburied = u.uburied;
|
||||||
u.uinwater = u.uburied = 0;
|
u.uinwater = u.uburied = 0;
|
||||||
|
|
||||||
/* show chest traps first, so that subsequent floor trap display
|
/* show chest traps first, so that subsequent floor trap display
|
||||||
@@ -792,7 +792,7 @@ outtrapmap:
|
|||||||
glyph = glyph_at(u.ux, u.uy);
|
glyph = glyph_at(u.ux, u.uy);
|
||||||
if (!(glyph_is_trap(glyph) || glyph_is_object(glyph)))
|
if (!(glyph_is_trap(glyph) || glyph_is_object(glyph)))
|
||||||
newsym(u.ux, u.uy);
|
newsym(u.ux, u.uy);
|
||||||
u.uinwater = u.save.hup_uinwater, u.uburied = u.save.hup_uburied;
|
u.uinwater = iflags.save_uinwater, u.uburied = iflags.save_uburied;
|
||||||
|
|
||||||
You_feel("%s.", cursed_src ? "very greedy" : "entrapped");
|
You_feel("%s.", cursed_src ? "very greedy" : "entrapped");
|
||||||
/* wait for user to respond, then reset map display to normal */
|
/* wait for user to respond, then reset map display to normal */
|
||||||
@@ -1005,12 +1005,12 @@ do_mapping()
|
|||||||
{
|
{
|
||||||
register int zx, zy;
|
register int zx, zy;
|
||||||
|
|
||||||
u.save.hup_uinwater = u.uinwater, u.save.hup_uburied = u.uburied;
|
iflags.save_uinwater = u.uinwater, iflags.save_uburied = u.uburied;
|
||||||
u.uinwater = u.uburied = 0;
|
u.uinwater = u.uburied = 0;
|
||||||
for (zx = 1; zx < COLNO; zx++)
|
for (zx = 1; zx < COLNO; zx++)
|
||||||
for (zy = 0; zy < ROWNO; zy++)
|
for (zy = 0; zy < ROWNO; zy++)
|
||||||
show_map_spot(zx, zy);
|
show_map_spot(zx, zy);
|
||||||
u.uinwater = u.save.hup_uinwater, u.uburied = u.save.hup_uburied;
|
u.uinwater = iflags.save_uinwater, u.uburied = iflags.save_uburied;
|
||||||
if (!level.flags.hero_memory || Underwater) {
|
if (!level.flags.hero_memory || Underwater) {
|
||||||
flush_screen(1); /* flush temp screen */
|
flush_screen(1); /* flush temp screen */
|
||||||
display_nhwindow(WIN_MAP, TRUE); /* wait */
|
display_nhwindow(WIN_MAP, TRUE); /* wait */
|
||||||
|
|||||||
@@ -857,11 +857,6 @@ register int fd;
|
|||||||
*/
|
*/
|
||||||
reset_restpref();
|
reset_restpref();
|
||||||
|
|
||||||
/* some fixups in case this was a hangup save */
|
|
||||||
u.uinvulnerable = 0;
|
|
||||||
if (u.save.hup_uinwater) u.uinwater = 1, u.save.hup_uinwater = 0;
|
|
||||||
if (u.save.hup_uburied) u.uburied = 1, u.save.hup_uburied = 0;
|
|
||||||
|
|
||||||
restlevelstate(stuckid, steedid);
|
restlevelstate(stuckid, steedid);
|
||||||
program_state.something_worth_saving = 1; /* useful data now exists */
|
program_state.something_worth_saving = 1; /* useful data now exists */
|
||||||
|
|
||||||
|
|||||||
@@ -139,6 +139,13 @@ dosave0()
|
|||||||
d_level uz_save;
|
d_level uz_save;
|
||||||
char whynot[BUFSZ];
|
char whynot[BUFSZ];
|
||||||
|
|
||||||
|
/* we may get here via hangup signal, in which case we want to fix up
|
||||||
|
a few of things before saving so that they won't be restored in
|
||||||
|
an improper state; these will be no-ops for normal save sequence */
|
||||||
|
u.uinvulnerable = 0;
|
||||||
|
if (iflags.save_uinwater) u.uinwater = 1, iflags.save_uinwater = 0;
|
||||||
|
if (iflags.save_uburied) u.uburied = 1, iflags.save_uburied = 0;
|
||||||
|
|
||||||
if (!program_state.something_worth_saving || !SAVEF[0])
|
if (!program_state.something_worth_saving || !SAVEF[0])
|
||||||
return 0;
|
return 0;
|
||||||
fq_save = fqname(SAVEF, SAVEPREFIX, 1); /* level files take 0 */
|
fq_save = fqname(SAVEF, SAVEPREFIX, 1); /* level files take 0 */
|
||||||
|
|||||||
Reference in New Issue
Block a user