Fixed overcomplicated whoopises
This commit is contained in:
@@ -22,13 +22,6 @@ public:
|
|||||||
std::vector<std::string> Verb(std::stringstream &sentences);
|
std::vector<std::string> Verb(std::stringstream &sentences);
|
||||||
std::vector<std::string> Noun(std::stringstream &sentences);
|
std::vector<std::string> Noun(std::stringstream &sentences);
|
||||||
|
|
||||||
inline friend void swap(CommandParser& lhs, CommandParser& rhs)
|
|
||||||
{
|
|
||||||
using std::swap;
|
|
||||||
swap(lhs.commands, rhs.commands);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline void CommandUnrecognized() { printf("I don't know how to do that.\n"); }
|
static inline void CommandUnrecognized() { printf("I don't know how to do that.\n"); }
|
||||||
int Parse();
|
int Parse();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
Game();
|
Game();
|
||||||
Game(Game& rhs);
|
|
||||||
Game& operator=(Game& rhs);
|
|
||||||
|
|
||||||
inline bool GetIsActive() const { return isActive; }
|
inline bool GetIsActive() const { return isActive; }
|
||||||
bool Init();
|
bool Init();
|
||||||
@@ -66,13 +64,8 @@ public:
|
|||||||
return *game_;
|
return *game_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline friend void swap(Game &lhs, Game &rhs)
|
static void SetGameInstance(Game * g) {
|
||||||
{
|
game_ = g;
|
||||||
using std::swap;
|
|
||||||
swap(lhs.isActive, rhs.isActive);
|
|
||||||
swap(lhs.progress, rhs.progress);
|
|
||||||
swap(lhs.player, rhs.player);
|
|
||||||
swap(lhs.parser, rhs.parser);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~Game();
|
~Game();
|
||||||
|
|||||||
+1
-11
@@ -49,17 +49,6 @@ bool Game::Init() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::Game(Game &rhs)
|
|
||||||
{
|
|
||||||
player = rhs.player;
|
|
||||||
progress = rhs.progress;
|
|
||||||
}
|
|
||||||
|
|
||||||
Game& Game::operator=(Game &rhs)
|
|
||||||
{
|
|
||||||
swap(*this, rhs);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Game::Run() {
|
void Game::Run() {
|
||||||
while (isActive) {
|
while (isActive) {
|
||||||
@@ -83,6 +72,7 @@ void Game::ChangeRoom(Room r) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Quit(const std::string &n) {
|
int Quit(const std::string &n) {
|
||||||
|
printf("Bye Bye! \nb");
|
||||||
Game::Instance().SetIsActive(false);
|
Game::Instance().SetIsActive(false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ int main(int argc, char *argv[]) {
|
|||||||
Game game; // Calls default constructor which Initializes GAME
|
Game game; // Calls default constructor which Initializes GAME
|
||||||
|
|
||||||
if (!game) {
|
if (!game) {
|
||||||
game = Game::Instance();
|
game.Init();
|
||||||
|
Game::SetGameInstance(&game);
|
||||||
}
|
}
|
||||||
while (game.GetIsActive()) {
|
while (game.GetIsActive()) {
|
||||||
game.Run();
|
game.Run();
|
||||||
|
|||||||
Reference in New Issue
Block a user