From 8b252e70a9206b79e349b59a93cb1daa2bb6d162 Mon Sep 17 00:00:00 2001 From: "John \"Elwin\" Edwards" Date: Sat, 8 Sep 2012 22:05:05 -0700 Subject: [PATCH] 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. --- arogue5/command.c | 4 ++-- arogue5/misc.c | 2 +- arogue5/potions.c | 2 +- arogue5/rings.c | 2 +- arogue5/save.c | 2 +- arogue5/scrolls.c | 2 +- arogue5/wear.c | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arogue5/command.c b/arogue5/command.c index 25f1466..fd7e534 100644 --- a/arogue5/command.c +++ b/arogue5/command.c @@ -312,7 +312,7 @@ command() int tlev; prbuf[0] = '\0'; msg("Which level? "); - if(get_str(prbuf,cw) == NORM) { + if(get_str(prbuf, msgw) == NORM) { tlev = atoi(prbuf); if(tlev < 1) { mpos = 0; @@ -929,7 +929,7 @@ bool mark; free(guess[obj->o_which]); strcpy(prbuf, elsewise); } - if (get_str(prbuf, cw) == NORM) { + if (get_str(prbuf, msgw) == NORM) { if (mark) { strncpy(obj->o_mark, prbuf, MARKLEN-1); obj->o_mark[MARKLEN-1] = '\0'; diff --git a/arogue5/misc.c b/arogue5/misc.c index 704d959..ba47704 100644 --- a/arogue5/misc.c +++ b/arogue5/misc.c @@ -727,7 +727,7 @@ int which; (obj->o_flags & ISKNOW) == 0 && m_guess[which] == NULL) { msg(terse ? "Call it: " : "What do you want to call it? "); - if (get_str(buf, cw) == NORM) { + if (get_str(buf, msgw) == NORM) { m_guess[which] = new((unsigned int) strlen(buf) + 1); strcpy(m_guess[which], buf); } diff --git a/arogue5/potions.c b/arogue5/potions.c index 79575dc..2a6565a 100644 --- a/arogue5/potions.c +++ b/arogue5/potions.c @@ -607,7 +607,7 @@ bool is_potion; p_guess[which] == NULL) { msg(terse ? "Call it: " : "What do you want to call it? "); - if (get_str(buf, cw) == NORM) + if (get_str(buf, msgw) == NORM) { p_guess[which] = new((unsigned int) strlen(buf) + 1); strcpy(p_guess[which], buf); diff --git a/arogue5/rings.c b/arogue5/rings.c index 570856c..20d718c 100644 --- a/arogue5/rings.c +++ b/arogue5/rings.c @@ -99,7 +99,7 @@ register struct object *obj; (obj->o_flags & ISKNOW) == 0 && r_guess[obj->o_which] == NULL) { msg(terse ? "Call it: " : "What do you want to call it? "); - if (get_str(buf, cw) == NORM) + if (get_str(buf, msgw) == NORM) { r_guess[obj->o_which] = new((unsigned int) strlen(buf) + 1); strcpy(r_guess[obj->o_which], buf); diff --git a/arogue5/save.c b/arogue5/save.c index 69bac82..de5b657 100644 --- a/arogue5/save.c +++ b/arogue5/save.c @@ -69,7 +69,7 @@ save_game() msg("File name: "); mpos = 0; buf[0] = '\0'; - if (get_str(buf, cw) == QUIT) + if (get_str(buf, msgw) == QUIT) { msg(""); return FALSE; diff --git a/arogue5/scrolls.c b/arogue5/scrolls.c index b2e93f0..ebccd0b 100644 --- a/arogue5/scrolls.c +++ b/arogue5/scrolls.c @@ -700,7 +700,7 @@ pet_message: msg("The dungeon begins to rumble and shake!"); (obj->o_flags & ISPOST) == 0 && s_guess[which] == NULL) { msg(terse ? "Call it: " : "What do you want to call it? "); - if (get_str(buf, cw) == NORM) + if (get_str(buf, msgw) == NORM) { s_guess[which] = new(strlen(buf) + 1); strcpy(s_guess[which], buf); diff --git a/arogue5/wear.c b/arogue5/wear.c index 625ba83..337e0a1 100644 --- a/arogue5/wear.c +++ b/arogue5/wear.c @@ -230,7 +230,7 @@ wear() (obj->o_flags & ISKNOW) == 0 && m_guess[obj->o_which] == NULL) { msg(terse ? "Call it: " : "What do you want to call it? "); - if (get_str(buf, cw) == NORM) { + if (get_str(buf, msgw) == NORM) { m_guess[obj->o_which] = new((unsigned int) strlen(buf) + 1); strcpy(m_guess[obj->o_which], buf); }