/* * TestAdventure.hpp * * Created on: 20/08/2012 * Author: rhys */#ifndef TESTADVENTURE_HPP_#define TESTADVENTURE_HPP_#include <iostream>#include <boost/algorithm/string.hpp>#include "HighScoreStage.hpp"classTestAdventure:publicZorkishStage{private:std::stringmessage;intmoves;boolalive;boolhiscore;public:TestAdventure(ZorkishGame&game):ZorkishStage(game){this->cleanup();}virtualStatusupdate(ActiveStageManager&smgr){if(!this->alive){if(this->hiscore){this->game.high_score().set_score(10,this->moves,"Test Adventure");smgr.set_next_stage(&this->game.high_score());}returnGameStage::Status::FINISH;}std::stringin;getline(std::cin,in);boost::to_upper(in);if(in=="QUIT"){this->message="Your adventure has ended without fame or fortune.";this->alive=false;}elseif(in=="HISCORE"){this->message="You have entered the magic word and will now see the \"New High Score\" screen.";this->hiscore=true;this->alive=false;}else{this->message="I don't know how to do that.";}this->moves++;returnGameStage::Status::CONTINUE;}virtualvoiddraw(){usingstd::cout;if(!this->message.empty()){cout<<this->message<<'\n';this->message.clear();}if(this->alive){cout<<":> ";}}virtualvoidcleanup(){this->message="Welcome to Zorkish: Void World\nThis world is simple and pointless. Used it to test Zorkish phase 1 spec.";this->moves=0;this->alive=true;this->hiscore=false;}};#endif /* TESTADVENTURE_HPP_ */