diff --git a/src/console_input.cc b/src/console_input.cc index e7d2a2c..531176f 100644 --- a/src/console_input.cc +++ b/src/console_input.cc @@ -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); diff --git a/src/file_input.cc b/src/file_input.cc index 54600e0..e2ed7d7 100644 --- a/src/file_input.cc +++ b/src/file_input.cc @@ -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);