Skip to content

Commit

Permalink
Minor variable renaming related to getKeyInput
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcook committed Apr 5, 2021
1 parent 218da69 commit 60466e0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
14 changes: 7 additions & 7 deletions src/dungeon_los.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ static bool lookSee(Coord_t coord, bool &transparent) {
return false; // Don't look at a direct line of sight. A hack.
}

char query = ESCAPE;
char key = ESCAPE;
obj_desc_t msg = {'\0'};

if (los_rocks_and_objects == 0 && tile.creature_id > 1 && monsters[tile.creature_id].lit) {
Expand All @@ -505,11 +505,11 @@ static bool lookSee(Coord_t coord, bool &transparent) {
putStringClearToEOL(msg, Coord_t{0, 0});

panelMoveCursor(coord);
query = getKeyInput();
key = getKeyInput();

if (query == 'r' || query == 'R') {
if (key == 'r' || key == 'R') {
terminalSaveScreen();
query = (char) memoryRecall(j);
key = (char) memoryRecall(j);
terminalRestoreScreen();
}
}
Expand All @@ -531,7 +531,7 @@ static bool lookSee(Coord_t coord, bool &transparent) {
putStringClearToEOL(msg, Coord_t{0, 0});

panelMoveCursor(coord);
query = getKeyInput();
key = getKeyInput();
}
}

Expand Down Expand Up @@ -562,14 +562,14 @@ static bool lookSee(Coord_t coord, bool &transparent) {
(void) sprintf(msg, "%s %s ---pause---", description, wall_description);
putStringClearToEOL(msg, Coord_t{0, 0});
panelMoveCursor(coord);
query = getKeyInput();
key = getKeyInput();
}
}
}

if (msg[0] != 0) {
los_num_places_seen++;
if (query == ESCAPE) {
if (key == ESCAPE) {
return true;
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/game_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ void displayTextHelpFile(const std::string &filename) {

constexpr uint8_t max_line_length = 80;
char line_buffer[max_line_length];
char input;

while (feof(file) == 0) {
clearScreen();
Expand All @@ -65,8 +64,7 @@ void displayTextHelpFile(const std::string &filename) {
}

putStringClearToEOL("[ press any key to continue ]", Coord_t{23, 23});
input = getKeyInput();
if (input == ESCAPE) {
if (getKeyInput() == ESCAPE) {
break;
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/scores.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ void showScoresScreen() {
HighScore_t score{};
readHighScore(score);

char input;
char msg[100];

int i = 0;
Expand Down Expand Up @@ -231,8 +230,7 @@ void showScoresScreen() {
putStringClearToEOL("Rank Points Name Sex Race Class Lvl Killed By", Coord_t{0, 0});
eraseLine(Coord_t{1, 0});
putStringClearToEOL("[ press any key to continue ]", Coord_t{23, 23});
input = getKeyInput();
if (input == ESCAPE) {
if (getKeyInput() == ESCAPE) {
break;
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/ui_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ void printMessage(const char *msg) {

putString(" -more-", Coord_t{MSG_LINE, old_len});

char in_char;
char key;
do {
in_char = getKeyInput();
} while ((in_char != ' ') && (in_char != ESCAPE) && (in_char != '\n') && (in_char != '\r'));
key = getKeyInput();
} while ((key != ' ') && (key != ESCAPE) && (key != '\n') && (key != '\r'));
} else {
combine_messages = true;
}
Expand Down Expand Up @@ -487,16 +487,16 @@ int getInputConfirmationWithAbort(int column, const std::string &prompt) {

(void) addstr(" [y/n]");

char input = ' ';
while (input == ' ') {
input = getKeyInput();
char key = ' ';
while (key == ' ') {
key = getKeyInput();
}

messageLineClear();

if (input == 'N' || input == 'n') {
if (key == 'N' || key == 'n') {
return 0;
} else if (input == 'Y' || input == 'y') {
} else if (key == 'Y' || key == 'y') {
return 1;
} else {
return -1;
Expand Down

0 comments on commit 60466e0

Please sign in to comment.