fixed issue for file/console input u and a

This commit is contained in:
2024-07-05 21:18:50 -04:00
parent 713743b698
commit d6503579c4
2 changed files with 6 additions and 2 deletions

View File

@ -20,6 +20,8 @@ game_command console_input::get_command() {
else if (cmd == "r")
return game_restart;
else if (cmd == "u" || cmd == "a") {
bool use = cmd == "u";
in >> cmd;
if (in.eof())
@ -28,7 +30,7 @@ game_command console_input::get_command() {
return (game_command)((tmp = get_direction(cmd)) ==
game_command_panic
? tmp : tmp - move_north +
(cmd == "u" ? apply_north : attack_north));
(use ? apply_north : attack_north));
} else // is just moving
return get_direction(cmd);

View File

@ -20,6 +20,8 @@ game_command file_input::get_command() {
else if (cmd == "r")
return game_restart;
else if (cmd == "u" || cmd == "a") {
bool use = cmd == "u";
in >> cmd;
if (in.eof())
@ -28,7 +30,7 @@ game_command file_input::get_command() {
return (game_command)((tmp = get_direction(cmd)) ==
game_command_panic
? tmp : tmp - move_north +
(cmd == "u" ? apply_north : attack_north));
(use ? apply_north : attack_north));
} else // is just moving
return get_direction(cmd);