fixed issue panic in console/file input
This commit is contained in:
@ -31,8 +31,12 @@ game_command console_input::get_command() {
|
||||
game_command_panic
|
||||
? tmp : tmp - move_north +
|
||||
(use ? apply_north : attack_north));
|
||||
} else // is just moving
|
||||
return get_direction(cmd);
|
||||
} else {
|
||||
auto tmp = get_direction(cmd);
|
||||
|
||||
if (tmp != game_command_panic)
|
||||
return tmp;
|
||||
}
|
||||
|
||||
return game_command_pass;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "console_output.h"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <ncurses.h>
|
||||
|
||||
|
||||
@ -73,10 +74,15 @@ void console_output::render() {
|
||||
if (idx % DISPLAY_WIDTH == 0 && idx)
|
||||
out << std::endl;
|
||||
|
||||
out << get_code(contents[idx]) + (char)contents[idx];
|
||||
out << get_code(contents[idx]) +
|
||||
(char)(contents[idx] ? contents[idx] : ' ');
|
||||
}
|
||||
}
|
||||
|
||||
void console_output::clear() {
|
||||
|
||||
}
|
||||
|
||||
void console_output::print_char(const position &pos, const char ch,
|
||||
const int attr) {
|
||||
if (pos.x >= DISPLAY_WIDTH || pos.y >= DISPLAY_HEIGHT)
|
||||
|
@ -31,8 +31,12 @@ game_command file_input::get_command() {
|
||||
game_command_panic
|
||||
? tmp : tmp - move_north +
|
||||
(use ? apply_north : attack_north));
|
||||
} else // is just moving
|
||||
return get_direction(cmd);
|
||||
} else {
|
||||
auto tmp = get_direction(cmd);
|
||||
|
||||
if (tmp != game_command_panic)
|
||||
return tmp;
|
||||
}
|
||||
|
||||
return game_command_pass;
|
||||
}
|
||||
|
Reference in New Issue
Block a user