Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7
This commit is contained in:
+5
-1
@@ -1,4 +1,4 @@
|
|||||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.370 $ $NHDT-Date: 1606919254 2020/12/02 14:27:34 $
|
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.371 $ $NHDT-Date: 1606954304 2020/12/03 00:11:44 $
|
||||||
|
|
||||||
General Fixes and Modified Features
|
General Fixes and Modified Features
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
@@ -507,6 +507,10 @@ Qt: don't get stuck in a loop after choosing "play" while the character name
|
|||||||
field is empty in the character selection widget
|
field is empty in the character selection widget
|
||||||
Qt: when a new message is issued, pan the message window to its left edge if
|
Qt: when a new message is issued, pan the message window to its left edge if
|
||||||
player panned it horizontally then didn't manually scroll it back
|
player panned it horizontally then didn't manually scroll it back
|
||||||
|
Qt: there was no way to enter extended command "#version" by typing; command
|
||||||
|
name matching was waiting to disambiguate it from "#versionshort"
|
||||||
|
and the only way to that was to type #version<return> but <return>
|
||||||
|
explicitly triggered rejection, cancelling '#' processing
|
||||||
Qt: {maybe just Qt+OSX:} when viewing a text window ('V' to look at 'history'
|
Qt: {maybe just Qt+OSX:} when viewing a text window ('V' to look at 'history'
|
||||||
for instance), clicking on [Search], entering a search target in the
|
for instance), clicking on [Search], entering a search target in the
|
||||||
resulting popup and clicking on [Okay] or typing <return>, the text
|
resulting popup and clicking on [Okay] or typing <return>, the text
|
||||||
|
|||||||
+44
-41
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 save.c $NHDT-Date: 1606919257 2020/12/02 14:27:37 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.163 $ */
|
/* NetHack 3.7 save.c $NHDT-Date: 1606949327 2020/12/02 22:48:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.164 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Michael Allison, 2009. */
|
/*-Copyright (c) Michael Allison, 2009. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -21,15 +21,12 @@ int dotcnt, dotrow; /* also used in restore */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void FDECL(savelevchn, (NHFILE *));
|
static void FDECL(savelevchn, (NHFILE *));
|
||||||
static void FDECL(savedamage, (NHFILE *));
|
|
||||||
/* static void FDECL(saveobj, (NHFILE *,struct obj *)); */
|
|
||||||
/* static void FDECL(savemon, (NHFILE *,struct monst *)); */
|
|
||||||
/* static void FDECL(savelevl, (NHFILE *, BOOLEAN_P)); */
|
|
||||||
static void FDECL(saveobj, (NHFILE *,struct obj *));
|
|
||||||
static void FDECL(savemon, (NHFILE *,struct monst *));
|
|
||||||
static void FDECL(savelevl, (NHFILE *,BOOLEAN_P));
|
static void FDECL(savelevl, (NHFILE *,BOOLEAN_P));
|
||||||
|
static void FDECL(savedamage, (NHFILE *));
|
||||||
static void FDECL(save_stairs, (NHFILE *));
|
static void FDECL(save_stairs, (NHFILE *));
|
||||||
|
static void FDECL(saveobj, (NHFILE *,struct obj *));
|
||||||
static void FDECL(saveobjchn, (NHFILE *,struct obj **));
|
static void FDECL(saveobjchn, (NHFILE *,struct obj **));
|
||||||
|
static void FDECL(savemon, (NHFILE *,struct monst *));
|
||||||
static void FDECL(savemonchn, (NHFILE *,struct monst *));
|
static void FDECL(savemonchn, (NHFILE *,struct monst *));
|
||||||
static void FDECL(savetrapchn, (NHFILE *,struct trap *));
|
static void FDECL(savetrapchn, (NHFILE *,struct trap *));
|
||||||
static void FDECL(savegamestate, (NHFILE *));
|
static void FDECL(savegamestate, (NHFILE *));
|
||||||
@@ -214,7 +211,7 @@ dosave0()
|
|||||||
getlev(onhfp, g.hackpid, ltmp);
|
getlev(onhfp, g.hackpid, ltmp);
|
||||||
close_nhfile(onhfp);
|
close_nhfile(onhfp);
|
||||||
if (nhfp->structlevel)
|
if (nhfp->structlevel)
|
||||||
bwrite(nhfp->fd, (genericptr_t) <mp, sizeof ltmp); /* level number*/
|
bwrite(nhfp->fd, (genericptr_t) <mp, sizeof ltmp); /* lvl no. */
|
||||||
savelev(nhfp, ltmp); /* actual level*/
|
savelev(nhfp, ltmp); /* actual level*/
|
||||||
delete_levelfile(ltmp);
|
delete_levelfile(ltmp);
|
||||||
}
|
}
|
||||||
@@ -242,9 +239,7 @@ NHFILE *nhfp;
|
|||||||
unsigned long uid;
|
unsigned long uid;
|
||||||
struct obj *bc_objs = (struct obj *)0;
|
struct obj *bc_objs = (struct obj *)0;
|
||||||
|
|
||||||
if (!g.program_state.saving)
|
g.program_state.saving++; /* caller should/did already set this... */
|
||||||
impossible("savegamestate called when not saving or changing levels?");
|
|
||||||
|
|
||||||
uid = (unsigned long) getuid();
|
uid = (unsigned long) getuid();
|
||||||
if (nhfp->structlevel) {
|
if (nhfp->structlevel) {
|
||||||
bwrite(nhfp->fd, (genericptr_t) &uid, sizeof uid);
|
bwrite(nhfp->fd, (genericptr_t) &uid, sizeof uid);
|
||||||
@@ -326,8 +321,11 @@ NHFILE *nhfp;
|
|||||||
save_msghistory(nhfp);
|
save_msghistory(nhfp);
|
||||||
if (nhfp->structlevel)
|
if (nhfp->structlevel)
|
||||||
bflush(nhfp->fd);
|
bflush(nhfp->fd);
|
||||||
|
g.program_state.saving--;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* potentially called from goto_level(do.c) as well as savestateinlock() */
|
||||||
boolean
|
boolean
|
||||||
tricked_fileremoved(nhfp, whynot)
|
tricked_fileremoved(nhfp, whynot)
|
||||||
NHFILE *nhfp;
|
NHFILE *nhfp;
|
||||||
@@ -371,8 +369,10 @@ savestateinlock()
|
|||||||
* readable by an external utility
|
* readable by an external utility
|
||||||
*/
|
*/
|
||||||
nhfp = open_levelfile(0, whynot);
|
nhfp = open_levelfile(0, whynot);
|
||||||
if (tricked_fileremoved(nhfp, whynot))
|
if (tricked_fileremoved(nhfp, whynot)) {
|
||||||
|
g.program_state.saving--;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (nhfp->structlevel)
|
if (nhfp->structlevel)
|
||||||
(void) read(nhfp->fd, (genericptr_t) &hpid, sizeof hpid);
|
(void) read(nhfp->fd, (genericptr_t) &hpid, sizeof hpid);
|
||||||
@@ -420,6 +420,7 @@ savestateinlock()
|
|||||||
}
|
}
|
||||||
g.program_state.saving--;
|
g.program_state.saving--;
|
||||||
g.havestate = flags.ins_chkpt;
|
g.havestate = flags.ins_chkpt;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -537,6 +538,7 @@ xchar lev;
|
|||||||
bflush(nhfp->fd);
|
bflush(nhfp->fd);
|
||||||
}
|
}
|
||||||
g.program_state.saving--;
|
g.program_state.saving--;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -598,6 +600,7 @@ boolean rlecomp;
|
|||||||
if (nhfp->structlevel) {
|
if (nhfp->structlevel) {
|
||||||
bwrite(nhfp->fd, (genericptr_t) levl, sizeof levl);
|
bwrite(nhfp->fd, (genericptr_t) levl, sizeof levl);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* used when saving a level and also when saving dungeon overview data */
|
/* used when saving a level and also when saving dungeon overview data */
|
||||||
@@ -656,6 +659,32 @@ NHFILE *nhfp;
|
|||||||
g.level.damagelist = 0;
|
g.level.damagelist = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
save_stairs(nhfp)
|
||||||
|
NHFILE *nhfp;
|
||||||
|
{
|
||||||
|
stairway *stway = g.stairs;
|
||||||
|
int buflen = (int) sizeof *stway;
|
||||||
|
|
||||||
|
while (stway) {
|
||||||
|
if (perform_bwrite(nhfp)) {
|
||||||
|
if (nhfp->structlevel) {
|
||||||
|
bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen);
|
||||||
|
bwrite(nhfp->fd, (genericptr_t) stway, sizeof *stway);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stway = stway->next;
|
||||||
|
}
|
||||||
|
if (perform_bwrite(nhfp)) {
|
||||||
|
if (nhfp->structlevel) {
|
||||||
|
buflen = -1;
|
||||||
|
bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* save one object;
|
||||||
|
caveat: this is only for perform_bwrite(); caller handles release_data() */
|
||||||
static void
|
static void
|
||||||
saveobj(nhfp, otmp)
|
saveobj(nhfp, otmp)
|
||||||
NHFILE *nhfp;
|
NHFILE *nhfp;
|
||||||
@@ -694,40 +723,14 @@ struct obj *otmp;
|
|||||||
}
|
}
|
||||||
/* omid used to be indirect via a pointer in oextra but has
|
/* omid used to be indirect via a pointer in oextra but has
|
||||||
become part of oextra itself; 0 means not applicable and
|
become part of oextra itself; 0 means not applicable and
|
||||||
gets saved/restored whenever any other oxtra components do */
|
gets saved/restored whenever any other oextra components do */
|
||||||
if (nhfp->structlevel)
|
if (nhfp->structlevel)
|
||||||
bwrite(nhfp->fd, (genericptr_t) &OMID(otmp), sizeof OMID(otmp));
|
bwrite(nhfp->fd, (genericptr_t) &OMID(otmp), sizeof OMID(otmp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
/* save an object chain; sets head of list to Null when done;
|
||||||
save_stairs(nhfp)
|
handles release_data() for each object in the list */
|
||||||
NHFILE *nhfp;
|
|
||||||
{
|
|
||||||
stairway *stway = g.stairs;
|
|
||||||
int buflen = (int) sizeof (stairway);
|
|
||||||
int len = 0;
|
|
||||||
|
|
||||||
while (stway) {
|
|
||||||
if (perform_bwrite(nhfp)) {
|
|
||||||
if (nhfp->structlevel) {
|
|
||||||
len += sizeof(buflen);
|
|
||||||
bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen);
|
|
||||||
len += sizeof(stairway);
|
|
||||||
bwrite(nhfp->fd, (genericptr_t) stway, sizeof(stairway));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stway = stway->next;
|
|
||||||
}
|
|
||||||
if (perform_bwrite(nhfp)) {
|
|
||||||
if (nhfp->structlevel) {
|
|
||||||
buflen = -1;
|
|
||||||
len += sizeof(buflen);
|
|
||||||
bwrite(nhfp->fd, (genericptr_t) &buflen, sizeof buflen);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
saveobjchn(nhfp, obj_p)
|
saveobjchn(nhfp, obj_p)
|
||||||
NHFILE *nhfp;
|
NHFILE *nhfp;
|
||||||
|
|||||||
+24
-10
@@ -167,26 +167,40 @@ void NetHackQtExtCmdRequestor::keyPressEvent(QKeyEvent *event)
|
|||||||
if (promptstr != "#")
|
if (promptstr != "#")
|
||||||
prompt->setText(promptstr.left(promptstr.size() - 1));
|
prompt->setText(promptstr.left(promptstr.size() - 1));
|
||||||
enableButtons();
|
enableButtons();
|
||||||
/*} else if (uc == '\r' || uc == '\n'; || uc == ' ') {*/
|
} else if ((uc < ' ' && !(uc == '\n' || uc == '\r'))
|
||||||
} else if (uc < ' ' || uc > std::max('z', 'Z')) {
|
|| uc > std::max('z', 'Z')) {
|
||||||
reject(); // done()
|
reject(); // done()
|
||||||
} else {
|
} else {
|
||||||
promptstr += QChar(uc); // event()->text()
|
// <return> is necessary if one command is a leading substring
|
||||||
|
// of another and superfluous otherwise
|
||||||
|
boolean checkexact = (uc == '\n' || uc == '\r' || uc == ' ');
|
||||||
|
if (!checkexact)
|
||||||
|
promptstr += QChar(uc); // event()->text()
|
||||||
QString typedstr = promptstr.mid(1); // skip the '#'
|
QString typedstr = promptstr.mid(1); // skip the '#'
|
||||||
unsigned matches = 0;
|
unsigned matches = 0;
|
||||||
unsigned match = 0;
|
unsigned matchindx = 0;
|
||||||
for (unsigned i=0; extcmdlist[i].ef_txt; i++) {
|
for (unsigned i=0; extcmdlist[i].ef_txt; i++) {
|
||||||
if (!interesting_command(i))
|
if (!interesting_command(i))
|
||||||
continue;
|
continue;
|
||||||
if (QString(extcmdlist[i].ef_txt).startsWith(typedstr)) {
|
QString cmdtxt = QString(extcmdlist[i].ef_txt);
|
||||||
++matches;
|
if (cmdtxt.startsWith(typedstr)) {
|
||||||
if (matches >= 2)
|
if (checkexact) {
|
||||||
break;
|
if (cmdtxt == typedstr) {
|
||||||
match = i;
|
matchindx = i;
|
||||||
|
matches = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (++matches >= 2)
|
||||||
|
break;
|
||||||
|
matchindx = i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (matches == 1)
|
if (matches == 1)
|
||||||
done(match+1);
|
done(matchindx + 1);
|
||||||
|
else if (checkexact)
|
||||||
|
reject();
|
||||||
else if (matches >= 2)
|
else if (matches >= 2)
|
||||||
prompt->setText(promptstr);
|
prompt->setText(promptstr);
|
||||||
enableButtons();
|
enableButtons();
|
||||||
|
|||||||
Reference in New Issue
Block a user