fixed issue for file/console input u and a
This commit is contained in:
@ -20,6 +20,8 @@ game_command console_input::get_command() {
|
|||||||
else if (cmd == "r")
|
else if (cmd == "r")
|
||||||
return game_restart;
|
return game_restart;
|
||||||
else if (cmd == "u" || cmd == "a") {
|
else if (cmd == "u" || cmd == "a") {
|
||||||
|
bool use = cmd == "u";
|
||||||
|
|
||||||
in >> cmd;
|
in >> cmd;
|
||||||
|
|
||||||
if (in.eof())
|
if (in.eof())
|
||||||
@ -28,7 +30,7 @@ game_command console_input::get_command() {
|
|||||||
return (game_command)((tmp = get_direction(cmd)) ==
|
return (game_command)((tmp = get_direction(cmd)) ==
|
||||||
game_command_panic
|
game_command_panic
|
||||||
? tmp : tmp - move_north +
|
? tmp : tmp - move_north +
|
||||||
(cmd == "u" ? apply_north : attack_north));
|
(use ? apply_north : attack_north));
|
||||||
} else // is just moving
|
} else // is just moving
|
||||||
return get_direction(cmd);
|
return get_direction(cmd);
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@ game_command file_input::get_command() {
|
|||||||
else if (cmd == "r")
|
else if (cmd == "r")
|
||||||
return game_restart;
|
return game_restart;
|
||||||
else if (cmd == "u" || cmd == "a") {
|
else if (cmd == "u" || cmd == "a") {
|
||||||
|
bool use = cmd == "u";
|
||||||
|
|
||||||
in >> cmd;
|
in >> cmd;
|
||||||
|
|
||||||
if (in.eof())
|
if (in.eof())
|
||||||
@ -28,7 +30,7 @@ game_command file_input::get_command() {
|
|||||||
return (game_command)((tmp = get_direction(cmd)) ==
|
return (game_command)((tmp = get_direction(cmd)) ==
|
||||||
game_command_panic
|
game_command_panic
|
||||||
? tmp : tmp - move_north +
|
? tmp : tmp - move_north +
|
||||||
(cmd == "u" ? apply_north : attack_north));
|
(use ? apply_north : attack_north));
|
||||||
} else // is just moving
|
} else // is just moving
|
||||||
return get_direction(cmd);
|
return get_direction(cmd);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user