Wip: Working on Room Movement
This commit is contained in:
@@ -44,19 +44,21 @@ std::vector<std::string> CommandParser::Noun(std::stringstream &sentences) {
|
||||
return nouns;
|
||||
}
|
||||
|
||||
|
||||
int CommandParser::Parse() {
|
||||
std::string cmd;
|
||||
std::string word;
|
||||
|
||||
std::string noun;
|
||||
std::string noun = "";
|
||||
|
||||
std::vector<std::string> verbs;
|
||||
std::vector<std::string> nouns;
|
||||
FUNCTION toRun;
|
||||
|
||||
|
||||
printf("Please Enter a command \n");
|
||||
printf("> ");
|
||||
getline(std::cin, cmd);
|
||||
std::cin.clear();
|
||||
cmd[0] = toupper(cmd[0]);
|
||||
std::stringstream c(cmd);
|
||||
|
||||
@@ -69,8 +71,19 @@ int CommandParser::Parse() {
|
||||
printf("Sorry kid, can't understand ya! \n");
|
||||
break;
|
||||
}
|
||||
|
||||
commands[verb]("");
|
||||
toRun = commands[verb];
|
||||
}
|
||||
|
||||
if (toRun) {
|
||||
toRun(noun);
|
||||
}
|
||||
cmd.clear();
|
||||
word.clear();
|
||||
verbs.clear();
|
||||
nouns.clear();
|
||||
c.clear();
|
||||
|
||||
toRun = nullptr;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user