Mercurial > hg > early-roguelike
comparison arogue5/command.c @ 76:ad2cb9a07aaa
arogue5: fix player's typed responses getting put at the wrong place.
Some sections of code that prompt the user for a string of input were
calling get_str() with cw (the player-visible screen containing the
map), which caused whatever the player typed to get printed starting at
cw's idea of the cursor position, which was usually the Rogue's @-sign.
This corrupted the map.
The problem has been fixed by passing msgw (the message line at the top
of the screen) to get_str(), so the player's typing appears where msgw
thinks the cursor should be, which is in the sensible place right after
the prompt. Some other get_str() invocations which used hw or stdscr
have been left unmodified.
author | John "Elwin" Edwards <elwin@sdf.org> |
---|---|
date | Sat, 08 Sep 2012 22:05:05 -0700 |
parents | 7a7fb9b810e1 |
children | dfeed24bb616 |
comparison
equal
deleted
inserted
replaced
75:19903deed392 | 76:ad2cb9a07aaa |
---|---|
310 when CTRL('C') : | 310 when CTRL('C') : |
311 { | 311 { |
312 int tlev; | 312 int tlev; |
313 prbuf[0] = '\0'; | 313 prbuf[0] = '\0'; |
314 msg("Which level? "); | 314 msg("Which level? "); |
315 if(get_str(prbuf,cw) == NORM) { | 315 if(get_str(prbuf, msgw) == NORM) { |
316 tlev = atoi(prbuf); | 316 tlev = atoi(prbuf); |
317 if(tlev < 1) { | 317 if(tlev < 1) { |
318 mpos = 0; | 318 mpos = 0; |
319 msg("Illegal level."); | 319 msg("Illegal level."); |
320 } | 320 } |
927 msg(terse ? "Call it: " : "What do you want to call it? "); | 927 msg(terse ? "Call it: " : "What do you want to call it? "); |
928 if (guess[obj->o_which] != NULL) | 928 if (guess[obj->o_which] != NULL) |
929 free(guess[obj->o_which]); | 929 free(guess[obj->o_which]); |
930 strcpy(prbuf, elsewise); | 930 strcpy(prbuf, elsewise); |
931 } | 931 } |
932 if (get_str(prbuf, cw) == NORM) { | 932 if (get_str(prbuf, msgw) == NORM) { |
933 if (mark) { | 933 if (mark) { |
934 strncpy(obj->o_mark, prbuf, MARKLEN-1); | 934 strncpy(obj->o_mark, prbuf, MARKLEN-1); |
935 obj->o_mark[MARKLEN-1] = '\0'; | 935 obj->o_mark[MARKLEN-1] = '\0'; |
936 } | 936 } |
937 else { | 937 else { |