fix github issue #905 - ^A vs getpos()
Reported by entrez: using ^A instead of #retravel after interrupted travel can pick wrong location if cursor was previously positioned with movement commands rather than feature targeting because it won't be starting from the original spot. Also, ^A after ';' will just redescribe whatever was examined previously instead of having the player pick a new spot. This suppresses cursor positioning from the do-again queue so that repeating travel or quick-look or other command that needs player to choose a position will repeat the command but then need to have a position chosen. For interrupted #travel, the cursor will already be placed on the previous destination so that's relatively painless, but also allows a different destination to be chosen. It adds iflags.remember_getpos that callers of getpos() could set to be able to restore the old behavior but none do so far. Fixes #905
This commit is contained in:
@@ -196,6 +196,7 @@ struct instance_flags {
|
||||
boolean lua_testing; /* doing lua tests */
|
||||
boolean partly_eaten_hack; /* extra flag for xname() used when it's called
|
||||
* indirectly so we can't use xname_flags() */
|
||||
boolean remember_getpos; /* save getpos() positioning in do-again queue */
|
||||
boolean sad_feeling; /* unseen pet is dying */
|
||||
int at_midnight; /* only valid during end of game disclosure */
|
||||
int at_night; /* also only valid during end of game disclosure */
|
||||
|
||||
@@ -775,7 +775,10 @@ getpos(coord *ccp, boolean force, const char *goal)
|
||||
free(cmdq);
|
||||
} else {
|
||||
c = readchar_poskey(&tx, &ty, &sidx);
|
||||
if (!g.in_doagain)
|
||||
/* remember_getpos is normally False because reusing the
|
||||
current positioning during ^A is almost never the right
|
||||
thing to do, but caller could set it if that was needed */
|
||||
if (iflags.remember_getpos && !g.in_doagain)
|
||||
cmdq_add_key(CQ_REPEAT, c);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user