diff --git a/main.cpp b/main.cpp index 464953b..97fd43d 100644 --- a/main.cpp +++ b/main.cpp @@ -52,45 +52,6 @@ int main() EndGame(player); } -Player PromptForPlayer() -{ - std::string name = ""; - std::cout << "Enter your player name:" << std::endl; - std::getline(std::cin, name); - - std::string charClass_str = ""; - do - { - std::cout << std::endl << "Enter your character class, (F)ighter, (W)izard, or (R)ogue:" << std::endl; - std::getline(std::cin, charClass_str); - } while(charClass_str != "F" && - charClass_str != "W" && - charClass_str != "R"); - - CharClass charClass; - if(charClass_str == "F") - charClass = CharClass::FIGHTER; - else if(charClass_str == "W") - charClass = CharClass::WIZARD; - else if(charClass_str == "R") - charClass = CharClass::ROGUE; - - return Player(name, charClass); -} - -char PromptTravel() -{ - while(true) - { - char travel = 'K'; - std::cout << "Travel: (C)ave, (D)esert, (F)oothills, or return to the (K)ing:" << std::endl; - std::cin >> travel; - - if(travel == 'K' || travel == 'C' || travel == 'D' || travel == 'F') - return travel; - } -} - Player Intro() { // intro text & setup @@ -158,3 +119,45 @@ void EndGame(Player &player) // show total enemies killed & total gold found // THE END } + + + +// MY IMPLEMENTATION +Player PromptForPlayer() +{ + std::string name = ""; + std::cout << "Enter your player name:" << std::endl; + std::getline(std::cin, name); + + std::string charClass_str = ""; + do + { + std::cout << std::endl << "Enter your character class, (F)ighter, (W)izard, or (R)ogue:" << std::endl; + std::getline(std::cin, charClass_str); + } while(charClass_str != "F" && + charClass_str != "W" && + charClass_str != "R"); + + CharClass charClass; + if(charClass_str == "F") + charClass = CharClass::FIGHTER; + else if(charClass_str == "W") + charClass = CharClass::WIZARD; + else if(charClass_str == "R") + charClass = CharClass::ROGUE; + + return Player(name, charClass); +} + +char PromptTravel() +{ + while(true) + { + char travel = 'K'; + std::cout << "Travel: (C)ave, (D)esert, (F)oothills, or return to the (K)ing:" << std::endl; + std::cin >> travel; + + if(travel == 'K' || travel == 'C' || travel == 'D' || travel == 'F') + return travel; + } +}