You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
986 B

  1. #include "src/interface/creation.hpp"
  2. #include "src/interface/info.hpp"
  3. #include <iostream>
  4. Player *createCharacter()
  5. {
  6. std::string name;
  7. char choice;
  8. Player *newPlayer = new Player("HackTheGame");
  9. std::cout << "Welcome to character creation !!!" << std::endl;
  10. do
  11. {
  12. std::cout << "Please enter your character name: (Max 15 letters)\n"
  13. << "> " << std::flush;
  14. std::cin >> name;
  15. if (name.size() > 15)
  16. {
  17. std::cout << "Your name is too long!" << std::endl;
  18. continue;
  19. }
  20. std::cout << "Creating your character..." << std::endl;
  21. delete newPlayer;
  22. newPlayer = new Player(name);
  23. std::cout << "Done...\n"
  24. << "Character Info: " << std::endl;
  25. Info::ofCharacter(newPlayer);
  26. std::cout << "Accept (y/N)?: " << std::flush;
  27. std::cin >> choice;
  28. } while (choice != 'Y' && choice != 'y');
  29. return newPlayer;
  30. }