fixed issue with a and u commands
This commit is contained in:
@ -10,21 +10,26 @@ game_command console_input::get_command() {
|
|||||||
in >> cmd;
|
in >> cmd;
|
||||||
game_command tmp;
|
game_command tmp;
|
||||||
|
|
||||||
|
if (in.eof())
|
||||||
|
return game_command_terminate;
|
||||||
|
|
||||||
if (cmd == "q")
|
if (cmd == "q")
|
||||||
return game_command_terminate;
|
return game_command_terminate;
|
||||||
else if (cmd == "f")
|
else if (cmd == "f")
|
||||||
return the_world;
|
return the_world;
|
||||||
else if (cmd == "r")
|
else if (cmd == "r")
|
||||||
return game_restart;
|
return game_restart;
|
||||||
else if (cmd == "u")
|
else if (cmd == "u" || cmd == "a") {
|
||||||
|
in >> cmd;
|
||||||
|
|
||||||
|
if (in.eof())
|
||||||
|
return game_command_panic;
|
||||||
|
|
||||||
return (game_command)((tmp = get_direction(cmd)) ==
|
return (game_command)((tmp = get_direction(cmd)) ==
|
||||||
game_command_panic
|
game_command_panic
|
||||||
? tmp : tmp - move_north + apply_north);
|
? tmp : tmp - move_north +
|
||||||
else if (cmd == "a")
|
(cmd == "u" ? apply_north : attack_north));
|
||||||
return (game_command)((tmp = get_direction(cmd)) ==
|
} else // is just moving
|
||||||
game_command_panic
|
|
||||||
? tmp : tmp - move_north + attack_north);
|
|
||||||
else // is just moving
|
|
||||||
return get_direction(cmd);
|
return get_direction(cmd);
|
||||||
|
|
||||||
return game_command_pass;
|
return game_command_pass;
|
||||||
|
@ -10,21 +10,26 @@ game_command file_input::get_command() {
|
|||||||
in >> cmd;
|
in >> cmd;
|
||||||
game_command tmp;
|
game_command tmp;
|
||||||
|
|
||||||
|
if (in.eof())
|
||||||
|
return game_command_terminate;
|
||||||
|
|
||||||
if (cmd == "q")
|
if (cmd == "q")
|
||||||
return game_command_terminate;
|
return game_command_terminate;
|
||||||
else if (cmd == "f")
|
else if (cmd == "f")
|
||||||
return the_world;
|
return the_world;
|
||||||
else if (cmd == "r")
|
else if (cmd == "r")
|
||||||
return game_restart;
|
return game_restart;
|
||||||
else if (cmd == "u")
|
else if (cmd == "u" || cmd == "a") {
|
||||||
|
in >> cmd;
|
||||||
|
|
||||||
|
if (in.eof())
|
||||||
|
return game_command_panic;
|
||||||
|
|
||||||
return (game_command)((tmp = get_direction(cmd)) ==
|
return (game_command)((tmp = get_direction(cmd)) ==
|
||||||
game_command_panic
|
game_command_panic
|
||||||
? tmp : tmp - move_north + apply_north);
|
? tmp : tmp - move_north +
|
||||||
else if (cmd == "a")
|
(cmd == "u" ? apply_north : attack_north));
|
||||||
return (game_command)((tmp = get_direction(cmd)) ==
|
} else // is just moving
|
||||||
game_command_panic
|
|
||||||
? tmp : tmp - move_north + attack_north);
|
|
||||||
else // is just moving
|
|
||||||
return get_direction(cmd);
|
return get_direction(cmd);
|
||||||
|
|
||||||
return game_command_pass;
|
return game_command_pass;
|
||||||
|
0
tools/compile
Executable file → Normal file
0
tools/compile
Executable file → Normal file
0
tools/produceOutputs
Executable file → Normal file
0
tools/produceOutputs
Executable file → Normal file
0
tools/runSuite
Executable file → Normal file
0
tools/runSuite
Executable file → Normal file
Reference in New Issue
Block a user